#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 */
struct tokenList {
  int dummy;
};
struct outputBuffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ outputString(struct outputBuffer *, struct tokenList *, int,
                                char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void outputNum(struct outputBuffer *ob, struct tokenList *toks, int updateField,
               int newValue) {
  char val[50];
  sprintf(val, "%d", newValue);
  outputString(ob, toks, updateField, val);
}


x86 assembly (clang, -O0):
<outputNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xebc(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x50(%rbp),%rcx
call   1030 <outputString@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputNum>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xec6(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %ecx,%edx
call   1040 <sprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r15,%rcx
call   1030 <outputString@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.outputBuffer = type { i32 }
%struct.tokenList = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @outputNum(%struct.outputBuffer* %0, %struct.tokenList* %1, i32 %2, i32 %3) {
%5 = alloca %struct.outputBuffer*
%6 = alloca %struct.tokenList*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [50 x i8]
store %struct.outputBuffer* %0, %struct.outputBuffer** %5
store %struct.tokenList* %1, %struct.tokenList** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%11 = load i32, i32* %8
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load %struct.outputBuffer*, %struct.outputBuffer** %5
%14 = load %struct.tokenList*, %struct.tokenList** %6
%15 = load i32, i32* %7
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%17 = call i32 @outputString(%struct.outputBuffer* %13, %struct.tokenList* %14, i32 %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.outputBuffer = type { i32 }
%struct.tokenList = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @outputNum(%struct.outputBuffer* %0, %struct.tokenList* %1, i32 %2, i32 %3) {
%5 = alloca [50 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%8 = call i32 @outputString(%struct.outputBuffer* %0, %struct.tokenList* %1, i32 %2, i8* %6)
ret void
}