#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_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int iniSetKey(char *ini, char *key, char *value) {
  FILE *fp;
  FILE *output;
  char read[512];
  char search[255];
  char *found;
  int foundKey = 0;
  if (strlen(key) > 250)
    return 2;
  if ((fp = fopen(ini, "r+t")) == NULL) {
    if ((fp = fopen(ini, "w+t")) == NULL)
      return 1;
  }
  if ((output = fopen("/tmp/sepulcre_tmp_config.ini", "w+t")) == NULL)
    return 5;
  strcpy(search, key);
  strcat(search, "=");
  while (fgets(read, 512, fp) != NULL) {
    if ((found = strstr(read, search)) != NULL && found == read) {
      char *temp = malloc(strlen(read) + strlen(value) + 1);
      strcpy(temp, read);
      found = strchr(temp, '=') + 1;
      strcpy(found, value);
      strcat(temp, "\n");
      fputs(temp, output);
      free(temp);
      foundKey = 1;
    } else {
      fputs(read, output);
    }
  }
  if (!foundKey) {
    char *str = malloc(strlen(key) + strlen(value) + 3);
    strcpy(str, key);
    strcat(str, "=");
    strcat(str, value);
    strcat(str, "\n");
    fputs(str, output);
  }
  fclose(fp);
  if ((fp = fopen(ini, "wt")) == NULL)
    return 3;
  if (fseek(output, 0, SEEK_SET) == -1)
    return 4;
  while (fgets(read, 512, output) != NULL)
    fputs(read, fp);
  fclose(fp);
  fclose(output);
  remove("/tmp/sepulcre_tmp_config.ini");
  return 0;
}


