#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 /*<<< orphan*/ printf(char *, char *, ...);
int read_conf(char *, char *, char **);
int main(int argc, char *argv[]) {
  char *k = "key1";
  char *v;
  int found;
  char *filename = "slogger.conf";
  found = read_conf(filename, k, &v);
  if (found == 1) {
    printf("Key found key:%s val:%s\n", k, v);
  } else if (found == -1) {
    printf("File not found: %s\n", filename);
  } else {
    printf("Not found key:%s\n", k);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <read_conf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    1185 <main+0x65>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bd <main+0x9d>
cmpl   $0xffffffff,-0x24(%rbp)
jne    11a6 <main+0x86>
mov    -0x30(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b8 <main+0x98>
mov    -0x18(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bd <main+0x9d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedd(%rip),%rdi
lea    0xed1(%rip),%rsi
mov    %rsp,%rdx
call   1030 <read_conf@plt>
cmp    $0xffffffff,%eax
je     115c <main+0x3c>
cmp    $0x1,%eax
jne    116c <main+0x4c>
mov    (%rsp),%rdx
lea    0xec6(%rip),%rdi
lea    0xead(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1181 <main+0x61>
lea    0xec8(%rip),%rdi
lea    0xe9b(%rip),%rsi
jmp    117a <main+0x5a>
lea    0xecc(%rip),%rdi
lea    0xe86(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"key1\00"
@.str.1 = [13 x i8] c"slogger.conf\00"
@.str.2 = [25 x i8] c"Key found key:%s val:%s\0A\00"
@.str.3 = [20 x i8] c"File not found: %s\0A\00"
@.str.4 = [18 x i8] c"Not found key:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = load i8*, i8** %9
%11 = load i8*, i8** %6
%12 = call i32 @read_conf(i8* %10, i8* %11, i8** %7)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8* %17)
br label %29
19: ; preds = %2
%20 = load i32, i32* %8
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i8*, i8** %9
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %23)
br label %28
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %22
br label %29
29: ; preds = %28, %15
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [5 x i8] c"key1\00"
@.str.1 = [13 x i8] c"slogger.conf\00"
@.str.2 = [25 x i8] c"Key found key:%s val:%s\0A\00"
@.str.3 = [20 x i8] c"File not found: %s\0A\00"
@.str.4 = [18 x i8] c"Not found key:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @read_conf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3)
switch i32 %5, label %11 [
i32 1, label %6
i32 -1, label %9
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %13
9: ; preds = %2
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %2
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %9, %11, %6
ret i32 0
}