ARM assembly language to convert integer, 1194684 to hexadecimal. The signature
ID: 3685861 • Letter: A
Question
ARM assembly language to convert integer, 1194684 to hexadecimal.
The signature of the routine is char*int2hex(int convert) where:
int convert = 1194684;
The output must be in the format 0Xdddddddd
I need the ARM Assembly Language NOT the C-code.
The C program is:
#include <stdlib.h>
#include <stdio.h>
extern char * int2hex( int convert ) ;
int main( int argc, char * argv[] )
{
int convert = 1194684 ;
char * result ;
result = int2hex( convert ) ;
printf( "Integer to hex string: %s ", result ) ;
}
Explanation / Answer
.LC0:
string "Integer to hex string, %s "
main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
movl %edi, -20(%rbp)
movq %rsi, -32(%rbp)
movl $1194684, -12(%rbp)
movl -12(%rbp), %eax
movl %eax, %edi
call int2hex
movq %rax, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rsi
movl $.LC0, %edi
movl $0, %eax
call printf
movl $0, %eax
leave
ret