#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 */
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ elg_cntl_msg(char *, ...);
int /*<<< orphan*/ epk_conf_set_env();
int /*<<< orphan*/ epk_conf_set_epk_defaults();
char *epk_gfile();
int /*<<< orphan*/ epk_parse_config(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int strlen(char *);
void epk_conf() {
  char msg[256] = "";
  epk_conf_set_epk_defaults();
  if (access(epk_gfile(), R_OK) == 0) {
    FILE *cfgFile = fopen(epk_gfile(), "r");
    epk_parse_config(cfgFile, epk_gfile());
    fclose(cfgFile);
    snprintf(msg, 256, "[EPK_CONF] %s parsed ", epk_gfile());
  } else if (epk_gfile()) {
    elg_cntl_msg("[EPK_CONF] Could not access %s", epk_gfile());
  }
  if (access("./"
             "EPIK.CONF",
             R_OK) == 0) {
    FILE *cfgFile = fopen("./"
                          "EPIK.CONF",
                          "r");
    epk_parse_config(cfgFile, "./"
                              "EPIK.CONF");
    fclose(cfgFile);
    snprintf(msg + strlen(msg), 256 - strlen(msg), "[CURDIR] %s parsed",
             "./"
             "EPIK.CONF");
  }
  epk_conf_set_env();
  msg[255] = 0;
  if (strlen(msg))
    elg_cntl_msg(msg);
}


x86 assembly (clang, -O0):
<epk_conf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    $0x0,%al
call   1080 <epk_conf_set_epk_defaults@plt>
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
mov    %rax,%rdi
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
call   10b0 <access@plt>
cmp    $0x0,%rax
jne    1279 <epk_conf+0xc9>
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
mov    %rax,%rdi
lea    0xdf8(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x108(%rbp)
mov    -0x108(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
mov    -0x120(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <epk_parse_config@plt>
mov    -0x108(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
mov    -0x118(%rbp),%rdi
mov    %rax,%rcx
mov    $0x100,%esi
lea    0xd93(%rip),%rdx
call   1060 <snprintf@plt>
jmp    12a7 <epk_conf+0xf7>
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
cmp    $0x0,%rax
je     12a2 <epk_conf+0xf2>
mov    $0x0,%al
call   10a0 <epk_gfile@plt>
mov    %rax,%rsi
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1030 <elg_cntl_msg@plt>
jmp    12a7 <epk_conf+0xf7>
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
lea    0xd80(%rip),%rdi
call   10b0 <access@plt>
cmp    $0x0,%rax
jne    135c <epk_conf+0x1ac>
lea    0xd6a(%rip),%rdi
lea    0xd2c(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x110(%rbp)
mov    -0x110(%rbp),%rdi
lea    0xd49(%rip),%rsi
call   10d0 <epk_parse_config@plt>
mov    -0x110(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x130(%rbp)
lea    -0x100(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x130(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x128(%rbp)
lea    -0x100(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x128(%rbp),%rdi
mov    $0x100,%esi
sub    %eax,%esi
lea    0xcf3(%rip),%rdx
lea    0xce0(%rip),%rcx
call   1060 <snprintf@plt>
mov    $0x0,%al
call   1090 <epk_conf_set_env@plt>
movb   $0x0,-0x1(%rbp)
lea    -0x100(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
je     138a <epk_conf+0x1da>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1030 <elg_cntl_msg@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epk_conf>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
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)
xor    %eax,%eax
call   1070 <epk_conf_set_epk_defaults@plt>
xor    %eax,%eax
call   1090 <epk_gfile@plt>
mov    0x2db5(%rip),%r14
mov    (%r14),%esi
mov    %rax,%rdi
call   10a0 <access@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1090 <epk_gfile@plt>
test   %rbx,%rbx
je     1264 <epk_conf+0xc4>
test   %rax,%rax
je     12ae <epk_conf+0x10e>
xor    %eax,%eax
call   1090 <epk_gfile@plt>
lea    0xdc0(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <elg_cntl_msg@plt>
jmp    12ae <epk_conf+0x10e>
lea    0xd95(%rip),%rsi
mov    %rax,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1090 <epk_gfile@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   10c0 <epk_parse_config@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1090 <epk_gfile@plt>
lea    0xd64(%rip),%rdx
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1060 <snprintf@plt>
mov    (%r14),%esi
lea    0xd7f(%rip),%rdi
call   10a0 <access@plt>
test   %rax,%rax
jne    1320 <epk_conf+0x180>
lea    0xd6e(%rip),%r14
lea    0xd30(%rip),%rsi
mov    %r14,%rdi
call   10b0 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   10c0 <epk_parse_config@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    $0x100,%esi
sub    %eax,%esi
lea    0xd2e(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1060 <snprintf@plt>
xor    %eax,%eax
call   1080 <epk_conf_set_env@plt>
movb   $0x0,0xff(%rsp)
mov    %rsp,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1345 <epk_conf+0x1a5>
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <elg_cntl_msg@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@R_OK = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"[EPK_CONF] %s parsed \00"
@.str.2 = [31 x i8] c"[EPK_CONF] Could not access %s\00"
@.str.3 = [12 x i8] c"./EPIK.CONF\00"
@.str.4 = [19 x i8] c"[CURDIR] %s parsed\00"
define void @epk_conf() {
%1 = alloca [256 x i8]
%2 = alloca i32*
%3 = alloca i32*
%4 = bitcast [256 x i8]* %1 to i8*
%5 = call i32 (...) @epk_conf_set_epk_defaults()
%6 = call i8* (...) @epk_gfile()
%7 = load i32, i32* @R_OK
%8 = call i64 @access(i8* %6, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %0
%11 = call i8* (...) @epk_gfile()
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %2
%13 = load i32*, i32** %2
%14 = call i8* (...) @epk_gfile()
%15 = call i32 @epk_parse_config(i32* %13, i8* %14)
%16 = load i32*, i32** %2
%17 = call i32 @fclose(i32* %16)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%19 = call i8* (...) @epk_gfile()
%20 = call i32 @snprintf(i8* %18, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %28
21: ; preds = %0
%22 = call i8* (...) @epk_gfile()
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = call i8* (...) @epk_gfile()
%26 = call i32 (i8*, ...) @elg_cntl_msg(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %24, %21
br label %28
28: ; preds = %27, %10
%29 = load i32, i32* @R_OK
%30 = call i64 @access(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %28
%33 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %33, i32** %3
%34 = load i32*, i32** %3
%35 = call i32 @epk_parse_config(i32* %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%36 = load i32*, i32** %3
%37 = call i32 @fclose(i32* %36)
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%44 = call i32 @strlen(i8* %43)
%45 = sub nsw i32 256, %44
%46 = call i32 @snprintf(i8* %42, i32 %45, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %47
47: ; preds = %32, %28
%48 = call i32 (...) @epk_conf_set_env()
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 255
store i8 0, i8* %49
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%55 = call i32 (i8*, ...) @elg_cntl_msg(i8* %54)
br label %56
56: ; preds = %53, %47
ret void
}

LLVM IR (-O2):
@R_OK = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"[EPK_CONF] %s parsed \00"
@.str.2 = [31 x i8] c"[EPK_CONF] Could not access %s\00"
@.str.3 = [12 x i8] c"./EPIK.CONF\00"
@.str.4 = [19 x i8] c"[CURDIR] %s parsed\00"
define void @epk_conf() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @epk_conf_set_epk_defaults()
%4 = tail call i8* (...) @epk_gfile()
%5 = load i32, i32* @R_OK
%6 = tail call i64 @access(i8* %4, i32 %5)
%7 = icmp eq i64 %6, 0
%8 = tail call i8* (...) @epk_gfile()
br i1 %7, label %9, label %16
9: ; preds = %0
%10 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call i8* (...) @epk_gfile()
%12 = tail call i32 @epk_parse_config(i32* %10, i8* %11)
%13 = tail call i32 @fclose(i32* %10)
%14 = tail call i8* (...) @epk_gfile()
%15 = call i32 @snprintf(i8* %2, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %21
16: ; preds = %0
%17 = icmp eq i8* %8, null
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = tail call i8* (...) @epk_gfile()
%20 = tail call i32 (i8*, ...) @elg_cntl_msg(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %18, %9
%22 = load i32, i32* @R_OK
%23 = call i64 @access(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @epk_parse_config(i32* %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @fclose(i32* %26)
%29 = call i32 @strlen(i8* %2)
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %30
%32 = call i32 @strlen(i8* %2)
%33 = sub nsw i32 256, %32
%34 = call i32 @snprintf(i8* %31, i32 %33, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %25, %21
%36 = call i32 (...) @epk_conf_set_env()
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 255
store i8 0, i8* %37
%38 = call i32 @strlen(i8* %2)
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %35
%41 = call i32 (i8*, ...) @elg_cntl_msg(i8* %2)
br label %42
42: ; preds = %40, %35
ret void
}