#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 GetIni(char *, char *, char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int GetPrivateProfileString(char *sFilename, char *cHeader, char *cLabel,
                            char *cValue, char *cDefault, int dValueLength) {
  int i;
  i = GetIni(sFilename, cHeader, cLabel, cValue, dValueLength);
  if (i == 0) {
    return 0;
  } else {
    strcpy(cValue, cDefault);
    return -1;
  }
}


x86 assembly (clang, -O0):
<GetPrivateProfileString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x34(%rbp),%r8d
call   1030 <GetIni@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jne    1172 <GetPrivateProfileString+0x52>
movl   $0x0,-0x4(%rbp)
jmp    1186 <GetPrivateProfileString+0x66>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPrivateProfileString>:
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%rbx
mov    %r9d,%r8d
call   1030 <GetIni@plt>
test   %eax,%eax
je     1148 <GetPrivateProfileString+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    $0xffffffff,%eax
jmp    114a <GetPrivateProfileString+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @GetPrivateProfileString(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32 %5) {
%7 = tail call i32 @GetIni(i8* %0, i8* %1, i8* %2, i8* %3, i32 %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @strcpy(i8* %3, i8* %4)
br label %11
11: ; preds = %6, %9
%12 = phi i32 [ -1, %9 ], [ 0, %6 ]
ret i32 %12
}