#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 config_file {
  int dummy;
};

/* Variables and functions */
char *config_get(struct config_file *, char const *, char const *,
                 int /*<<< orphan*/ *);
scalar_t__ string_to_int(char const *, int *);
int config_get_int(struct config_file *f, const char *section, const char *item,
                   int _default) {
  const char *value;
  int i;
  value = config_get(f, section, item, NULL);
  if (!value)
    return _default;
  if (string_to_int(value, &i))
    return _default;
  return i;
}


x86 assembly (clang, -O0):
<config_get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <config_get@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1166 <config_get_int+0x46>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <config_get_int+0x6e>
mov    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <string_to_int@plt>
cmp    $0x0,%rax
je     1188 <config_get_int+0x68>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <config_get_int+0x6e>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_int>:
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
xor    %ecx,%ecx
call   1030 <config_get@plt>
test   %rax,%rax
je     1149 <config_get_int+0x29>
lea    0xc(%rsp),%rsi
mov    %rax,%rdi
call   1040 <string_to_int@plt>
test   %rax,%rax
jne    1149 <config_get_int+0x29>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.config_file = type { i32 }
define i32 @config_get_int(%struct.config_file* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.config_file*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store %struct.config_file* %0, %struct.config_file** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%12 = load %struct.config_file*, %struct.config_file** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i8* @config_get(%struct.config_file* %12, i8* %13, i8* %14, i32* null)
store i8* %15, i8** %10
%16 = load i8*, i8** %10
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %4
%19 = load i32, i32* %9
store i32 %19, i32* %5
br label %28
20: ; preds = %4
%21 = load i8*, i8** %10
%22 = call i64 @string_to_int(i8* %21, i32* %11)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32, i32* %9
store i32 %25, i32* %5
br label %28
26: ; preds = %20
%27 = load i32, i32* %11
store i32 %27, i32* %5
br label %28
28: ; preds = %26, %24, %18
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
%struct.config_file = type { i32 }
define i32 @config_get_int(%struct.config_file* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i8* @config_get(%struct.config_file* %0, i8* %1, i8* %2, i32* null)
%8 = icmp eq i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = call i64 @string_to_int(i8* %7, i32* %5)
%11 = icmp eq i64 %10, 0
%12 = load i32, i32* %5
%13 = select i1 %11, i32 %12, i32 %3
br label %14
14: ; preds = %9, %4
%15 = phi i32 [ %3, %4 ], [ %13, %9 ]
ret i32 %15
}