Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Last active August 29, 2015 14:11
Show Gist options
  • Save Arachnid/e543782877f3aaeef622 to your computer and use it in GitHub Desktop.
Save Arachnid/e543782877f3aaeef622 to your computer and use it in GitHub Desktop.
volatile long int a = 123;
volatile long int b = 456;
char foo;
int main() {
foo = a < b;
}
00000028 <main>:
28: cf 93 push r28
2a: df 93 push r29
2c: cd b7 in r28, 0x3d ; 61
2e: de b7 in r29, 0x3e ; 62
30: 20 91 60 00 lds r18, 0x0060
34: 30 91 61 00 lds r19, 0x0061
38: 40 91 62 00 lds r20, 0x0062
3c: 50 91 63 00 lds r21, 0x0063
40: 80 91 64 00 lds r24, 0x0064
44: 90 91 65 00 lds r25, 0x0065
48: a0 91 66 00 lds r26, 0x0066
4c: b0 91 67 00 lds r27, 0x0067
50: 61 e0 ldi r22, 0x01 ; 1
52: 28 17 cp r18, r24
54: 39 07 cpc r19, r25
56: 4a 07 cpc r20, r26
58: 5b 07 cpc r21, r27
5a: 0c f0 brlt .+2 ; 0x5e <__SREG__+0x1f>
5c: 60 e0 ldi r22, 0x00 ; 0
5e: 86 2f mov r24, r22
60: 80 93 68 00 sts 0x0068, r24
64: df 91 pop r29
66: cf 91 pop r28
68: 08 95 ret
volatile char a_hrs = 1;
volatile char a_mins = 2;
volatile char a_secs = 3;
volatile char b_hrs = 4;
volatile char b_mins = 5;
volatile char b_secs = 6;
char foo;
int main() {
foo = (a_hrs < b_hrs) || (a_hrs == b_hrs && a_mins < b_mins) || (a_hrs == b_hrs && a_mins == b_mins && a_secs < b_secs);
}
00000028 <main>:
28: cf 93 push r28
2a: df 93 push r29
2c: cd b7 in r28, 0x3d ; 61
2e: de b7 in r29, 0x3e ; 62
30: 90 91 60 00 lds r25, 0x0060
34: 80 91 63 00 lds r24, 0x0063
38: 98 17 cp r25, r24
3a: f4 f0 brlt .+60 ; 0x78 <__SREG__+0x39>
3c: 90 91 60 00 lds r25, 0x0060
40: 80 91 63 00 lds r24, 0x0063
44: 98 17 cp r25, r24
46: 31 f4 brne .+12 ; 0x54 <__SREG__+0x15>
48: 90 91 61 00 lds r25, 0x0061
4c: 80 91 64 00 lds r24, 0x0064
50: 98 17 cp r25, r24
52: 94 f0 brlt .+36 ; 0x78 <__SREG__+0x39>
54: 90 91 60 00 lds r25, 0x0060
58: 80 91 63 00 lds r24, 0x0063
5c: 98 17 cp r25, r24
5e: 79 f4 brne .+30 ; 0x7e <__SREG__+0x3f>
60: 90 91 61 00 lds r25, 0x0061
64: 80 91 64 00 lds r24, 0x0064
68: 98 17 cp r25, r24
6a: 49 f4 brne .+18 ; 0x7e <__SREG__+0x3f>
6c: 90 91 62 00 lds r25, 0x0062
70: 80 91 65 00 lds r24, 0x0065
74: 98 17 cp r25, r24
76: 1c f4 brge .+6 ; 0x7e <__SREG__+0x3f>
78: 81 e0 ldi r24, 0x01 ; 1
7a: 90 e0 ldi r25, 0x00 ; 0
7c: 02 c0 rjmp .+4 ; 0x82 <__SREG__+0x43>
7e: 80 e0 ldi r24, 0x00 ; 0
80: 90 e0 ldi r25, 0x00 ; 0
82: 80 93 66 00 sts 0x0066, r24
86: df 91 pop r29
88: cf 91 pop r28
8a: 08 95 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment