#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*/ value;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ read_profile_string(char const *, char const *, char *, int,
                                       int /*<<< orphan*/ *, char const *);
int read_profile_int(const char *section, const char *key, int default_value,
                     const char *file) {
  char value[32] = {0};
  if (!read_profile_string(section, key, value, sizeof(value), NULL, file)) {
    return default_value;
  } else {
    return atoi(value);
  }
}


x86 assembly (clang, -O0):
<read_profile_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x50(%rbp),%rdx
mov    -0x28(%rbp),%r9
mov    $0x20,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <read_profile_string@plt>
cmp    $0x0,%eax
jne    118a <read_profile_int+0x5a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <read_profile_int+0x66>
lea    -0x50(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_profile_int>:
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r9
mov    %edx,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x20,%ecx
xor    %r8d,%r8d
call   1030 <read_profile_string@plt>
test   %eax,%eax
je     1154 <read_profile_int+0x34>
mov    %rsp,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_profile_int(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca [32 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%11 = bitcast [32 x i8]* %10 to i8*
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%15 = load i8*, i8** %9
%16 = call i32 @read_profile_string(i8* %12, i8* %13, i8* %14, i32 32, i32* null, i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %4
%19 = load i32, i32* %8
store i32 %19, i32* %5
br label %23
20: ; preds = %4
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %5
br label %23
23: ; preds = %20, %18
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
define i32 @read_profile_int(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = call i32 @read_profile_string(i8* %0, i8* %1, i8* %6, i32 32, i32* null, i8* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @atoi(i8* %6)
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ %10, %9 ], [ %2, %4 ]
ret i32 %12
}