x86 assembly (clang, -O0):
<iniSetKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x33c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0xfa,%eax
jle    1211 <iniSetKey+0x41>
movl   $0x2,-0x4(%rbp)
jmp    1518 <iniSetKey+0x348>
mov    -0x10(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    125e <iniSetKey+0x8e>
mov    -0x10(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1259 <iniSetKey+0x89>
movl   $0x1,-0x4(%rbp)
jmp    1518 <iniSetKey+0x348>
jmp    125e <iniSetKey+0x8e>
lea    0xda3(%rip),%rdi
lea    0xd98(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    128b <iniSetKey+0xbb>
movl   $0x5,-0x4(%rbp)
jmp    1518 <iniSetKey+0x348>
lea    -0x330(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x330(%rbp),%rdi
lea    0xd7c(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x230(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x200,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     13cc <iniSetKey+0x1fc>
lea    -0x230(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x338(%rbp)
cmp    $0x0,%rax
je     13b7 <iniSetKey+0x1e7>
mov    -0x338(%rbp),%rax
lea    -0x230(%rbp),%rcx
cmp    %rcx,%rax
jne    13b7 <iniSetKey+0x1e7>
lea    -0x230(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x354(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x354(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x348(%rbp)
mov    -0x348(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x348(%rbp),%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x338(%rbp)
mov    -0x338(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x348(%rbp),%rdi
lea    0xca0(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x348(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <fputs@plt>
mov    -0x348(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x33c(%rbp)
jmp    13c7 <iniSetKey+0x1f7>
lea    -0x230(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <fputs@plt>
jmp    12ae <iniSetKey+0xde>
cmpl   $0x0,-0x33c(%rbp)
jne    145e <iniSetKey+0x28e>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x358(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x358(%rbp),%edi
add    %eax,%edi
add    $0x3,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x350(%rbp)
mov    -0x350(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x350(%rbp),%rdi
lea    0xbff(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x350(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x350(%rbp),%rdi
lea    0xbde(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x350(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <fputs@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0xbb7(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1491 <iniSetKey+0x2c1>
movl   $0x3,-0x4(%rbp)
jmp    1518 <iniSetKey+0x348>
mov    -0x30(%rbp),%rdi
mov    0x2b44(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
cmp    $0xffffffff,%eax
jne    14ba <iniSetKey+0x2ea>
movl   $0x4,-0x4(%rbp)
jmp    1518 <iniSetKey+0x348>
jmp    14bf <iniSetKey+0x2ef>
lea    -0x230(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x200,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     14f3 <iniSetKey+0x323>
lea    -0x230(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <fputs@plt>
jmp    14bf <iniSetKey+0x2ef>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
lea    0xafc(%rip),%rdi
call   1040 <remove@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iniSetKey>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x318,%rsp
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%r14
mov    %rsi,%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    $0xfa,%ecx
jg     148a <iniSetKey+0x2ba>
lea    0xdf4(%rip),%rsi
mov    %r14,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1237 <iniSetKey+0x67>
lea    0xde1(%rip),%rsi
mov    %r14,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     147e <iniSetKey+0x2ae>
lea    0xdca(%rip),%rdi
lea    0xdbf(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1470 <iniSetKey+0x2a0>
mov    %rax,%r13
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,0x8(%rsp)
mov    %rbp,%rsi
call   1050 <strcpy@plt>
lea    0xdb3(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
lea    0x110(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1361 <iniSetKey+0x191>
mov    %r14,(%rsp)
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
jmp    12d4 <iniSetKey+0x104>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r13,%rsi
call   1090 <fputs@plt>
mov    %rbp,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1359 <iniSetKey+0x189>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     12b0 <iniSetKey+0xe0>
cmp    %rbp,%rax
jne    12b0 <iniSetKey+0xe0>
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
lea    0x1(%rax),%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
lea    0xcf0(%rip),%rsi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1090 <fputs@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%ebx
jmp    12bb <iniSetKey+0xeb>
test   %ebx,%ebx
mov    (%rsp),%r14
jne    13c5 <iniSetKey+0x1f5>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x3,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1050 <strcpy@plt>
lea    0xc8d(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10e0 <strcat@plt>
lea    0xc75(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1090 <fputs@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
lea    0xc55(%rip),%rsi
mov    %r14,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1477 <iniSetKey+0x2a7>
mov    %rax,%rbp
mov    0x2bf1(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
cmp    $0xffffffff,%eax
je     1485 <iniSetKey+0x2b5>
lea    0x110(%rsp),%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1450 <iniSetKey+0x280>
lea    0x110(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <fputs@plt>
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
jne    1430 <iniSetKey+0x260>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
lea    0xba1(%rip),%rdi
call   1040 <remove@plt>
xor    %eax,%eax
jmp    148a <iniSetKey+0x2ba>
mov    $0x5,%eax
jmp    148a <iniSetKey+0x2ba>
mov    $0x3,%eax
jmp    148a <iniSetKey+0x2ba>
mov    $0x1,%eax
jmp    148a <iniSetKey+0x2ba>
mov    $0x4,%eax
add    $0x318,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"r+t\00"
@.str.1 = [4 x i8] c"w+t\00"
@.str.2 = [29 x i8] c"/tmp/sepulcre_tmp_config.ini\00"
@.str.3 = [2 x i8] c"=\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c"wt\00"
@SEEK_SET = global i32 0
define i32 @iniSetKey(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [512 x i8]
%11 = alloca [255 x i8]
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %13
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = icmp sgt i32 %17, 250
br i1 %18, label %19, label %20
19: ; preds = %3
store i32 2, i32* %4
br label %136
20: ; preds = %3
%21 = load i8*, i8** %5
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32* %22, i32** %8
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %8
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 1, i32* %4
br label %136
29: ; preds = %24
br label %30
30: ; preds = %29, %20
%31 = call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %9
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 5, i32* %4
br label %136
34: ; preds = %30
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%36 = load i8*, i8** %6
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %82, %34
%41 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%42 = load i32*, i32** %8
%43 = call i32* @fgets(i8* %41, i32 512, i32* %42)
%44 = icmp ne i32* %43, null
br i1 %44, label %45, label %83
45: ; preds = %40
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%48 = call i8* @strstr(i8* %46, i8* %47)
store i8* %48, i8** %12
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %78
50: ; preds = %45
%51 = load i8*, i8** %12
%52 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%53 = icmp eq i8* %51, %52
br i1 %53, label %54, label %78
54: ; preds = %50
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%56 = call i32 @strlen(i8* %55)
%57 = load i8*, i8** %7
%58 = call i32 @strlen(i8* %57)
%59 = add nsw i32 %56, %58
%60 = add nsw i32 %59, 1
%61 = call i8* @malloc(i32 %60)
store i8* %61, i8** %14
%62 = load i8*, i8** %14
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%64 = call i32 @strcpy(i8* %62, i8* %63)
%65 = load i8*, i8** %14
%66 = call i8* @strchr(i8* %65, i8 signext 61)
%67 = getelementptr inbounds i8, i8* %66, i64 1
store i8* %67, i8** %12
%68 = load i8*, i8** %12
%69 = load i8*, i8** %7
%70 = call i32 @strcpy(i8* %68, i8* %69)
%71 = load i8*, i8** %14
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%73 = load i8*, i8** %14
%74 = load i32*, i32** %9
%75 = call i32 @fputs(i8* %73, i32* %74)
%76 = load i8*, i8** %14
%77 = call i32 @free(i8* %76)
store i32 1, i32* %13
br label %82
78: ; preds = %50, %45
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%80 = load i32*, i32** %9
%81 = call i32 @fputs(i8* %79, i32* %80)
br label %82
82: ; preds = %78, %54
br label %40
83: ; preds = %40
%84 = load i32, i32* %13
%85 = icmp ne i32 %84, 0
br i1 %85, label %107, label %86
86: ; preds = %83
%87 = load i8*, i8** %6
%88 = call i32 @strlen(i8* %87)
%89 = load i8*, i8** %7
%90 = call i32 @strlen(i8* %89)
%91 = add nsw i32 %88, %90
%92 = add nsw i32 %91, 3
%93 = call i8* @malloc(i32 %92)
store i8* %93, i8** %15
%94 = load i8*, i8** %15
%95 = load i8*, i8** %6
%96 = call i32 @strcpy(i8* %94, i8* %95)
%97 = load i8*, i8** %15
%98 = call i32 @strcat(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%99 = load i8*, i8** %15
%100 = load i8*, i8** %7
%101 = call i32 @strcat(i8* %99, i8* %100)
%102 = load i8*, i8** %15
%103 = call i32 @strcat(i8* %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%104 = load i8*, i8** %15
%105 = load i32*, i32** %9
%106 = call i32 @fputs(i8* %104, i32* %105)
br label %107
107: ; preds = %86, %83
%108 = load i32*, i32** %8
%109 = call i32 @fclose(i32* %108)
%110 = load i8*, i8** %5
%111 = call i32* @fopen(i8* %110, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %111, i32** %8
%112 = icmp eq i32* %111, null
br i1 %112, label %113, label %114
113: ; preds = %107
store i32 3, i32* %4
br label %136
114: ; preds = %107
%115 = load i32*, i32** %9
%116 = load i32, i32* @SEEK_SET
%117 = call i32 @fseek(i32* %115, i32 0, i32 %116)
%118 = icmp eq i32 %117, -1
br i1 %118, label %119, label %120
119: ; preds = %114
store i32 4, i32* %4
br label %136
120: ; preds = %114
br label %121
121: ; preds = %126, %120
%122 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%123 = load i32*, i32** %9
%124 = call i32* @fgets(i8* %122, i32 512, i32* %123)
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %130
126: ; preds = %121
%127 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%128 = load i32*, i32** %8
%129 = call i32 @fputs(i8* %127, i32* %128)
br label %121
130: ; preds = %121
%131 = load i32*, i32** %8
%132 = call i32 @fclose(i32* %131)
%133 = load i32*, i32** %9
%134 = call i32 @fclose(i32* %133)
%135 = call i32 @remove(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %136
136: ; preds = %130, %119, %113, %33, %28, %19
%137 = load i32, i32* %4
ret i32 %137
}

LLVM IR (-O2):
@.str = [4 x i8] c"r+t\00"
@.str.1 = [4 x i8] c"w+t\00"
@.str.2 = [29 x i8] c"/tmp/sepulcre_tmp_config.ini\00"
@.str.3 = [2 x i8] c"=\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c"wt\00"
@SEEK_SET = global i32 0
define i32 @iniSetKey(i8* nocapture %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = alloca [255 x i8]
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %1)
%9 = icmp sgt i32 %8, 250
br i1 %9, label %82, label %10
10: ; preds = %3
%11 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %82, label %16
16: ; preds = %13, %10
%17 = phi i32* [ %14, %13 ], [ %11, %10 ]
%18 = tail call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %82, label %20
20: ; preds = %16
%21 = call i32 @strcpy(i8* %7, i8* %1)
%22 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32* @fgets(i8* %6, i32 512, i32* %17)
%24 = icmp eq i32* %23, null
br i1 %24, label %52, label %25
25: ; preds = %20, %46
%26 = phi i32 [ %47, %46 ], [ 0, %20 ]
%27 = call i8* @strstr(i8* %6, i8* %7)
%28 = icmp ne i8* %27, null
%29 = icmp eq i8* %27, %6
%30 = and i1 %28, %29
br i1 %30, label %31, label %44
31: ; preds = %25
%32 = call i32 @strlen(i8* %6)
%33 = call i32 @strlen(i8* %2)
%34 = add i32 %32, 1
%35 = add i32 %34, %33
%36 = call i8* @malloc(i32 %35)
%37 = call i32 @strcpy(i8* %36, i8* %6)
%38 = call i8* @strchr(i8* dereferenceable(1) %36, i8 signext 61)
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = call i32 @strcpy(i8* %39, i8* %2)
%41 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 @fputs(i8* %36, i32* %18)
%43 = call i32 @free(i8* %36)
br label %46
44: ; preds = %25
%45 = call i32 @fputs(i8* %6, i32* %18)
br label %46
46: ; preds = %44, %31
%47 = phi i32 [ 1, %31 ], [ %26, %44 ]
%48 = call i32* @fgets(i8* %6, i32 512, i32* %17)
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %25
50: ; preds = %46
%51 = icmp eq i32 %47, 0
br i1 %51, label %52, label %63
52: ; preds = %20, %50
%53 = call i32 @strlen(i8* %1)
%54 = call i32 @strlen(i8* %2)
%55 = add i32 %53, 3
%56 = add i32 %55, %54
%57 = call i8* @malloc(i32 %56)
%58 = call i32 @strcpy(i8* %57, i8* %1)
%59 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%60 = call i32 @strcat(i8* %57, i8* %2)
%61 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @fputs(i8* %57, i32* %18)
br label %63
63: ; preds = %52, %50
%64 = call i32 @fclose(i32* %17)
%65 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%66 = icmp eq i32* %65, null
br i1 %66, label %82, label %67
67: ; preds = %63
%68 = load i32, i32* @SEEK_SET
%69 = call i32 @fseek(i32* %18, i32 0, i32 %68)
%70 = icmp eq i32 %69, -1
br i1 %70, label %82, label %71
71: ; preds = %67
%72 = call i32* @fgets(i8* %6, i32 512, i32* %18)
%73 = icmp eq i32* %72, null
br i1 %73, label %78, label %74
74: ; preds = %71, %74
%75 = call i32 @fputs(i8* %6, i32* %65)
%76 = call i32* @fgets(i8* %6, i32 512, i32* %18)
%77 = icmp eq i32* %76, null
br i1 %77, label %78, label %74
78: ; preds = %74, %71
%79 = call i32 @fclose(i32* %65)
%80 = call i32 @fclose(i32* %18)
%81 = call i32 @remove(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %82
82: ; preds = %67, %63, %16, %13, %3, %78
%83 = phi i32 [ 0, %78 ], [ 2, %3 ], [ 1, %13 ], [ 5, %16 ], [ 3, %63 ], [ 4, %67 ]
ret i32 %83
}