#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 atoi(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int look_up_flag(int number) {
  int index = 0;
  char temp[50];
  char part1[25];
  char part2[25];
  snprintf(temp, 50, "%d", number);
  strncpy(part1, temp, 5);
  strncpy(part2, &temp[5], 3);
  index = atoi(part1) + atoi(part2);
  return index;
}


x86 assembly (clang, -O0):
<look_up_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x32,%esi
lea    0xea8(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0x40(%rbp),%rsi
add    $0x5,%rsi
mov    $0x3,%edx
call   1030 <strncpy@plt>
lea    -0x60(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<look_up_flag>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %edi,%ecx
lea    0xebc(%rip),%rdx
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1040 <snprintf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
lea    0x45(%rsp),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncpy@plt>
mov    %r14,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <atoi@plt>
add    %ebp,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @look_up_flag(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i8]
%5 = alloca [25 x i8]
%6 = alloca [25 x i8]
store i32 %0, i32* %2
store i32 0, i32* %3
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @snprintf(i8* %7, i32 50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%12 = call i32 @strncpy(i8* %10, i8* %11, i32 5)
%13 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 5
%15 = call i32 @strncpy(i8* %13, i8* %14, i32 3)
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%17 = call i32 @atoi(i8* %16)
%18 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%19 = call i32 @atoi(i8* %18)
%20 = add nsw i32 %17, %19
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @look_up_flag(i32 %0) {
%2 = alloca [50 x i8]
%3 = alloca [25 x i8]
%4 = alloca [25 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%8 = call i32 @snprintf(i8* %5, i32 50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%9 = call i32 @strncpy(i8* %6, i8* %5, i32 5)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 5
%11 = call i32 @strncpy(i8* %7, i8* %10, i32 3)
%12 = call i32 @atoi(i8* %6)
%13 = call i32 @atoi(i8* %7)
%14 = add nsw i32 %13, %12
ret i32 %14
}