#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 */
struct stat {
  int st_mode;
};
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ R_OK;
int S_IEXEC;
scalar_t__ S_ISREG(int);
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ lstat(char *, struct stat *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int set_configname(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ systemlog(int, char *);
int pget_configname() {
  int success = 0;
  int c = 0;
  char buff[250];
  char tmp[250];
  FILE *fp;
  DIR *dir;
  struct dirent *file;
  struct stat buf;
  systemlog(2, "pget_configname");
  fp = popen("echo $XDG_CONFIG_HOME/jeti.rc", "r");
  while ((buff[c] = fgetc(fp)) != EOF) {
    c++;
  }
  buff[c - 1] = '\0';
  if (!access(buff, R_OK))
    success = set_configname(buff);
  c = 0;
  fp = popen("echo $XDG_CONFIG_HOME/jeti.d", "r");
  while ((buff[c] = fgetc(fp)) != EOF) {
    c++;
  }
  buff[c - 1] = '\0';
  if (!access(buff, R_OK)) {
    dir = opendir(buff);
    while ((file = readdir(dir))) {
      strcpy(tmp, buff);
      strcat(tmp, "/");
      strcat(tmp, file->d_name);
      lstat(tmp, &buf);
      if (S_ISREG(buf.st_mode) && (S_IEXEC & buf.st_mode)) {
        success += set_configname(tmp);
      }
    }
    closedir(dir);
  }
  if (success == 0) {
    c = 0;
    fp = popen("echo $HOME/.jeti.rc", "r");
    while ((buff[c] = fgetc(fp)) != EOF)
      c++;
    buff[c - 1] = '\0';
    if (!access(buff, R_OK))
      success = set_configname(buff);
  }
  pclose(fp);
  if (success > 0)
    systemlog(92, "\t[DONE]");
  else
    systemlog(92, "\t[FAILD]");
  return success;
}


x86 assembly (clang, -O0):
<pget_configname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x2,%edi
lea    0xe0b(%rip),%rsi
call   1030 <systemlog@plt>
lea    0xe0f(%rip),%rdi
lea    0xe26(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rdi
call   1080 <fgetc@plt>
movslq -0x8(%rbp),%rcx
mov    %al,-0x110(%rbp,%rcx,1)
movsbl %al,%eax
mov    0x2db3(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     124e <pget_configname+0x7e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1214 <pget_configname+0x44>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
call   10d0 <access@plt>
cmp    $0x0,%eax
jne    128b <pget_configname+0xbb>
lea    -0x110(%rbp),%rdi
call   1050 <set_configname@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xd97(%rip),%rdi
lea    0xd8e(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rdi
call   1080 <fgetc@plt>
movslq -0x8(%rbp),%rcx
mov    %al,-0x110(%rbp,%rcx,1)
movsbl %al,%eax
mov    0x2d1b(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12e6 <pget_configname+0x116>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12ac <pget_configname+0xdc>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
mov    0x2ccc(%rip),%rax
mov    (%rax),%esi
call   10d0 <access@plt>
cmp    $0x0,%eax
jne    13e3 <pget_configname+0x213>
lea    -0x110(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x220(%rbp)
mov    -0x220(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x228(%rbp)
cmp    $0x0,%rax
je     13d7 <pget_configname+0x207>
lea    -0x210(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x210(%rbp),%rdi
lea    0xce8(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x210(%rbp),%rdi
mov    -0x228(%rbp),%rax
mov    (%rax),%rsi
call   10f0 <strcat@plt>
lea    -0x210(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   10a0 <lstat@plt>
mov    -0x230(%rbp),%edi
call   10b0 <S_ISREG@plt>
cmp    $0x0,%rax
je     13d2 <pget_configname+0x202>
mov    0x2c29(%rip),%rax
mov    (%rax),%eax
and    -0x230(%rbp),%eax
cmp    $0x0,%eax
je     13d2 <pget_configname+0x202>
lea    -0x210(%rbp),%rdi
call   1050 <set_configname@plt>
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1327 <pget_configname+0x157>
mov    -0x220(%rbp),%rdi
call   1090 <closedir@plt>
cmpl   $0x0,-0x4(%rbp)
jne    148a <pget_configname+0x2ba>
movl   $0x0,-0x8(%rbp)
lea    0xc54(%rip),%rdi
lea    0xc2c(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rdi
call   1080 <fgetc@plt>
movslq -0x8(%rbp),%rcx
mov    %al,-0x110(%rbp,%rcx,1)
movsbl %al,%eax
mov    0x2bb9(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1448 <pget_configname+0x278>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    140e <pget_configname+0x23e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
mov    0x2b6a(%rip),%rax
mov    (%rax),%esi
call   10d0 <access@plt>
cmp    $0x0,%eax
jne    1485 <pget_configname+0x2b5>
lea    -0x110(%rbp),%rdi
call   1050 <set_configname@plt>
mov    %eax,-0x4(%rbp)
jmp    148a <pget_configname+0x2ba>
mov    -0x218(%rbp),%rdi
call   1070 <pclose@plt>
cmpl   $0x0,-0x4(%rbp)
jle    14b6 <pget_configname+0x2e6>
mov    $0x5c,%edi
lea    0xbb7(%rip),%rsi
call   1030 <systemlog@plt>
jmp    14c7 <pget_configname+0x2f7>
mov    $0x5c,%edi
lea    0xba9(%rip),%rsi
call   1030 <systemlog@plt>
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pget_configname>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
movabs $0xfffffffe00000000,%r15
ff ff ff
movabs $0x100000000,%r12
lea    0xe04(%rip),%rsi
mov    $0x2,%edi
call   1030 <systemlog@plt>
lea    0xe03(%rip),%rdi
lea    0xe1a(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rbp
mov    0x2dc0(%rip),%r13
mov    %r15,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    %al,0x0(%rbp)
add    %r12,%rbx
add    $0x1,%rbp
cmp    0x0(%r13),%al
jne    1230 <pget_configname+0x60>
sar    $0x20,%rbx
movb   $0x0,0x20(%rsp,%rbx,1)
mov    0x2d78(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   10d0 <access@plt>
xor    %ecx,%ecx
test   %eax,%eax
jne    1279 <pget_configname+0xa9>
lea    0x20(%rsp),%rdi
call   1050 <set_configname@plt>
mov    %eax,%ecx
mov    %ecx,0xc(%rsp)
lea    0xdac(%rip),%rdi
lea    0xda3(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,%r14
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    %al,0x0(%rbp)
add    %r12,%rbx
add    $0x1,%rbp
cmp    0x0(%r13),%al
jne    12a0 <pget_configname+0xd0>
sar    $0x20,%rbx
movb   $0x0,0x20(%rsp,%rbx,1)
mov    0x2d08(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   10d0 <access@plt>
test   %eax,%eax
jne    139b <pget_configname+0x1cb>
lea    0x20(%rsp),%rdi
call   1060 <opendir@plt>
mov    %rax,0x18(%rsp)
mov    %rax,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     1380 <pget_configname+0x1b0>
mov    %rax,%r13
lea    0x120(%rsp),%r12
jmp    1322 <pget_configname+0x152>
nopl   0x0(%rax)
mov    0x18(%rsp),%rdi
call   10c0 <readdir@plt>
mov    %rax,%r13
test   %rax,%rax
je     1380 <pget_configname+0x1b0>
mov    %r12,%rdi
lea    0x20(%rsp),%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
lea    0xd14(%rip),%rsi
call   10f0 <strcat@plt>
mov    0x0(%r13),%rsi
mov    %r12,%rdi
call   10f0 <strcat@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   10a0 <lstat@plt>
mov    0x10(%rsp),%ebx
mov    %ebx,%edi
call   10b0 <S_ISREG@plt>
test   %rax,%rax
je     1310 <pget_configname+0x140>
mov    0x2c6a(%rip),%rax
test   %ebx,(%rax)
je     1310 <pget_configname+0x140>
mov    %r12,%rdi
call   1050 <set_configname@plt>
add    %eax,0xc(%rsp)
jmp    1310 <pget_configname+0x140>
mov    0x18(%rsp),%rdi
call   1090 <closedir@plt>
movabs $0x100000000,%r12
mov    0x2c4d(%rip),%r13
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
je     13b8 <pget_configname+0x1e8>
mov    %r14,%rdi
call   1070 <pclose@plt>
test   %ebx,%ebx
jle    1413 <pget_configname+0x243>
lea    0xcad(%rip),%rsi
jmp    141a <pget_configname+0x24a>
lea    0xc90(%rip),%rdi
lea    0xc68(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,%r14
xchg   %ax,%ax
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    %al,0x0(%rbp)
add    %r12,%r15
add    $0x1,%rbp
cmp    0x0(%r13),%al
jne    13d0 <pget_configname+0x200>
sar    $0x20,%r15
movb   $0x0,0x20(%rsp,%r15,1)
mov    0x2bd7(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rdi
call   10d0 <access@plt>
test   %eax,%eax
je     1438 <pget_configname+0x268>
mov    %r14,%rdi
call   1070 <pclose@plt>
xor    %ebx,%ebx
lea    0xc51(%rip),%rsi
mov    $0x5c,%edi
call   1030 <systemlog@plt>
mov    %ebx,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%rdi
call   1050 <set_configname@plt>
mov    %eax,%ebx
jmp    13a3 <pget_configname+0x1d3>

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.stat = type { i32 }
@.str = [16 x i8] c"pget_configname\00"
@.str.1 = [30 x i8] c"echo $XDG_CONFIG_HOME/jeti.rc\00"
@.str.2 = [2 x i8] c"r\00"
@EOF = global i8 0
@R_OK = global i32 0
@.str.3 = [29 x i8] c"echo $XDG_CONFIG_HOME/jeti.d\00"
@.str.4 = [2 x i8] c"/\00"
@S_IEXEC = global i32 0
@.str.5 = [20 x i8] c"echo $HOME/.jeti.rc\00"
@.str.6 = [8 x i8] c"\09[DONE]\00"
@.str.7 = [9 x i8] c"\09[FAILD]\00"
define i32 @pget_configname() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [250 x i8]
%4 = alloca [250 x i8]
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.dirent*
%8 = alloca %struct.stat
store i32 0, i32* %1
store i32 0, i32* %2
%9 = call i32 @systemlog(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = call i32* @popen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %10, i32** %5
br label %11
11: ; preds = %21, %0
%12 = load i32*, i32** %5
%13 = call signext i8 @fgetc(i32* %12)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %15
store i8 %13, i8* %16
%17 = sext i8 %13 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %24
21: ; preds = %11
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %11
24: ; preds = %11
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %27
store i8 0, i8* %28
%29 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%30 = load i32, i32* @R_OK
%31 = call i32 @access(i8* %29, i32 %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %24
%34 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%35 = call i32 @set_configname(i8* %34)
store i32 %35, i32* %1
br label %36
36: ; preds = %33, %24
store i32 0, i32* %2
%37 = call i32* @popen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %37, i32** %5
br label %38
38: ; preds = %48, %36
%39 = load i32*, i32** %5
%40 = call signext i8 @fgetc(i32* %39)
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %42
store i8 %40, i8* %43
%44 = sext i8 %40 to i32
%45 = load i8, i8* @EOF
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %44, %46
br i1 %47, label %48, label %51
48: ; preds = %38
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %38
51: ; preds = %38
%52 = load i32, i32* %2
%53 = sub nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %54
store i8 0, i8* %55
%56 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%57 = load i32, i32* @R_OK
%58 = call i32 @access(i8* %56, i32 %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %99, label %60
60: ; preds = %51
%61 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%62 = call i32* @opendir(i8* %61)
store i32* %62, i32** %6
br label %63
63: ; preds = %95, %60
%64 = load i32*, i32** %6
%65 = call %struct.dirent* @readdir(i32* %64)
store %struct.dirent* %65, %struct.dirent** %7
%66 = icmp ne %struct.dirent* %65, null
br i1 %66, label %67, label %96
67: ; preds = %63
%68 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%69 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%70 = call i32 @strcpy(i8* %68, i8* %69)
%71 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%73 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%74 = load %struct.dirent*, %struct.dirent** %7
%75 = getelementptr inbounds %struct.dirent, %struct.dirent* %74, i32 0, i32 0
%76 = load i8*, i8** %75
%77 = call i32 @strcat(i8* %73, i8* %76)
%78 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%79 = call i32 @lstat(i8* %78, %struct.stat* %8)
%80 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%81 = load i32, i32* %80
%82 = call i64 @S_ISREG(i32 %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %95
84: ; preds = %67
%85 = load i32, i32* @S_IEXEC
%86 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%87 = load i32, i32* %86
%88 = and i32 %85, %87
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %84
%91 = getelementptr inbounds [250 x i8], [250 x i8]* %4, i64 0, i64 0
%92 = call i32 @set_configname(i8* %91)
%93 = load i32, i32* %1
%94 = add nsw i32 %93, %92
store i32 %94, i32* %1
br label %95
95: ; preds = %90, %84, %67
br label %63
96: ; preds = %63
%97 = load i32*, i32** %6
%98 = call i32 @closedir(i32* %97)
br label %99
99: ; preds = %96, %51
%100 = load i32, i32* %1
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %130
102: ; preds = %99
store i32 0, i32* %2
%103 = call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %103, i32** %5
br label %104
104: ; preds = %114, %102
%105 = load i32*, i32** %5
%106 = call signext i8 @fgetc(i32* %105)
%107 = load i32, i32* %2
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %108
store i8 %106, i8* %109
%110 = sext i8 %106 to i32
%111 = load i8, i8* @EOF
%112 = sext i8 %111 to i32
%113 = icmp ne i32 %110, %112
br i1 %113, label %114, label %117
114: ; preds = %104
%115 = load i32, i32* %2
%116 = add nsw i32 %115, 1
store i32 %116, i32* %2
br label %104
117: ; preds = %104
%118 = load i32, i32* %2
%119 = sub nsw i32 %118, 1
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 %120
store i8 0, i8* %121
%122 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%123 = load i32, i32* @R_OK
%124 = call i32 @access(i8* %122, i32 %123)
%125 = icmp ne i32 %124, 0
br i1 %125, label %129, label %126
126: ; preds = %117
%127 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%128 = call i32 @set_configname(i8* %127)
store i32 %128, i32* %1
br label %129
129: ; preds = %126, %117
br label %130
130: ; preds = %129, %99
%131 = load i32*, i32** %5
%132 = call i32 @pclose(i32* %131)
%133 = load i32, i32* %1
%134 = icmp sgt i32 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = call i32 @systemlog(i32 92, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %139
137: ; preds = %130
%138 = call i32 @systemlog(i32 92, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %139
139: ; preds = %137, %135
%140 = load i32, i32* %1
ret i32 %140
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@.str = [16 x i8] c"pget_configname\00"
@.str.1 = [30 x i8] c"echo $XDG_CONFIG_HOME/jeti.rc\00"
@.str.2 = [2 x i8] c"r\00"
@EOF = global i8 0
@R_OK = global i32 0
@.str.3 = [29 x i8] c"echo $XDG_CONFIG_HOME/jeti.d\00"
@.str.4 = [2 x i8] c"/\00"
@S_IEXEC = global i32 0
@.str.5 = [20 x i8] c"echo $HOME/.jeti.rc\00"
@.str.6 = [8 x i8] c"\09[DONE]\00"
@.str.7 = [9 x i8] c"\09[FAILD]\00"
define i32 @pget_configname() {
%1 = alloca [250 x i8]
%2 = alloca [250 x i8]
%3 = alloca %struct.stat
%4 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [250 x i8], [250 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.stat* %3 to i8*
%7 = tail call i32 @systemlog(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32* @popen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %9, %0
%10 = phi i64 [ %15, %9 ], [ 0, %0 ]
%11 = tail call signext i8 @fgetc(i32* %8)
%12 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %10
store i8 %11, i8* %12
%13 = load i8, i8* @EOF
%14 = icmp eq i8 %11, %13
%15 = add nuw i64 %10, 1
br i1 %14, label %16, label %9
16: ; preds = %9
%17 = shl i64 %10, 32
%18 = add i64 %17, -4294967296
%19 = ashr exact i64 %18, 32
%20 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %19
store i8 0, i8* %20
%21 = load i32, i32* @R_OK
%22 = call i32 @access(i8* %4, i32 %21)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %16
%25 = call i32 @set_configname(i8* %4)
br label %26
26: ; preds = %24, %16
%27 = phi i32 [ 0, %16 ], [ %25, %24 ]
%28 = call i32* @popen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %29, %26
%30 = phi i64 [ %35, %29 ], [ 0, %26 ]
%31 = call signext i8 @fgetc(i32* %28)
%32 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %30
store i8 %31, i8* %32
%33 = load i8, i8* @EOF
%34 = icmp eq i8 %31, %33
%35 = add nuw i64 %30, 1
br i1 %34, label %36, label %29
36: ; preds = %29
%37 = shl i64 %30, 32
%38 = add i64 %37, -4294967296
%39 = ashr exact i64 %38, 32
%40 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %39
store i8 0, i8* %40
%41 = load i32, i32* @R_OK
%42 = call i32 @access(i8* %4, i32 %41)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %76
44: ; preds = %36
%45 = call i32* @opendir(i8* %4)
%46 = call %struct.dirent* @readdir(i32* %45)
%47 = icmp eq %struct.dirent* %46, null
br i1 %47, label %73, label %48
48: ; preds = %44
%49 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
br label %50
50: ; preds = %48, %69
%51 = phi %struct.dirent* [ %46, %48 ], [ %71, %69 ]
%52 = phi i32 [ %27, %48 ], [ %70, %69 ]
%53 = call i32 @strcpy(i8* %5, i8* %4)
%54 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %51, i64 0, i32 0
%56 = load i8*, i8** %55
%57 = call i32 @strcat(i8* %5, i8* %56)
%58 = call i32 @lstat(i8* %5, %struct.stat* %3)
%59 = load i32, i32* %49
%60 = call i64 @S_ISREG(i32 %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %69, label %62
62: ; preds = %50
%63 = load i32, i32* @S_IEXEC
%64 = and i32 %63, %59
%65 = icmp eq i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %62
%67 = call i32 @set_configname(i8* %5)
%68 = add nsw i32 %67, %52
br label %69
69: ; preds = %66, %62, %50
%70 = phi i32 [ %68, %66 ], [ %52, %62 ], [ %52, %50 ]
%71 = call %struct.dirent* @readdir(i32* %45)
%72 = icmp eq %struct.dirent* %71, null
br i1 %72, label %73, label %50
73: ; preds = %69, %44
%74 = phi i32 [ %27, %44 ], [ %70, %69 ]
%75 = call i32 @closedir(i32* %45)
br label %76
76: ; preds = %73, %36
%77 = phi i32 [ %27, %36 ], [ %74, %73 ]
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %100
79: ; preds = %76
%80 = call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %81
81: ; preds = %81, %79
%82 = phi i64 [ %87, %81 ], [ 0, %79 ]
%83 = call signext i8 @fgetc(i32* %80)
%84 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %82
store i8 %83, i8* %84
%85 = load i8, i8* @EOF
%86 = icmp eq i8 %83, %85
%87 = add nuw i64 %82, 1
br i1 %86, label %88, label %81
88: ; preds = %81
%89 = shl i64 %82, 32
%90 = add i64 %89, -4294967296
%91 = ashr exact i64 %90, 32
%92 = getelementptr inbounds [250 x i8], [250 x i8]* %1, i64 0, i64 %91
store i8 0, i8* %92
%93 = load i32, i32* @R_OK
%94 = call i32 @access(i8* %4, i32 %93)
%95 = icmp eq i32 %94, 0
br i1 %95, label %98, label %96
96: ; preds = %88
%97 = call i32 @pclose(i32* %80)
br label %105
98: ; preds = %88
%99 = call i32 @set_configname(i8* %4)
br label %100
100: ; preds = %98, %76
%101 = phi i32* [ %80, %98 ], [ %28, %76 ]
%102 = phi i32 [ %99, %98 ], [ %77, %76 ]
%103 = call i32 @pclose(i32* %101)
%104 = icmp sgt i32 %102, 0
br i1 %104, label %107, label %105
105: ; preds = %96, %100
%106 = phi i32 [ 0, %96 ], [ %102, %100 ]
br label %107
107: ; preds = %100, %105
%108 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %105 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %100 ]
%109 = phi i32 [ %106, %105 ], [ %102, %100 ]
%110 = call i32 @systemlog(i32 92, i8* %108)
ret i32 %109
}