#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 */
scalar_t__ GetIni(char *, char *, char *, char *, int);
int sscanf(char *, char *, int *);
int GetPrivateProfileInt(char *sFilename, char *cHeader, char *cLabel,
                         int dDefault) {
  int c;
  char sNum[12];
  if (GetIni(sFilename, cHeader, cLabel, sNum, 11) == 0) {
    if (sscanf(sNum, "%d", &c) == 1) {
      return c;
    } else {
      return dDefault;
    }
  } else {
    return dDefault;
  }
}


x86 assembly (clang, -O0):
<GetPrivateProfileInt>:
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
lea    -0x34(%rbp),%rcx
mov    $0xb,%r8d
call   1030 <GetIni@plt>
cmp    $0x0,%rax
jne    118f <GetPrivateProfileInt+0x6f>
lea    -0x34(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1184 <GetPrivateProfileInt+0x64>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <GetPrivateProfileInt+0x75>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <GetPrivateProfileInt+0x75>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPrivateProfileInt>:
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
lea    0x4(%rsp),%rcx
mov    $0xb,%r8d
call   1030 <GetIni@plt>
test   %rax,%rax
jne    1158 <GetPrivateProfileInt+0x38>
lea    0xebd(%rip),%rsi
lea    0x4(%rsp),%rdi
mov    %rsp,%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1158 <GetPrivateProfileInt+0x38>
mov    (%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @GetPrivateProfileInt(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [12 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%16 = call i64 @GetIni(i8* %12, i8* %13, i8* %14, i8* %15, i32 11)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %4
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %10
store i32 %23, i32* %5
br label %28
24: ; preds = %18
%25 = load i32, i32* %9
store i32 %25, i32* %5
br label %28
26: ; preds = %4
%27 = load i32, i32* %9
store i32 %27, i32* %5
br label %28
28: ; preds = %26, %24, %22
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @GetPrivateProfileInt(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca [12 x i8]
%7 = bitcast i32* %5 to i8*
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%9 = call i64 @GetIni(i8* %0, i8* %1, i8* %2, i8* %8, i32 11)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%13 = icmp eq i32 %12, 1
%14 = load i32, i32* %5
%15 = select i1 %13, i32 %14, i32 %3
br label %16
16: ; preds = %11, %4
%17 = phi i32 [ %3, %4 ], [ %15, %11 ]
ret i32 %17
}