#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__ get_conf_bool(char *);
int get_conf_number(char *);
char *get_conf_string(char *);
int /*<<< orphan*/ load_config(char *);
int /*<<< orphan*/ print_all_configs();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("default configs:\n");
  print_all_configs();
  load_config("sample.conf");
  printf("conf_str1 is: %s\n", get_conf_string("conf_str1"));
  printf("conf_num2 is: %d\n", get_conf_number("conf_num2"));
  printf("conf_bool1 is: %s\n", get_conf_bool("conf_bool1") ? "TRUE" : "FALSE");
  printf("configs after load config file:\n");
  print_all_configs();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <print_all_configs@plt>
lea    0xe80(%rip),%rdi
call   1060 <load_config@plt>
lea    0xe92(%rip),%rdi
call   1070 <get_conf_string@plt>
mov    %rax,%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
call   1080 <get_conf_number@plt>
mov    %eax,%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1050 <get_conf_bool@plt>
mov    %rax,%rcx
lea    0xe93(%rip),%rsi
lea    0xe87(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <print_all_configs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_all_configs@plt>
lea    0xe75(%rip),%rdi
call   1070 <load_config@plt>
lea    0xe87(%rip),%rdi
call   1080 <get_conf_string@plt>
lea    0xe69(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
call   1090 <get_conf_number@plt>
lea    0xe68(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
call   1060 <get_conf_bool@plt>
test   %rax,%rax
lea    0xe88(%rip),%rax
lea    0xe7c(%rip),%rsi
cmove  %rax,%rsi
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_all_configs@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"default configs:\0A\00"
@.str.1 = [12 x i8] c"sample.conf\00"
@.str.2 = [18 x i8] c"conf_str1 is: %s\0A\00"
@.str.3 = [10 x i8] c"conf_str1\00"
@.str.4 = [18 x i8] c"conf_num2 is: %d\0A\00"
@.str.5 = [10 x i8] c"conf_num2\00"
@.str.6 = [19 x i8] c"conf_bool1 is: %s\0A\00"
@.str.7 = [11 x i8] c"conf_bool1\00"
@.str.8 = [5 x i8] c"TRUE\00"
@.str.9 = [6 x i8] c"FALSE\00"
@.str.10 = [33 x i8] c"configs after load config file:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @print_all_configs()
%8 = call i32 @load_config(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%9 = call i8* @get_conf_string(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = call i32 @get_conf_number(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = call i64 @get_conf_bool(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%19 = call i32 (...) @print_all_configs()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"sample.conf\00"
@.str.2 = [18 x i8] c"conf_str1 is: %s\0A\00"
@.str.3 = [10 x i8] c"conf_str1\00"
@.str.4 = [18 x i8] c"conf_num2 is: %d\0A\00"
@.str.5 = [10 x i8] c"conf_num2\00"
@.str.6 = [19 x i8] c"conf_bool1 is: %s\0A\00"
@.str.7 = [11 x i8] c"conf_bool1\00"
@.str.8 = [5 x i8] c"TRUE\00"
@.str.9 = [6 x i8] c"FALSE\00"
@str = [17 x i8] c"default configs:\00"
@str.11 = [32 x i8] c"configs after load config file:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @print_all_configs()
%5 = tail call i32 @load_config(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @get_conf_string(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = tail call i32 @get_conf_number(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = tail call i64 @get_conf_bool(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.11, i64 0, i64 0))
%15 = tail call i32 (...) @print_all_configs()
ret i32 0
}