#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
int /*<<< orphan*/ strcat(char *, char *);
char *strstr(char const *, char const *);
int item_write(const char *cfg_fname, const char *key, const char *value,
               int len) {
  int ret = 0;
  FILE *fp = NULL;
  long file_len;
  char linebuf[2048];
  const char *ptmp = NULL;
  char filebuf[1024 * 8] = {0};
  int itag = 0;
  if (cfg_fname == NULL || key == NULL || value == NULL) {
    ret = -1;
    printf("item_write error, param error\n");
    goto out;
  }
  fp = fopen(cfg_fname, "r+");
  if (fp == NULL) {
    ret = -2;
    printf("item_write error, param error\n");
  }
  if (fp == NULL) {
    fp = fopen(cfg_fname, "w+t");
    if (fp == NULL) {
      ret = -3;
      printf("item_write error, param error\n");
      goto out;
    } else
      ret = 0;
  }
  fseek(fp, 0, SEEK_END);
  file_len = ftell(fp);
  fseek(fp, 0, SEEK_SET);
  if (file_len > 1024 * 8) {
    ret = -3;
    printf("over 1024 * 8, not supported\n");
    goto out;
  }
  while (!feof(fp)) {
    memset(linebuf, 0, 2048);
    ptmp = fgets(linebuf, 2048, fp);
    if (ptmp == NULL)
      break;
    ptmp = strstr(ptmp, key);
    if (ptmp == NULL) {
      strcat(filebuf, linebuf);
      continue;
    } else {
      sprintf(linebuf, "%s = %s\n", key, value);
      strcat(filebuf, linebuf);
      itag = 1;
    }
  }
  if (itag == 0)
    fprintf(fp, "%s = %s\n", key, value);
  else {
    if (fp != NULL) {
      fclose(fp);
      fp = NULL;
    }
    fp = fopen(cfg_fname, "w+t");
    if (fp == NULL) {
      ret = -4;
      printf("fopen error\n");
      goto out;
    }
    fputs(filebuf, fp);
  }
out:
  if (fp != NULL)
    fclose(fp);
  return ret;
}


