#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int getNumberToken(char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putNumberToken(int, char *, int);
void main(void) {
  char s[] = "5432";
  int k = 0;
  int val = getNumberToken(s, &k);
  char outs[256];
  printf("val = %d, k = %d\n", val, k);
  putNumberToken(val, outs, 256);
  printf("val = %s\n", outs);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0xebf(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <getNumberToken@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1050 <putNumberToken@plt>
lea    -0x110(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x118,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x32333435,0x8(%rsp)
32
movl   $0x0,0x4(%rsp)
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1030 <getNumberToken@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edx
lea    0xe9a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x100,%edx
call   1050 <putNumberToken@plt>
lea    0xe88(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [5 x i8] c"5432\00"
@.str = [18 x i8] c"val = %d, k = %d\0A\00"
@.str.1 = [10 x i8] c"val = %s\0A\00"
define void @main() {
%1 = alloca [5 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = bitcast [5 x i8]* %1 to i8*
store i32 0, i32* %2
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = call i32 @getNumberToken(i8* %6, i32* %2)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = call i32 @putNumberToken(i32 %11, i8* %12, i32 256)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret void
}

LLVM IR (-O2):
@__const.main.s = [5 x i8] c"5432\00"
@.str = [18 x i8] c"val = %d, k = %d\0A\00"
@.str.1 = [10 x i8] c"val = %s\0A\00"
define void @main() {
%1 = alloca [5 x i8]
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = call i32 @getNumberToken(i8* %4, i32* %2)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
%10 = call i32 @putNumberToken(i32 %6, i8* %7, i32 256)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}