#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 abs(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int getkeyadd(char *, char *, int);
scalar_t__ getkeyname(char *, char *, int);
int getkeyvalue(char *, char *, int);
scalar_t__ getsection(char *, char *, int);
int /*<<< orphan*/ isremark(char *);
int /*<<< orphan*/ *readline(char *, int, int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char const *);
int /*<<< orphan*/ strncpy(char *, char *, unsigned int);
int getconfigstr(const char *section, const char *keyname, char *keyvalue,
                 unsigned int len, const char *filename) {
  if (section == NULL || keyname == NULL || keyvalue == NULL ||
      filename == NULL) {
    return -1;
  }
  int step = 0;
  int rs = 0;
  int ra = 0;
  FILE *stream;
  char line[128];
  char sec[128];
  char ken[128];
  char kev[128];
  if ((stream = fopen(filename, "r")) == NULL)
    return 0x2;
  while (!feof(stream)) {
    if (readline(line, 100, stream) == NULL) {
      fclose(stream);
      return 0x3;
    }
    if (!isremark(line)) {
      if (step == 0) {
        if (getsection(line, sec, 128)) {
          if (strcmp(sec, section) == 0)
            step = 1;
        }
      } else if (step == 1) {
        if (getkeyname(line, ken, 128)) {
          if (strcmp(ken, keyname) == 0) {
            rs = getkeyvalue(line, kev, 128);
            if (rs > 0) {
              strncpy(keyvalue, kev, len);
              fclose(stream);
              return 0x0;
            } else if (rs < 0) {
              step = 2;
              rs = abs(rs);
            } else {
              fclose(stream);
              return 0x4;
            }
          }
        }
      } else {
        ra = getkeyadd(line, kev + rs, 128 - rs);
        if (ra > 0) {
          strncpy(keyvalue, kev, len);
          fclose(stream);
          return 0x0;
        } else if (ra < 0) {
          rs += abs(ra);
        } else {
          fclose(stream);
          return 0x4;
        }
      }
    }
  }
  fclose(stream);
  return 0x5;
}


