#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ get_settings_file_path(char *);
int /*<<< orphan*/ set_key_val(char *, char *);
void read_settings_file() {
  FILE *file;
  char settings_path[128] = "", setting_key[128] = "", setting_val[128] = "";
  get_settings_file_path(settings_path);
  file = fopen(settings_path, "r");
  if (!file)
    return;
  while (EOF != fscanf(file, "%128s %128s", setting_key, setting_val))
    set_key_val(setting_key, setting_val);
  fclose(file);
}


x86 assembly (clang, -O0):
<read_settings_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
call   1070 <get_settings_file_path@plt>
lea    -0x90(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11d7 <read_settings_file+0x77>
jmp    123f <read_settings_file+0xdf>
jmp    11dc <read_settings_file+0x7c>
mov    0x2e05(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x198(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    -0x190(%rbp),%rcx
lea    0xdfc(%rip),%rsi
call   1050 <fscanf@plt>
mov    %rax,%rcx
mov    -0x198(%rbp),%rax
cmp    %rcx,%rax
je     1236 <read_settings_file+0xd6>
lea    -0x110(%rbp),%rdi
lea    -0x190(%rbp),%rsi
call   1060 <set_key_val@plt>
jmp    11dc <read_settings_file+0x7c>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_settings_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <get_settings_file_path@plt>
lea    0xdde(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     129d <read_settings_file+0x14d>
mov    %rax,%r14
mov    0x2daf(%rip),%r13
mov    0x0(%r13),%rbx
lea    0xdbe(%rip),%rsi
lea    0x80(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1040 <fscanf@plt>
cmp    %rax,%rbx
je     1295 <read_settings_file+0x145>
lea    0x80(%rsp),%r15
mov    %rsp,%rbx
lea    0xd94(%rip),%r12
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <set_key_val@plt>
mov    0x0(%r13),%rbp
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1040 <fscanf@plt>
cmp    %rax,%rbp
jne    1270 <read_settings_file+0x120>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"%128s %128s\00"
define void @read_settings_file() {
%1 = alloca i32*
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = bitcast [128 x i8]* %2 to i8*
%6 = bitcast [128 x i8]* %3 to i8*
%7 = bitcast [128 x i8]* %4 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%9 = call i32 @get_settings_file_path(i8* %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %1
%12 = load i32*, i32** %1
%13 = icmp ne i32* %12, null
br i1 %13, label %15, label %14
14: ; preds = %0
br label %30
15: ; preds = %0
br label %16
16: ; preds = %23, %15
%17 = load i64, i64* @EOF
%18 = load i32*, i32** %1
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%21 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20)
%22 = icmp ne i64 %17, %21
br i1 %22, label %23, label %27
23: ; preds = %16
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%26 = call i32 @set_key_val(i8* %24, i8* %25)
br label %16
27: ; preds = %16
%28 = load i32*, i32** %1
%29 = call i32 @fclose(i32* %28)
br label %30
30: ; preds = %27, %14
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i64 0
@.str.1 = [12 x i8] c"%128s %128s\00"
define void @read_settings_file() {
%1 = alloca [128 x i8]
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%7 = call i32 @get_settings_file_path(i8* %4)
%8 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %21, label %10
10: ; preds = %0
%11 = load i64, i64* @EOF
%12 = call i64 @fscanf(i32* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%13 = icmp eq i64 %11, %12
br i1 %13, label %19, label %14
14: ; preds = %10, %14
%15 = call i32 @set_key_val(i8* %5, i8* %6)
%16 = load i64, i64* @EOF
%17 = call i64 @fscanf(i32* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %14
19: ; preds = %14, %10
%20 = call i32 @fclose(i32* %8)
br label %21
21: ; preds = %0, %19
ret void
}