#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 EINVAL;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(char *, int, scalar_t__, int /*<<< orphan*/ *);
int /*<<< orphan*/ itoa(int, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove(char const *);
int /*<<< orphan*/ remove_space(char *);
int /*<<< orphan*/ rename(char *, char const *);
int /*<<< orphan*/ snprintf(char *, scalar_t__, char *, char const *, ...);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, char *, scalar_t__);
int /*<<< orphan*/ strncpy(char *, char *, scalar_t__);
int write_value(const char *config_file, const char *section,
                const char *node_name, int value) {
  FILE *fd, *fd_new;
  char name_tmp[40] = {0};
  char name_cmp[40] = {0};
  char row[200];
  char value_str[33];
  if (section == NULL || node_name == NULL) {
    printf("The section or node name pointer is null\n");
    return -EINVAL;
  }
  snprintf(name_cmp, strlen(section) + 1, "[%s]", section);
  itoa(value, value_str, 10);
  fd = fopen(config_file, "r+");
  if (fd == NULL) {
    perror("fopen():");
    return -1;
  }
  fd_new = fopen(".tmpfile", "w");
  if (fd == NULL) {
    perror("fopen():");
    return -1;
  }
  memset(row, 0, 200);
  while (fgets(row, 200, fd)) {
    remove_space(row);
    if (row[0] == '[') {
      strncpy(name_tmp, row, strlen(row) + 1);
    }
    if (!strncmp(node_name, row, strlen(node_name))) {
      if (!strncmp(name_tmp, name_cmp, strlen(name_cmp))) {
        snprintf(row, strlen(node_name) + strlen(value_str) + 3, "%s=%s\n",
                 node_name, value_str);
      }
    }
    fwrite(row, sizeof(char), strlen(row), fd_new);
  }
  fclose(fd_new);
  fclose(fd);
  remove(config_file);
  rename(".tmpfile", config_file);
  return 0;
}