x86 assembly (clang, -O0):
<item_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2850,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x838(%rbp)
lea    -0x2840(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1060 <memset@plt>
movl   $0x0,-0x2844(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1242 <item_write+0x72>
cmpq   $0x0,-0x10(%rbp)
je     1242 <item_write+0x72>
cmpq   $0x0,-0x18(%rbp)
jne    125a <item_write+0x8a>
movl   $0xffffffff,-0x20(%rbp)
lea    0xdb0(%rip),%rdi
call   1040 <printf@plt>
jmp    14a6 <item_write+0x2d6>
mov    -0x8(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    128c <item_write+0xbc>
movl   $0xfffffffe,-0x20(%rbp)
lea    0xd79(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x28(%rbp)
jne    12da <item_write+0x10a>
mov    -0x8(%rbp),%rdi
lea    0xd80(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12ce <item_write+0xfe>
movl   $0xfffffffd,-0x20(%rbp)
lea    0xd3c(%rip),%rdi
call   1040 <printf@plt>
jmp    14a6 <item_write+0x2d6>
movl   $0x0,-0x20(%rbp)
jmp    12da <item_write+0x10a>
mov    -0x28(%rbp),%rdi
mov    0x2d03(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    -0x28(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2cd2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
cmpq   $0x2000,-0x30(%rbp)
jle    1335 <item_write+0x165>
movl   $0xfffffffd,-0x20(%rbp)
lea    0xcfb(%rip),%rdi
call   1040 <printf@plt>
jmp    14a6 <item_write+0x2d6>
jmp    133a <item_write+0x16a>
mov    -0x28(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1358 <item_write+0x188>
jmp    1414 <item_write+0x244>
lea    -0x830(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1060 <memset@plt>
lea    -0x830(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x800,%esi
call   1070 <fgets@plt>
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x838(%rbp)
jne    139a <item_write+0x1ca>
jmp    1414 <item_write+0x244>
mov    -0x838(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x838(%rbp)
jne    13d7 <item_write+0x207>
lea    -0x2840(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10d0 <strcat@plt>
jmp    133a <item_write+0x16a>
lea    -0x830(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc57(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x2840(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10d0 <strcat@plt>
movl   $0x1,-0x2844(%rbp)
jmp    133a <item_write+0x16a>
cmpl   $0x0,-0x2844(%rbp)
jne    143e <item_write+0x26e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xc10(%rip),%rsi
call   1080 <fprintf@plt>
jmp    14a1 <item_write+0x2d1>
cmpq   $0x0,-0x28(%rbp)
je     145a <item_write+0x28a>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xbbd(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1491 <item_write+0x2c1>
movl   $0xfffffffc,-0x20(%rbp)
lea    0xbc6(%rip),%rdi
call   1040 <printf@plt>
jmp    14a6 <item_write+0x2d6>
lea    -0x2840(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <fputs@plt>
jmp    14a6 <item_write+0x2d6>
cmpq   $0x0,-0x28(%rbp)
je     14ba <item_write+0x2ea>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%eax
add    $0x2850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2818,%rsp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
lea    0x810(%rsp),%rdi
mov    $0x2000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
test   %r15,%r15
je     12a4 <item_write+0xd4>
test   %r12,%r12
je     12a4 <item_write+0xd4>
test   %r14,%r14
je     12a4 <item_write+0xd4>
lea    0xde0(%rip),%rsi
mov    %r15,%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1257 <item_write+0x87>
lea    0xe02(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc0(%rip),%rsi
mov    %r15,%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13c3 <item_write+0x1f3>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %rbx,%rdi
call   1090 <ftell@plt>
mov    %rax,%rbp
mov    0x2d5c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
cmp    $0x2000,%rbp
jle    12b7 <item_write+0xe7>
lea    0xd84(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffffd,%ebp
jmp    12da <item_write+0x10a>
lea    0xd8e(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
jmp    12e2 <item_write+0x112>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     12f6 <item_write+0x126>
lea    0xd3d(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1080 <fprintf@plt>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
add    $0x2818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%al
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%r13
lea    0x810(%rsp),%rbp
nopl   0x0(%rax)
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1060 <memset@plt>
mov    %r13,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1397 <item_write+0x1c7>
mov    %rax,%rdi
mov    %r12,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
jne    135d <item_write+0x18d>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     1310 <item_write+0x140>
jmp    1397 <item_write+0x1c7>
mov    %r13,%rdi
lea    0xca0(%rip),%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   10e0 <sprintf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
movl   $0x0,0xc(%rsp)
test   %eax,%eax
je     1310 <item_write+0x140>
jmp    13d9 <item_write+0x209>
testb  $0x1,0xc(%rsp)
je     13d9 <item_write+0x209>
lea    0xc62(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1080 <fprintf@plt>
xor    %ebp,%ebp
test   %rbx,%rbx
jne    12da <item_write+0x10a>
jmp    12e2 <item_write+0x112>
lea    0xc6f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffffd,%ebp
jmp    12e2 <item_write+0x112>
test   %rbx,%rbx
je     13e6 <item_write+0x216>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xc16(%rip),%rsi
mov    %r15,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1412 <item_write+0x242>
mov    %rax,%rbx
lea    0x810(%rsp),%rdi
mov    %rax,%rsi
call   1050 <fputs@plt>
jmp    12d8 <item_write+0x108>
lea    0xbf7(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffffc,%ebp
jmp    12e2 <item_write+0x112>

LLVM IR (-O0):
@.str = [31 x i8] c"item_write error, param error\0A\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [4 x i8] c"w+t\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [30 x i8] c"over 1024 * 8, not supported\0A\00"
@.str.4 = [9 x i8] c"%s = %s\0A\00"
@.str.5 = [13 x i8] c"fopen error\0A\00"
define i32 @item_write(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i64
%12 = alloca [2048 x i8]
%13 = alloca i8*
%14 = alloca [8192 x i8]
%15 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32* null, i32** %10
store i8* null, i8** %13
%16 = bitcast [8192 x i8]* %14 to i8*
store i32 0, i32* %15
%17 = load i8*, i8** %5
%18 = icmp eq i8* %17, null
br i1 %18, label %25, label %19
19: ; preds = %4
%20 = load i8*, i8** %6
%21 = icmp eq i8* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i8*, i8** %7
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %22, %19, %4
store i32 -1, i32* %9
%26 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %119
27: ; preds = %22
%28 = load i8*, i8** %5
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %10
%30 = load i32*, i32** %10
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %34
32: ; preds = %27
store i32 -2, i32* %9
%33 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
%35 = load i32*, i32** %10
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = load i8*, i8** %5
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32* %39, i32** %10
%40 = load i32*, i32** %10
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %44
42: ; preds = %37
store i32 -3, i32* %9
%43 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %119
44: ; preds = %37
store i32 0, i32* %9
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45, %34
%47 = load i32*, i32** %10
%48 = load i32, i32* @SEEK_END
%49 = call i32 @fseek(i32* %47, i32 0, i32 %48)
%50 = load i32*, i32** %10
%51 = call i64 @ftell(i32* %50)
store i64 %51, i64* %11
%52 = load i32*, i32** %10
%53 = load i32, i32* @SEEK_SET
%54 = call i32 @fseek(i32* %52, i32 0, i32 %53)
%55 = load i64, i64* %11
%56 = icmp sgt i64 %55, 8192
br i1 %56, label %57, label %59
57: ; preds = %46
store i32 -3, i32* %9
%58 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %119
59: ; preds = %46
br label %60
60: ; preds = %92, %80, %59
%61 = load i32*, i32** %10
%62 = call i32 @feof(i32* %61)
%63 = icmp ne i32 %62, 0
%64 = xor i1 %63, true
br i1 %64, label %65, label %93
65: ; preds = %60
%66 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%67 = call i32 @memset(i8* %66, i32 0, i32 2048)
%68 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%69 = load i32*, i32** %10
%70 = call i8* @fgets(i8* %68, i32 2048, i32* %69)
store i8* %70, i8** %13
%71 = load i8*, i8** %13
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %74
73: ; preds = %65
br label %93
74: ; preds = %65
%75 = load i8*, i8** %13
%76 = load i8*, i8** %6
%77 = call i8* @strstr(i8* %75, i8* %76)
store i8* %77, i8** %13
%78 = load i8*, i8** %13
%79 = icmp eq i8* %78, null
br i1 %79, label %80, label %84
80: ; preds = %74
%81 = getelementptr inbounds [8192 x i8], [8192 x i8]* %14, i64 0, i64 0
%82 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%83 = call i32 @strcat(i8* %81, i8* %82)
br label %60
84: ; preds = %74
%85 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%86 = load i8*, i8** %6
%87 = load i8*, i8** %7
%88 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %86, i8* %87)
%89 = getelementptr inbounds [8192 x i8], [8192 x i8]* %14, i64 0, i64 0
%90 = getelementptr inbounds [2048 x i8], [2048 x i8]* %12, i64 0, i64 0
%91 = call i32 @strcat(i8* %89, i8* %90)
store i32 1, i32* %15
br label %92
92: ; preds = %84
br label %60
93: ; preds = %73, %60
%94 = load i32, i32* %15
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %101
96: ; preds = %93
%97 = load i32*, i32** %10
%98 = load i8*, i8** %6
%99 = load i8*, i8** %7
%100 = call i32 @fprintf(i32* %97, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %98, i8* %99)
br label %118
101: ; preds = %93
%102 = load i32*, i32** %10
%103 = icmp ne i32* %102, null
br i1 %103, label %104, label %107
104: ; preds = %101
%105 = load i32*, i32** %10
%106 = call i32 @fclose(i32* %105)
store i32* null, i32** %10
br label %107
107: ; preds = %104, %101
%108 = load i8*, i8** %5
%109 = call i32* @fopen(i8* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32* %109, i32** %10
%110 = load i32*, i32** %10
%111 = icmp eq i32* %110, null
br i1 %111, label %112, label %114
112: ; preds = %107
store i32 -4, i32* %9
%113 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %119
114: ; preds = %107
%115 = getelementptr inbounds [8192 x i8], [8192 x i8]* %14, i64 0, i64 0
%116 = load i32*, i32** %10
%117 = call i32 @fputs(i8* %115, i32* %116)
br label %118
118: ; preds = %114, %96
br label %119
119: ; preds = %118, %112, %57, %42, %25
%120 = load i32*, i32** %10
%121 = icmp ne i32* %120, null
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load i32*, i32** %10
%124 = call i32 @fclose(i32* %123)
br label %125
125: ; preds = %122, %119
%126 = load i32, i32* %9
ret i32 %126
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [4 x i8] c"w+t\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [9 x i8] c"%s = %s\0A\00"
@str = [12 x i8] c"fopen error\00"
@str.6 = [29 x i8] c"over 1024 * 8, not supported\00"
@str.9 = [30 x i8] c"item_write error, param error\00"
define i32 @item_write(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [2048 x i8]
%6 = alloca [8192 x i8]
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%9 = icmp eq i8* %0, null
%10 = icmp eq i8* %1, null
%11 = or i1 %9, %10
%12 = icmp eq i8* %2, null
%13 = or i1 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
br label %77
16: ; preds = %4
%17 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
%21 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
br label %77
25: ; preds = %16, %19
%26 = phi i32* [ %21, %19 ], [ %17, %16 ]
%27 = load i32, i32* @SEEK_END
%28 = tail call i32 @fseek(i32* %26, i32 0, i32 %27)
%29 = tail call i64 @ftell(i32* %26)
%30 = load i32, i32* @SEEK_SET
%31 = tail call i32 @fseek(i32* %26, i32 0, i32 %30)
%32 = icmp sgt i64 %29, 8192
br i1 %32, label %38, label %33
33: ; preds = %25
%34 = call i32 @feof(i32* %26)
%35 = icmp eq i32 %34, 0
br i1 %35, label %56, label %36
36: ; preds = %33
%37 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
br label %73
38: ; preds = %25
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
br label %73
40: ; preds = %56, %47
%41 = call i32 @memset(i8* %7, i32 0, i32 2048)
%42 = call i8* @fgets(i8* %7, i32 2048, i32* %26)
%43 = icmp eq i8* %42, null
br i1 %43, label %58, label %44
44: ; preds = %40
%45 = call i8* @strstr(i8* %42, i8* dereferenceable(1) %1)
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = call i32 @strcat(i8* %8, i8* %7)
%49 = call i32 @feof(i32* %26)
%50 = icmp eq i32 %49, 0
br i1 %50, label %40, label %58
51: ; preds = %44
%52 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
%53 = call i32 @strcat(i8* %8, i8* %7)
%54 = call i32 @feof(i32* %26)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %33, %51
%57 = phi i1 [ false, %51 ], [ true, %33 ]
br label %40
58: ; preds = %47, %40
br i1 %57, label %70, label %59
59: ; preds = %51, %58
%60 = icmp eq i32* %26, null
br i1 %60, label %63, label %61
61: ; preds = %59
%62 = call i32 @fclose(i32* %26)
br label %63
63: ; preds = %61, %59
%64 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%65 = icmp eq i32* %64, null
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %77
68: ; preds = %63
%69 = call i32 @fputs(i8* %8, i32* %64)
br label %73
70: ; preds = %58
%71 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
%72 = icmp eq i32* %26, null
br i1 %72, label %77, label %73
73: ; preds = %36, %68, %38, %70
%74 = phi i32 [ 0, %70 ], [ 0, %68 ], [ -3, %38 ], [ 0, %36 ]
%75 = phi i32* [ %26, %70 ], [ %64, %68 ], [ %26, %38 ], [ %26, %36 ]
%76 = call i32 @fclose(i32* %75)
br label %77
77: ; preds = %66, %23, %14, %73, %70
%78 = phi i32 [ %74, %73 ], [ 0, %70 ], [ -4, %66 ], [ -3, %23 ], [ -1, %14 ]
ret i32 %78
}