x86 assembly (clang, -O0):
<getconfigstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     120a <getconfigstr+0x4a>
cmpq   $0x0,-0x18(%rbp)
je     120a <getconfigstr+0x4a>
cmpq   $0x0,-0x20(%rbp)
je     120a <getconfigstr+0x4a>
cmpq   $0x0,-0x30(%rbp)
jne    1216 <getconfigstr+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1255 <getconfigstr+0x95>
movl   $0x2,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
jmp    125a <getconfigstr+0x9a>
mov    -0x48(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1278 <getconfigstr+0xb8>
jmp    1497 <getconfigstr+0x2d7>
lea    -0xd0(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    $0x64,%esi
call   1060 <readline@plt>
cmp    $0x0,%rax
jne    12ac <getconfigstr+0xec>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x3,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
lea    -0xd0(%rbp),%rdi
call   10e0 <isremark@plt>
cmp    $0x0,%eax
jne    1492 <getconfigstr+0x2d2>
cmpl   $0x0,-0x34(%rbp)
jne    1318 <getconfigstr+0x158>
lea    -0xd0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
mov    $0x80,%edx
call   10b0 <getsection@plt>
cmp    $0x0,%rax
je     1313 <getconfigstr+0x153>
lea    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    130e <getconfigstr+0x14e>
movl   $0x1,-0x34(%rbp)
jmp    1313 <getconfigstr+0x153>
jmp    148d <getconfigstr+0x2cd>
cmpl   $0x1,-0x34(%rbp)
jne    13f5 <getconfigstr+0x235>
lea    -0xd0(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
mov    $0x80,%edx
call   10c0 <getkeyname@plt>
cmp    $0x0,%rax
je     13f0 <getconfigstr+0x230>
lea    -0x1d0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13eb <getconfigstr+0x22b>
lea    -0xd0(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    $0x80,%edx
call   10a0 <getkeyvalue@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    13ab <getconfigstr+0x1eb>
mov    -0x20(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
cmpl   $0x0,-0x38(%rbp)
jge    13cc <getconfigstr+0x20c>
movl   $0x2,-0x34(%rbp)
mov    -0x38(%rbp),%edi
call   1040 <abs@plt>
mov    %eax,-0x38(%rbp)
jmp    13e1 <getconfigstr+0x221>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x4,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
jmp    13e6 <getconfigstr+0x226>
jmp    13eb <getconfigstr+0x22b>
jmp    13f0 <getconfigstr+0x230>
jmp    1488 <getconfigstr+0x2c8>
lea    -0xd0(%rbp),%rdi
lea    -0x250(%rbp),%rsi
movslq -0x38(%rbp),%rax
add    %rax,%rsi
mov    $0x80,%edx
sub    -0x38(%rbp),%edx
call   1080 <getkeyadd@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jle    144c <getconfigstr+0x28c>
mov    -0x20(%rbp),%rdi
lea    -0x250(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
cmpl   $0x0,-0x3c(%rbp)
jge    1469 <getconfigstr+0x2a9>
mov    -0x3c(%rbp),%edi
call   1040 <abs@plt>
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    147e <getconfigstr+0x2be>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x4,-0x4(%rbp)
jmp    14a7 <getconfigstr+0x2e7>
jmp    1483 <getconfigstr+0x2c3>
jmp    1488 <getconfigstr+0x2c8>
jmp    148d <getconfigstr+0x2cd>
jmp    1492 <getconfigstr+0x2d2>
jmp    125a <getconfigstr+0x9a>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getconfigstr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    $0xffffffff,%r12d
test   %rdi,%rdi
je     137d <getconfigstr+0x1cd>
mov    %rsi,%rbx
test   %rsi,%rsi
je     137d <getconfigstr+0x1cd>
mov    %rdx,%r15
test   %rdx,%rdx
je     137d <getconfigstr+0x1cd>
test   %r8,%r8
je     137d <getconfigstr+0x1cd>
mov    %ecx,%r14d
mov    %rdi,%rbp
lea    0xe02(%rip),%rsi
mov    %r8,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     124f <getconfigstr+0x9f>
mov    %rax,%r13
mov    %rax,%rdi
call   1080 <feof@plt>
mov    $0x5,%r12d
test   %eax,%eax
jne    1375 <getconfigstr+0x1c5>
mov    %rbp,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14d,0x4(%rsp)
xor    %ebp,%ebp
lea    0x1a0(%rsp),%r14
lea    0xa0(%rsp),%rbx
xor    %r15d,%r15d
jmp    1280 <getconfigstr+0xd0>
mov    $0x2,%r12d
jmp    137d <getconfigstr+0x1cd>
xor    %r15d,%r15d
mov    %ebx,%ebp
lea    0xa0(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1375 <getconfigstr+0x1c5>
mov    %r14,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   1050 <readline@plt>
test   %rax,%rax
je     136f <getconfigstr+0x1bf>
mov    %r14,%rdi
call   10d0 <isremark@plt>
test   %eax,%eax
jne    1270 <getconfigstr+0xc0>
cmp    $0x1,%r15d
je     12ef <getconfigstr+0x13f>
test   %r15d,%r15d
jne    1342 <getconfigstr+0x192>
mov    %ebp,%ebx
mov    %r14,%rdi
lea    0x120(%rsp),%rbp
mov    %rbp,%rsi
mov    $0x80,%edx
call   10a0 <getsection@plt>
test   %rax,%rax
je     125a <getconfigstr+0xaa>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
call   1060 <strcmp@plt>
xor    %r15d,%r15d
test   %rax,%rax
sete   %r15b
jmp    125d <getconfigstr+0xad>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x80,%edx
call   10b0 <getkeyname@plt>
mov    $0x1,%r15d
test   %rax,%rax
je     1270 <getconfigstr+0xc0>
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1270 <getconfigstr+0xc0>
mov    %r14,%rdi
lea    0x20(%rsp),%rsi
mov    $0x80,%edx
call   1090 <getkeyvalue@plt>
test   %eax,%eax
jg     1392 <getconfigstr+0x1e2>
jns    13aa <getconfigstr+0x1fa>
mov    %eax,%ebp
neg    %ebp
jmp    1364 <getconfigstr+0x1b4>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x20,%rsi
mov    $0x80,%edx
sub    %eax,%edx
mov    %r14,%rdi
call   1070 <getkeyadd@plt>
test   %eax,%eax
jg     1392 <getconfigstr+0x1e2>
jns    13aa <getconfigstr+0x1fa>
sub    %eax,%ebp
mov    $0x2,%r15d
jmp    1270 <getconfigstr+0xc0>
mov    $0x3,%r12d
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r12d,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%rsi
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%edx
call   1030 <strncpy@plt>
xor    %r12d,%r12d
jmp    1375 <getconfigstr+0x1c5>
mov    $0x4,%r12d
jmp    1375 <getconfigstr+0x1c5>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @getconfigstr(i8* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca [128 x i8]
%17 = alloca [128 x i8]
%18 = alloca [128 x i8]
%19 = alloca [128 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
%20 = load i8*, i8** %7
%21 = icmp eq i8* %20, null
br i1 %21, label %31, label %22
22: ; preds = %5
%23 = load i8*, i8** %8
%24 = icmp eq i8* %23, null
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load i8*, i8** %9
%27 = icmp eq i8* %26, null
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i8*, i8** %11
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %32
31: ; preds = %28, %25, %22, %5
store i32 -1, i32* %6
br label %147
32: ; preds = %28
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
%33 = load i8*, i8** %11
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %34, i32** %15
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 2, i32* %6
br label %147
37: ; preds = %32
br label %38
38: ; preds = %143, %37
%39 = load i32*, i32** %15
%40 = call i32 @feof(i32* %39)
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
br i1 %42, label %43, label %144
43: ; preds = %38
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%45 = load i32*, i32** %15
%46 = call i32* @readline(i8* %44, i32 100, i32* %45)
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32*, i32** %15
%50 = call i32 @fclose(i32* %49)
store i32 3, i32* %6
br label %147
51: ; preds = %43
%52 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%53 = call i32 @isremark(i8* %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %143, label %55
55: ; preds = %51
%56 = load i32, i32* %12
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %71
58: ; preds = %55
%59 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %17, i64 0, i64 0
%61 = call i64 @getsection(i8* %59, i8* %60, i32 128)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %70
63: ; preds = %58
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %17, i64 0, i64 0
%65 = load i8*, i8** %7
%66 = call i64 @strcmp(i8* %64, i8* %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %63
store i32 1, i32* %12
br label %69
69: ; preds = %68, %63
br label %70
70: ; preds = %69, %58
br label %142
71: ; preds = %55
%72 = load i32, i32* %12
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %110
74: ; preds = %71
%75 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%76 = getelementptr inbounds [128 x i8], [128 x i8]* %18, i64 0, i64 0
%77 = call i64 @getkeyname(i8* %75, i8* %76, i32 128)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %109
79: ; preds = %74
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %18, i64 0, i64 0
%81 = load i8*, i8** %8
%82 = call i64 @strcmp(i8* %80, i8* %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %108
84: ; preds = %79
%85 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %19, i64 0, i64 0
%87 = call i32 @getkeyvalue(i8* %85, i8* %86, i32 128)
store i32 %87, i32* %13
%88 = load i32, i32* %13
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %97
90: ; preds = %84
%91 = load i8*, i8** %9
%92 = getelementptr inbounds [128 x i8], [128 x i8]* %19, i64 0, i64 0
%93 = load i32, i32* %10
%94 = call i32 @strncpy(i8* %91, i8* %92, i32 %93)
%95 = load i32*, i32** %15
%96 = call i32 @fclose(i32* %95)
store i32 0, i32* %6
br label %147
97: ; preds = %84
%98 = load i32, i32* %13
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %97
store i32 2, i32* %12
%101 = load i32, i32* %13
%102 = call i32 @abs(i32 %101)
store i32 %102, i32* %13
br label %106
103: ; preds = %97
%104 = load i32*, i32** %15
%105 = call i32 @fclose(i32* %104)
store i32 4, i32* %6
br label %147
106: ; preds = %100
br label %107
107: ; preds = %106
br label %108
108: ; preds = %107, %79
br label %109
109: ; preds = %108, %74
br label %141
110: ; preds = %71
%111 = getelementptr inbounds [128 x i8], [128 x i8]* %16, i64 0, i64 0
%112 = getelementptr inbounds [128 x i8], [128 x i8]* %19, i64 0, i64 0
%113 = load i32, i32* %13
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %112, i64 %114
%116 = load i32, i32* %13
%117 = sub nsw i32 128, %116
%118 = call i32 @getkeyadd(i8* %111, i8* %115, i32 %117)
store i32 %118, i32* %14
%119 = load i32, i32* %14
%120 = icmp sgt i32 %119, 0
br i1 %120, label %121, label %128
121: ; preds = %110
%122 = load i8*, i8** %9
%123 = getelementptr inbounds [128 x i8], [128 x i8]* %19, i64 0, i64 0
%124 = load i32, i32* %10
%125 = call i32 @strncpy(i8* %122, i8* %123, i32 %124)
%126 = load i32*, i32** %15
%127 = call i32 @fclose(i32* %126)
store i32 0, i32* %6
br label %147
128: ; preds = %110
%129 = load i32, i32* %14
%130 = icmp slt i32 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %128
%132 = load i32, i32* %14
%133 = call i32 @abs(i32 %132)
%134 = load i32, i32* %13
%135 = add nsw i32 %134, %133
store i32 %135, i32* %13
br label %139
136: ; preds = %128
%137 = load i32*, i32** %15
%138 = call i32 @fclose(i32* %137)
store i32 4, i32* %6
br label %147
139: ; preds = %131
br label %140
140: ; preds = %139
br label %141
141: ; preds = %140, %109
br label %142
142: ; preds = %141, %70
br label %143
143: ; preds = %142, %51
br label %38
144: ; preds = %38
%145 = load i32*, i32** %15
%146 = call i32 @fclose(i32* %145)
store i32 5, i32* %6
br label %147
147: ; preds = %144, %136, %121, %103, %90, %48, %36, %31
%148 = load i32, i32* %6
ret i32 %148
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @getconfigstr(i8* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = alloca [128 x i8]
%10 = icmp eq i8* %0, null
%11 = icmp eq i8* %1, null
%12 = or i1 %10, %11
%13 = icmp eq i8* %2, null
%14 = or i1 %12, %13
%15 = icmp eq i8* %4, null
%16 = or i1 %14, %15
br i1 %16, label %78, label %17
17: ; preds = %5
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%22 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %76, label %24
24: ; preds = %17
%25 = call i32 @feof(i32* %22)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %73
27: ; preds = %24, %66
%28 = phi i32 [ %68, %66 ], [ 0, %24 ]
%29 = phi i32 [ %67, %66 ], [ 0, %24 ]
%30 = call i32* @readline(i8* %18, i32 100, i32* %22)
%31 = icmp eq i32* %30, null
br i1 %31, label %73, label %32
32: ; preds = %27
%33 = call i32 @isremark(i8* %18)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %66
35: ; preds = %32
switch i32 %29, label %56 [
i32 0, label %36
i32 1, label %43
]
36: ; preds = %35
%37 = call i64 @getsection(i8* %18, i8* %19, i32 128)
%38 = icmp eq i64 %37, 0
br i1 %38, label %66, label %39
39: ; preds = %36
%40 = call i64 @strcmp(i8* %19, i8* %0)
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
br label %66
43: ; preds = %35
%44 = call i64 @getkeyname(i8* %18, i8* %20, i32 128)
%45 = icmp eq i64 %44, 0
br i1 %45, label %66, label %46
46: ; preds = %43
%47 = call i64 @strcmp(i8* %20, i8* %1)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %66
49: ; preds = %46
%50 = call i32 @getkeyvalue(i8* %18, i8* %21, i32 128)
%51 = icmp sgt i32 %50, 0
br i1 %51, label %71, label %52
52: ; preds = %49
%53 = icmp slt i32 %50, 0
br i1 %53, label %54, label %73
54: ; preds = %52
%55 = sub nsw i32 0, %50
br label %66
56: ; preds = %35
%57 = sext i32 %28 to i64
%58 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 %57
%59 = sub nsw i32 128, %28
%60 = call i32 @getkeyadd(i8* %18, i8* %58, i32 %59)
%61 = icmp sgt i32 %60, 0
br i1 %61, label %71, label %62
62: ; preds = %56
%63 = icmp slt i32 %60, 0
br i1 %63, label %64, label %73
64: ; preds = %62
%65 = sub i32 %28, %60
br label %66
66: ; preds = %39, %36, %43, %54, %46, %64, %32
%67 = phi i32 [ %29, %32 ], [ 0, %36 ], [ 2, %54 ], [ 1, %46 ], [ 1, %43 ], [ 2, %64 ], [ %42, %39 ]
%68 = phi i32 [ %28, %32 ], [ %28, %36 ], [ %55, %54 ], [ %28, %46 ], [ %28, %43 ], [ %65, %64 ], [ %28, %39 ]
%69 = call i32 @feof(i32* %22)
%70 = icmp eq i32 %69, 0
br i1 %70, label %27, label %73
71: ; preds = %56, %49
%72 = call i32 @strncpy(i8* %2, i8* %21, i32 %3)
br label %73
73: ; preds = %66, %62, %52, %27, %71, %24
%74 = phi i32 [ 5, %24 ], [ 0, %71 ], [ 3, %27 ], [ 4, %52 ], [ 4, %62 ], [ 5, %66 ]
%75 = call i32 @fclose(i32* %22)
br label %76
76: ; preds = %73, %17
%77 = phi i32 [ 2, %17 ], [ %74, %73 ]
br label %78
78: ; preds = %5, %76
%79 = phi i32 [ %77, %76 ], [ -1, %5 ]
ret i32 %79
}