x86 assembly (clang, -O0):
<write_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   10a0 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   10a0 <memset@plt>
cmpq   $0x0,-0x18(%rbp)
je     1243 <write_value+0x53>
cmpq   $0x0,-0x20(%rbp)
jne    1262 <write_value+0x72>
lea    0xdb6(%rip),%rdi
call   1080 <printf@plt>
xor    %eax,%eax
mov    0x2d88(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    14f6 <write_value+0x306>
lea    -0x90(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x198(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rcx
lea    0xd98(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    -0x24(%rbp),%edi
lea    -0x190(%rbp),%rsi
mov    $0xa,%edx
call   1110 <itoa@plt>
mov    -0x10(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12e4 <write_value+0xf4>
lea    0xd5f(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f6 <write_value+0x306>
lea    0xd50(%rip),%rdi
lea    0xd52(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    131e <write_value+0x12e>
lea    0xd25(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f6 <write_value+0x306>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   10a0 <memset@plt>
lea    -0x160(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0xc8,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     14c4 <write_value+0x2d4>
lea    -0x160(%rbp),%rdi
call   10b0 <remove_space@plt>
movsbl -0x160(%rbp),%eax
cmp    $0x5b,%eax
jne    13ab <write_value+0x1bb>
lea    -0x60(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
lea    -0x160(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
lea    -0x160(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1a8(%rbp),%rdi
mov    -0x1a0(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
lea    -0x160(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1b8(%rbp),%rdi
mov    -0x1b0(%rbp),%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
cmp    $0x0,%eax
jne    148d <write_value+0x29d>
lea    -0x60(%rbp),%rax
mov    %rax,-0x1c8(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x1c0(%rbp)
lea    -0x90(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1c8(%rbp),%rdi
mov    -0x1c0(%rbp),%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
cmp    $0x0,%eax
jne    1488 <write_value+0x298>
lea    -0x160(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,-0x1d8(%rbp)
lea    -0x190(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1d8(%rbp),%rsi
mov    -0x1d0(%rbp),%rdi
add    %rax,%rsi
add    $0x3,%rsi
mov    -0x20(%rbp),%rcx
lea    -0x190(%rbp),%r8
lea    0xbc5(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
jmp    148d <write_value+0x29d>
lea    -0x160(%rbp),%rax
mov    %rax,-0x1e0(%rbp)
lea    -0x160(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1e0(%rbp),%rdi
mov    %rax,%rdx
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
call   1100 <fwrite@plt>
jmp    1331 <write_value+0x141>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <remove@plt>
mov    -0x10(%rbp),%rsi
lea    0xb51(%rip),%rdi
call   10f0 <rename@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x60(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
test   %rsi,%rsi
je     13c6 <write_value+0x1d6>
mov    %rdx,%rbx
test   %rdx,%rdx
je     13c6 <write_value+0x1d6>
mov    %ecx,%r14d
mov    %rsi,%rbp
mov    %rdi,%r15
mov    %rsi,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rsi
lea    0xda5(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    %rbp,%rcx
xor    %eax,%eax
call   1090 <snprintf@plt>
lea    0x70(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   1110 <itoa@plt>
lea    0xd82(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     141f <write_value+0x22f>
mov    %rax,%r12
mov    %r15,0x8(%rsp)
lea    0xd6e(%rip),%rdi
lea    0xd70(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r13
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   10a0 <memset@plt>
mov    %rbp,%rdi
mov    $0xc8,%esi
mov    %r12,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     13df <write_value+0x1ef>
lea    0xa0(%rsp),%rbp
jmp    1341 <write_value+0x151>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
test   %eax,%eax
je     1370 <write_value+0x180>
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r13,%rcx
call   1100 <fwrite@plt>
mov    %rbp,%rdi
mov    $0xc8,%esi
mov    %r12,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     13df <write_value+0x1ef>
mov    %rbp,%rdi
call   10b0 <remove_space@plt>
cmpb   $0x5b,0xa0(%rsp)
5b
jne    12f0 <write_value+0x100>
mov    %rbp,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdx
lea    0x40(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strncpy@plt>
jmp    12f0 <write_value+0x100>
xchg   %ax,%ax
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
lea    0x40(%rsp),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
test   %eax,%eax
jne    130d <write_value+0x11d>
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
lea    (%r15,%rax,1),%rsi
add    $0x3,%rsi
mov    %rbp,%rdi
lea    0xc68(%rip),%rdx
mov    %rbx,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1090 <snprintf@plt>
jmp    130d <write_value+0x11d>
lea    0xc56(%rip),%rdi
call   1060 <puts@plt>
mov    0x2c07(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
jmp    140d <write_value+0x21d>
mov    %r13,%rdi
call   1070 <fclose@plt>
mov    %r12,%rdi
call   1070 <fclose@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <remove@plt>
lea    0xc0e(%rip),%rdi
mov    %rbx,%rsi
call   10f0 <rename@plt>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbe2(%rip),%rdi
call   10e0 <perror@plt>
mov    $0xffffffff,%eax
jmp    140d <write_value+0x21d>

LLVM IR (-O0):
@.str = [42 x i8] c"The section or node name pointer is null\0A\00"
@EINVAL = global i32 0
@.str.1 = [5 x i8] c"[%s]\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [9 x i8] c"fopen():\00"
@.str.4 = [9 x i8] c".tmpfile\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [7 x i8] c"%s=%s\0A\00"
define i32 @write_value(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca [40 x i8]
%13 = alloca [40 x i8]
%14 = alloca [200 x i8]
%15 = alloca [33 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%16 = bitcast [40 x i8]* %12 to i8*
%17 = bitcast [40 x i8]* %13 to i8*
%18 = load i8*, i8** %7
%19 = icmp eq i8* %18, null
br i1 %19, label %23, label %20
20: ; preds = %4
%21 = load i8*, i8** %8
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %27
23: ; preds = %20, %4
%24 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @EINVAL
%26 = sub nsw i32 0, %25
store i32 %26, i32* %5
br label %112
27: ; preds = %20
%28 = getelementptr inbounds [40 x i8], [40 x i8]* %13, i64 0, i64 0
%29 = load i8*, i8** %7
%30 = call i64 @strlen(i8* %29)
%31 = add nsw i64 %30, 1
%32 = load i8*, i8** %7
%33 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %28, i64 %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = load i32, i32* %9
%35 = getelementptr inbounds [33 x i8], [33 x i8]* %15, i64 0, i64 0
%36 = call i32 @itoa(i32 %34, i8* %35, i32 10)
%37 = load i8*, i8** %6
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %38, i32** %10
%39 = load i32*, i32** %10
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %43
41: ; preds = %27
%42 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %5
br label %112
43: ; preds = %27
%44 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %44, i32** %11
%45 = load i32*, i32** %10
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %5
br label %112
49: ; preds = %43
%50 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%51 = call i32 @memset(i8* %50, i32 0, i32 200)
br label %52
52: ; preds = %97, %49
%53 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%54 = load i32*, i32** %10
%55 = call i64 @fgets(i8* %53, i32 200, i32* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %103
57: ; preds = %52
%58 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%59 = call i32 @remove_space(i8* %58)
%60 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 91
br i1 %63, label %64, label %71
64: ; preds = %57
%65 = getelementptr inbounds [40 x i8], [40 x i8]* %12, i64 0, i64 0
%66 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%67 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%68 = call i64 @strlen(i8* %67)
%69 = add nsw i64 %68, 1
%70 = call i32 @strncpy(i8* %65, i8* %66, i64 %69)
br label %71
71: ; preds = %64, %57
%72 = load i8*, i8** %8
%73 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%74 = load i8*, i8** %8
%75 = call i64 @strlen(i8* %74)
%76 = call i32 @strncmp(i8* %72, i8* %73, i64 %75)
%77 = icmp ne i32 %76, 0
br i1 %77, label %97, label %78
78: ; preds = %71
%79 = getelementptr inbounds [40 x i8], [40 x i8]* %12, i64 0, i64 0
%80 = getelementptr inbounds [40 x i8], [40 x i8]* %13, i64 0, i64 0
%81 = getelementptr inbounds [40 x i8], [40 x i8]* %13, i64 0, i64 0
%82 = call i64 @strlen(i8* %81)
%83 = call i32 @strncmp(i8* %79, i8* %80, i64 %82)
%84 = icmp ne i32 %83, 0
br i1 %84, label %96, label %85
85: ; preds = %78
%86 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%87 = load i8*, i8** %8
%88 = call i64 @strlen(i8* %87)
%89 = getelementptr inbounds [33 x i8], [33 x i8]* %15, i64 0, i64 0
%90 = call i64 @strlen(i8* %89)
%91 = add nsw i64 %88, %90
%92 = add nsw i64 %91, 3
%93 = load i8*, i8** %8
%94 = getelementptr inbounds [33 x i8], [33 x i8]* %15, i64 0, i64 0
%95 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %86, i64 %92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %93, i8* %94)
br label %96
96: ; preds = %85, %78
br label %97
97: ; preds = %96, %71
%98 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%99 = getelementptr inbounds [200 x i8], [200 x i8]* %14, i64 0, i64 0
%100 = call i64 @strlen(i8* %99)
%101 = load i32*, i32** %11
%102 = call i32 @fwrite(i8* %98, i32 1, i64 %100, i32* %101)
br label %52
103: ; preds = %52
%104 = load i32*, i32** %11
%105 = call i32 @fclose(i32* %104)
%106 = load i32*, i32** %10
%107 = call i32 @fclose(i32* %106)
%108 = load i8*, i8** %6
%109 = call i32 @remove(i8* %108)
%110 = load i8*, i8** %6
%111 = call i32 @rename(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %110)
store i32 0, i32* %5
br label %112
112: ; preds = %103, %47, %41, %23
%113 = load i32, i32* %5
ret i32 %113
}

LLVM IR (-O2):
@EINVAL = global i32 0
@.str.1 = [5 x i8] c"[%s]\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [9 x i8] c"fopen():\00"
@.str.4 = [9 x i8] c".tmpfile\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [7 x i8] c"%s=%s\0A\00"
@str = [41 x i8] c"The section or node name pointer is null\00"
define i32 @write_value(i8* nocapture %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [40 x i8]
%6 = alloca [40 x i8]
%7 = alloca [200 x i8]
%8 = alloca [33 x i8]
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [40 x i8], [40 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%13 = icmp eq i8* %1, null
%14 = icmp eq i8* %2, null
%15 = or i1 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* @EINVAL
%19 = sub nsw i32 0, %18
br label %65
20: ; preds = %4
%21 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%22 = add nsw i64 %21, 1
%23 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %10, i64 %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%24 = call i32 @itoa(i32 %3, i8* %12, i32 10)
%25 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %65
29: ; preds = %20
%30 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 @memset(i8* %11, i32 0, i32 200)
%32 = call i64 @fgets(i8* %11, i32 200, i32* %25)
%33 = icmp eq i64 %32, 0
br i1 %33, label %60, label %34
34: ; preds = %29, %55
%35 = call i32 @remove_space(i8* %11)
%36 = load i8, i8* %11
%37 = icmp eq i8 %36, 91
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = call i64 @strlen(i8* %11)
%40 = add nsw i64 %39, 1
%41 = call i32 @strncpy(i8* %9, i8* %11, i64 %40)
br label %42
42: ; preds = %38, %34
%43 = call i64 @strlen(i8* dereferenceable(1) %2)
%44 = call i32 @strncmp(i8* %2, i8* %11, i64 %43)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = call i64 @strlen(i8* %10)
%48 = call i32 @strncmp(i8* %9, i8* %10, i64 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = call i64 @strlen(i8* %12)
%52 = add i64 %43, 3
%53 = add i64 %52, %51
%54 = call i32 (i8*, i64, i8*, i8*, ...) @snprintf(i8* %11, i64 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %2, i8* %12)
br label %55
55: ; preds = %46, %50, %42
%56 = call i64 @strlen(i8* %11)
%57 = call i32 @fwrite(i8* %11, i32 1, i64 %56, i32* %30)
%58 = call i64 @fgets(i8* %11, i32 200, i32* %25)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %34
60: ; preds = %55, %29
%61 = call i32 @fclose(i32* %30)
%62 = call i32 @fclose(i32* %25)
%63 = call i32 @remove(i8* %0)
%64 = call i32 @rename(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %65
65: ; preds = %60, %27, %16
%66 = phi i32 [ %19, %16 ], [ -1, %27 ], [ 0, %60 ]
ret i32 %66
}