#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 */
typedef int /*<<< orphan*/ key;
typedef int /*<<< orphan*/ awardData;

/* Variables and functions */
int /*<<< orphan*/ Com_sprintf(char *, int, char *, int);
int /*<<< orphan*/ Info_ValueForKey(char *, char *);
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ trap_Cvar_VariableStringBuffer(char *, char *, int);
int UI_GetAwardLevel(int award) {
  char key[16];
  char awardData[1024];
  trap_Cvar_VariableStringBuffer("g_spAwards", awardData, sizeof(awardData));
  Com_sprintf(key, sizeof(key), "a%i", award);
  return atoi(Info_ValueForKey(awardData, key));
}


x86 assembly (clang, -O0):
<UI_GetAwardLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x420(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x400,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x10,%esi
lea    0xe92(%rip),%rdx
call   1050 <Com_sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <Info_ValueForKey@plt>
mov    %eax,%edi
call   1060 <atoi@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_GetAwardLevel>:
push   %r15
push   %r14
push   %rbx
sub    $0x410,%rsp
mov    %edi,%ebx
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
mov    $0x400,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
lea    0xe9d(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x10,%esi
mov    %ebx,%ecx
call   1050 <Com_sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <Info_ValueForKey@plt>
mov    %eax,%edi
call   1060 <atoi@plt>
add    $0x410,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"g_spAwards\00"
@.str.1 = [4 x i8] c"a%i\00"
define i32 @UI_GetAwardLevel(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = alloca [1024 x i8]
store i32 %0, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @trap_Cvar_VariableStringBuffer(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i32 1024)
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @Com_sprintf(i8* %7, i32 16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%12 = call i32 @Info_ValueForKey(i8* %10, i8* %11)
%13 = call i32 @atoi(i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [11 x i8] c"g_spAwards\00"
@.str.1 = [4 x i8] c"a%i\00"
define i32 @UI_GetAwardLevel(i32 %0) {
%2 = alloca [16 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @trap_Cvar_VariableStringBuffer(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i32 1024)
%7 = call i32 @Com_sprintf(i8* %4, i32 16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%8 = call i32 @Info_ValueForKey(i8* %5, i8* %4)
%9 = call i32 @atoi(i32 %8)
ret i32 %9
}