Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (23 sloc) 406 Bytes

Print a literal integer

C

#include <stdio.h>

int main ()
{
    printf ( "%i\n" , 123 ) ;

    return 0 ;
}

Assembly

        .include "utils.s"

        global_text main

        prepare_stack

        mov $123 , %rax

        print_int %rax

        print_nl

        return_integer $0

Assemble and run

$ gcc print-literal-int.s -lm && ./a.out
123