Skip to content

Instantly share code, notes, and snippets.

@jsoffer
Created October 13, 2011 17:03
Show Gist options
  • Save jsoffer/1284803 to your computer and use it in GitHub Desktop.
Save jsoffer/1284803 to your computer and use it in GitHub Desktop.
/* archivo, test.c */
#include <stdio.h>
void main () {
char c;
c = c & 0;
printf("The value of c is %d", (int)c);
int j = 255;
c = (c | j);
printf("The value of c is %d", (int)c);
}
/* listado, test.lst: gcc -c -g -Wa,-adhlns=test.lst test.c */
1 .file "test.c"
9 .Ltext0:
10 .section .rodata
11 .LC0:
12 0000 54686520 .string "The value of c is %d"
12 76616C75
12 65206F66
12 20632069
12 73202564
13 .text
14 .p2align 4,,15
15 .globl main
17 main:
18 .LFB3:
19 .file 1 "test.c"
1:test.c **** #include <stdio.h>
2:test.c ****
3:test.c **** void main () {
20 .loc 1 3 0
21 0000 8D4C2404 leal 4(%esp), %ecx
22 .LCFI0:
23 0004 83E4F0 andl $-16, %esp
24 0007 FF71FC pushl -4(%ecx)
25 .LCFI1:
26 000a 55 pushl %ebp
27 .LCFI2:
28 000b 89E5 movl %esp, %ebp
29 .LCFI3:
30 000d 51 pushl %ecx
31 .LCFI4:
32 000e 83EC24 subl $36, %esp
33 .LCFI5:
4:test.c **** char c;
5:test.c **** c = c & 0;
34 .loc 1 5 0
35 0011 C645F700 movb $0, -9(%ebp)
6:test.c **** printf("The value of c is %d", (int)c);
36 .loc 1 6 0
37 0015 0FBE45F7 movsbl -9(%ebp),%eax
38 0019 89442404 movl %eax, 4(%esp)
39 001d C7042400 movl $.LC0, (%esp)
39 000000
40 0024 E8FCFFFF call printf
40 FF
7:test.c **** int j = 255;
41 .loc 1 7 0
42 0029 C745F8FF movl $255, -8(%ebp)
42 000000
8:test.c **** c = (c | j);
43 .loc 1 8 0
44 0030 8B45F8 movl -8(%ebp), %eax
45 0033 0845F7 orb %al, -9(%ebp)
9:test.c **** printf("The value of c is %d", (int)c);
46 .loc 1 9 0
47 0036 0FBE45F7 movsbl -9(%ebp),%eax
48 003a 89442404 movl %eax, 4(%esp)
49 003e C7042400 movl $.LC0, (%esp)
49 000000
50 0045 E8FCFFFF call printf
50 FF
10:test.c **** }
51 .loc 1 10 0
52 004a 83C424 addl $36, %esp
53 004d 59 popl %ecx
54 004e 5D popl %ebp
55 004f 8D61FC leal -4(%ecx), %esp
56 0052 C3 ret
57 .LFE3:
112 .Letext0:
DEFINED SYMBOLS
*ABS*:0000000000000000 test.c
/var/tmp//ccsk632l.s:17 .text:0000000000000000 main
UNDEFINED SYMBOLS
printf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment