I have written the following code in C and i am trying to convert it to assembly and view each letter as the corresponding hex value :
#include <stdio.h>
int main()
{
int x = 1337;
char *s = "Hello world";
char buff[4] = {'a','b','c','d'};
int i = 0;
while (i<4)
{
printf("%02x", buff[i++]);
}
putchar(0xa);
return 0;
}
But the output i am getting is a lot different than the one i wanted :
0000000000001149 <main>:
1149: 55 push %rbp
114a: 48 89 e5 mov %rsp,%rbp
114d: 48 83 ec 20 sub $0x20,%rsp
1151: c7 45 f8 39 05 00 00 movl $0x539,-0x8(%rbp)
1158: 48 8d 05 a5 0e 00 00 lea 0xea5(%rip),%rax # 2004 <_IO_stdin_used+0x4>
115f: 48 89 45 f0 mov %rax,-0x10(%rbp)
1163: c7 45 ec 61 62 63 64 movl $0x64636261,-0x14(%rbp)
116a: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
1171: eb 29 jmp 119c <main+0x53>
1173: 8b 45 fc mov -0x4(%rbp),%eax
1176: 8d 50 01 lea 0x1(%rax),%edx
1179: 89 55 fc mov %edx,-0x4(%rbp)
117c: 48 98 cltq
117e: 0f b6 44 05 ec movzbl -0x14(%rbp,%rax,1),%eax
1183: 0f be c0 movsbl %al,%eax
1186: 89 c6 mov %eax,%esi
1188: 48 8d 05 81 0e 00 00 lea 0xe81(%rip),%rax # 2010 <_IO_stdin_used+0x10>
118f: 48 89 c7 mov %rax,%rdi
1192: b8 00 00 00 00 mov $0x0,%eax
1197: e8 a4 fe ff ff call 1040 <printf@plt>
119c: 83 7d fc 03 cmpl $0x3,-0x4(%rbp)
11a0: 7e d1 jle 1173 <main+0x2a>
11a2: bf 0a 00 00 00 mov $0xa,%edi
11a7: e8 84 fe ff ff call 1030 <putchar@plt>
11ac: b8 00 00 00 00 mov $0x0,%eax
11b1: c9 leave
11b2: c3 ret
The command i used was objdump -d test.out. The output i want is like the following :
MOV %eax, 0x61 (for letter 'a')
or something like :
MOV w0, 0x61
How can i get this output?