#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*/ fpos_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void bb() {
  int temp = 0;
  FILE *f, *fd, *fp, *fo;
  fpos_t pos;
  long p1;
  fo = fopen("temp1.txt", "a+");
  f = fopen("temp1.txt", "a+");
  fd = fopen("temp1.txt", "a+");
  fp = fopen("temp2.txt", "w");
  char c, d, e, f1;
  int count = 0, sam = 0, comment = 0, sc = 0, last = 0;
  while (1) {
    if (c == EOF) {
      break;
    }
    if (count == 0) {
      c = fgetc(f);
      count++;
    }
    if (count > 0) {
      c = fgetc(f);
      d = fgetc(fd);
      fprintf(fp, "%c", d);
    }
    if (c == '"') {
      if (sam == 0) {
        sam++;
      } else {
        sam--;
      }
    }
    if (c == 39 && sam == 0) {
      if (sc == 0) {
        sc++;
      } else {
        sc--;
      }
    }
    if (c == '(' && temp == 0 && sc == 0) {
      last++;
    }
    if (c == ')' && temp == 0 && sc == 0) {
      last--;
    }
    if (c == '/') {
      comment++;
    } else {
      comment = 0;
    }
    if (comment == 2 && sam == 0) {
      while (1) {
        if (c == '\n')
          break;
        c = fgetc(f);
        d = fgetc(fd);
        fprintf(fp, "%c", d);
      }
      comment = 0;
    }
    if (c == '{') {
      temp++;
    }
    if (c == '\n') {
      temp = 0;
      comment = 0;
      sc = 0;
    }
    if (c == '}') {
      if (temp == 0 && sc == 0 && last == 0) {
        fprintf(fp, "\n");
        d = fgetc(fd);
        c = fgetc(f);
        fprintf(fp, "%c", d);
        fprintf(fp, "\n");
      } else {
        temp--;
      }
    }
  }
  fclose(f);
  fclose(fo);
  fclose(fd);
  fclose(fp);
}


x86 assembly (clang, -O0):
<bb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xead(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    0xe93(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7c(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe72(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movsbl -0x39(%rbp),%eax
mov    0x2e0f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11e9 <bb+0xa9>
jmp    1458 <bb+0x318>
cmpl   $0x0,-0x40(%rbp)
jne    1208 <bb+0xc8>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x39(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jle    1240 <bb+0x100>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x39(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x3a(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x3a(%rbp),%edx
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movsbl -0x39(%rbp),%eax
cmp    $0x22,%eax
jne    1273 <bb+0x133>
cmpl   $0x0,-0x44(%rbp)
jne    1265 <bb+0x125>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    126e <bb+0x12e>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1273 <bb+0x133>
movsbl -0x39(%rbp),%eax
cmp    $0x27,%eax
jne    12b0 <bb+0x170>
cmpl   $0x0,-0x44(%rbp)
jne    12b0 <bb+0x170>
cmpl   $0x0,-0x4c(%rbp)
jne    12a2 <bb+0x162>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12ab <bb+0x16b>
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4c(%rbp)
jmp    12b0 <bb+0x170>
movsbl -0x39(%rbp),%eax
cmp    $0x28,%eax
jne    12da <bb+0x19a>
cmpl   $0x0,-0x4(%rbp)
jne    12da <bb+0x19a>
cmpl   $0x0,-0x4c(%rbp)
jne    12da <bb+0x19a>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x29,%eax
jne    1304 <bb+0x1c4>
cmpl   $0x0,-0x4(%rbp)
jne    1304 <bb+0x1c4>
cmpl   $0x0,-0x4c(%rbp)
jne    1304 <bb+0x1c4>
mov    -0x50(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x50(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x2f,%eax
jne    131f <bb+0x1df>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1326 <bb+0x1e6>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jne    138b <bb+0x24b>
cmpl   $0x0,-0x44(%rbp)
jne    138b <bb+0x24b>
jmp    133f <bb+0x1ff>
movsbl -0x39(%rbp),%eax
cmp    $0xa,%eax
jne    1351 <bb+0x211>
jmp    1384 <bb+0x244>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x39(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x3a(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x3a(%rbp),%edx
lea    0xca1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133f <bb+0x1ff>
movl   $0x0,-0x48(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x7b,%eax
jne    13a1 <bb+0x261>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0xa,%eax
jne    13c3 <bb+0x283>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x7d,%eax
jne    1453 <bb+0x313>
cmpl   $0x0,-0x4(%rbp)
jne    1445 <bb+0x305>
cmpl   $0x0,-0x4c(%rbp)
jne    1445 <bb+0x305>
cmpl   $0x0,-0x50(%rbp)
jne    1445 <bb+0x305>
mov    -0x20(%rbp),%rdi
lea    0xc23(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x3a(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x39(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x3a(%rbp),%edx
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xbe3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    144e <bb+0x30e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1453 <bb+0x313>
jmp    11ce <bb+0x8e>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rbx
lea    0xeae(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
lea    0xe7c(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r13
mov    $0x1,%al
xor    %r14d,%r14d
xor    %r12d,%r12d
movl   $0x0,(%rsp)
xor    %r8d,%r8d
xor    %edi,%edi
mov    %rbp,0x10(%rsp)
jmp    11d6 <bb+0x96>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%edi
mov    $0x7d,%bl
xor    %eax,%eax
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%bl
je     1378 <bb+0x238>
mov    %edi,0x4(%rsp)
mov    %r8d,%r15d
mov    %r12d,%ebp
test   $0x1,%al
mov    0x8(%rsp),%rbx
je     11f1 <bb+0xb1>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%rdi
call   1040 <fgetc@plt>
movsbl %al,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
xor    %r8d,%r8d
test   %r15d,%r15d
sete   %r8b
cmp    $0x22,%bl
cmovne %r15d,%r8d
xor    %r12d,%r12d
test   %ebp,%ebp
sete   %r12b
test   %r8d,%r8d
cmovne %ebp,%r12d
cmp    $0x27,%bl
cmovne %ebp,%r12d
cmp    $0x28,%bl
sete   %al
mov    0x4(%rsp),%edi
test   %edi,%edi
sete   %cl
and    %cl,%al
test   %r12d,%r12d
sete   %dl
and    %dl,%al
movzbl %al,%eax
add    %eax,%r14d
cmp    $0x29,%bl
sete   %r15b
and    %cl,%r15b
and    %dl,%r15b
mov    (%rsp),%ecx
add    $0x1,%ecx
cmp    $0x2f,%bl
mov    $0x0,%eax
cmovne %eax,%ecx
cmp    $0x2,%ecx
jne    1290 <bb+0x150>
test   %r8d,%r8d
mov    0x10(%rsp),%rbp
jne    12e3 <bb+0x1a3>
xor    %ecx,%ecx
cmp    $0xa,%bl
jne    12a0 <bb+0x160>
mov    $0xa,%bl
jmp    12e3 <bb+0x1a3>
nop
mov    0x10(%rsp),%rbp
jmp    12e3 <bb+0x1a3>
nopw   0x0(%rax,%rax,1)
mov    %r8d,0x1c(%rsp)
mov    %r14d,(%rsp)
mov    0x8(%rsp),%r14
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1040 <fgetc@plt>
movsbl %al,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
cmp    $0xa,%bl
jne    12b0 <bb+0x170>
mov    $0xa,%bl
mov    (%rsp),%r14d
xor    %ecx,%ecx
mov    0x1c(%rsp),%r8d
mov    0x4(%rsp),%edi
movzbl %r15b,%eax
sub    %eax,%r14d
xor    %eax,%eax
cmp    $0x7b,%bl
sete   %al
add    %eax,%edi
cmp    $0xa,%bl
mov    $0x0,%eax
cmove  %eax,%edi
cmove  %eax,%ecx
cmove  %eax,%r12d
cmp    $0x7d,%bl
mov    %ecx,(%rsp)
jne    11c5 <bb+0x85>
test   %edi,%edi
jne    11c0 <bb+0x80>
test   %r12d,%r12d
jne    11c0 <bb+0x80>
test   %r14d,%r14d
jne    11c0 <bb+0x80>
mov    %r8d,%r15d
mov    $0xa,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    %rbp,%rdi
call   1040 <fgetc@plt>
mov    %al,0x4(%rsp)
mov    0x8(%rsp),%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
movsbl 0x4(%rsp),%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    %r15d,%r8d
xor    %edi,%edi
jmp    11c5 <bb+0x85>
mov    0x8(%rsp),%rdi
call   1030 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1030 <fclose@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %r13,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"temp1.txt\00"
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [10 x i8] c"temp2.txt\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i8 0
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @bb() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %1
%17 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %5
%18 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %2
%19 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %3
%20 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %20, i32** %4
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
br label %21
21: ; preds = %0, %177
%22 = load i8, i8* %8
%23 = sext i8 %22 to i32
%24 = load i8, i8* @EOF
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %28
27: ; preds = %21
br label %178
28: ; preds = %21
%29 = load i32, i32* %12
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32*, i32** %2
%33 = call signext i8 @fgetc(i32* %32)
store i8 %33, i8* %8
%34 = load i32, i32* %12
%35 = add nsw i32 %34, 1
store i32 %35, i32* %12
br label %36
36: ; preds = %31, %28
%37 = load i32, i32* %12
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load i32*, i32** %2
%41 = call signext i8 @fgetc(i32* %40)
store i8 %41, i8* %8
%42 = load i32*, i32** %3
%43 = call signext i8 @fgetc(i32* %42)
store i8 %43, i8* %9
%44 = load i32*, i32** %4
%45 = load i8, i8* %9
%46 = sext i8 %45 to i32
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %39, %36
%49 = load i8, i8* %8
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 34
br i1 %51, label %52, label %62
52: ; preds = %48
%53 = load i32, i32* %13
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* %13
%57 = add nsw i32 %56, 1
store i32 %57, i32* %13
br label %61
58: ; preds = %52
%59 = load i32, i32* %13
%60 = add nsw i32 %59, -1
store i32 %60, i32* %13
br label %61
61: ; preds = %58, %55
br label %62
62: ; preds = %61, %48
%63 = load i8, i8* %8
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 39
br i1 %65, label %66, label %79
66: ; preds = %62
%67 = load i32, i32* %13
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %79
69: ; preds = %66
%70 = load i32, i32* %15
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i32, i32* %15
%74 = add nsw i32 %73, 1
store i32 %74, i32* %15
br label %78
75: ; preds = %69
%76 = load i32, i32* %15
%77 = add nsw i32 %76, -1
store i32 %77, i32* %15
br label %78
78: ; preds = %75, %72
br label %79
79: ; preds = %78, %66, %62
%80 = load i8, i8* %8
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 40
br i1 %82, label %83, label %92
83: ; preds = %79
%84 = load i32, i32* %1
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %83
%87 = load i32, i32* %15
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %86
%90 = load i32, i32* %16
%91 = add nsw i32 %90, 1
store i32 %91, i32* %16
br label %92
92: ; preds = %89, %86, %83, %79
%93 = load i8, i8* %8
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 41
br i1 %95, label %96, label %105
96: ; preds = %92
%97 = load i32, i32* %1
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %105
99: ; preds = %96
%100 = load i32, i32* %15
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = load i32, i32* %16
%104 = add nsw i32 %103, -1
store i32 %104, i32* %16
br label %105
105: ; preds = %102, %99, %96, %92
%106 = load i8, i8* %8
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 47
br i1 %108, label %109, label %112
109: ; preds = %105
%110 = load i32, i32* %14
%111 = add nsw i32 %110, 1
store i32 %111, i32* %14
br label %113
112: ; preds = %105
store i32 0, i32* %14
br label %113
113: ; preds = %112, %109
%114 = load i32, i32* %14
%115 = icmp eq i32 %114, 2
br i1 %115, label %116, label %135
116: ; preds = %113
%117 = load i32, i32* %13
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %135
119: ; preds = %116
br label %120
120: ; preds = %119, %125
%121 = load i8, i8* %8
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 10
br i1 %123, label %124, label %125
124: ; preds = %120
br label %134
125: ; preds = %120
%126 = load i32*, i32** %2
%127 = call signext i8 @fgetc(i32* %126)
store i8 %127, i8* %8
%128 = load i32*, i32** %3
%129 = call signext i8 @fgetc(i32* %128)
store i8 %129, i8* %9
%130 = load i32*, i32** %4
%131 = load i8, i8* %9
%132 = sext i8 %131 to i32
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %130, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %132)
br label %120
134: ; preds = %124
store i32 0, i32* %14
br label %135
135: ; preds = %134, %116, %113
%136 = load i8, i8* %8
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %137, 123
br i1 %138, label %139, label %142
139: ; preds = %135
%140 = load i32, i32* %1
%141 = add nsw i32 %140, 1
store i32 %141, i32* %1
br label %142
142: ; preds = %139, %135
%143 = load i8, i8* %8
%144 = sext i8 %143 to i32
%145 = icmp eq i32 %144, 10
br i1 %145, label %146, label %147
146: ; preds = %142
store i32 0, i32* %1
store i32 0, i32* %14
store i32 0, i32* %15
br label %147
147: ; preds = %146, %142
%148 = load i8, i8* %8
%149 = sext i8 %148 to i32
%150 = icmp eq i32 %149, 125
br i1 %150, label %151, label %177
151: ; preds = %147
%152 = load i32, i32* %1
%153 = icmp eq i32 %152, 0
br i1 %153, label %154, label %173
154: ; preds = %151
%155 = load i32, i32* %15
%156 = icmp eq i32 %155, 0
br i1 %156, label %157, label %173
157: ; preds = %154
%158 = load i32, i32* %16
%159 = icmp eq i32 %158, 0
br i1 %159, label %160, label %173
160: ; preds = %157
%161 = load i32*, i32** %4
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%163 = load i32*, i32** %3
%164 = call signext i8 @fgetc(i32* %163)
store i8 %164, i8* %9
%165 = load i32*, i32** %2
%166 = call signext i8 @fgetc(i32* %165)
store i8 %166, i8* %8
%167 = load i32*, i32** %4
%168 = load i8, i8* %9
%169 = sext i8 %168 to i32
%170 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %169)
%171 = load i32*, i32** %4
%172 = call i32 (i32*, i8*, ...) @fprintf(i32* %171, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %176
173: ; preds = %157, %154, %151
%174 = load i32, i32* %1
%175 = add nsw i32 %174, -1
store i32 %175, i32* %1
br label %176
176: ; preds = %173, %160
br label %177
177: ; preds = %176, %147
br label %21
178: ; preds = %27
%179 = load i32*, i32** %2
%180 = call i32 @fclose(i32* %179)
%181 = load i32*, i32** %5
%182 = call i32 @fclose(i32* %181)
%183 = load i32*, i32** %3
%184 = call i32 @fclose(i32* %183)
%185 = load i32*, i32** %4
%186 = call i32 @fclose(i32* %185)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"temp1.txt\00"
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [10 x i8] c"temp2.txt\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i8 0
define void @bb() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %0, %80
%6 = phi i32 [ %40, %80 ], [ 0, %0 ]
%7 = phi i32 [ %63, %80 ], [ 0, %0 ]
%8 = phi i32 [ %62, %80 ], [ 0, %0 ]
%9 = phi i32 [ %22, %80 ], [ 0, %0 ]
%10 = phi i1 [ false, %80 ], [ true, %0 ]
%11 = phi i32 [ %82, %80 ], [ 0, %0 ]
br i1 %10, label %12, label %14
12: ; preds = %5
%13 = tail call signext i8 @fgetc(i32* %2)
br label %14
14: ; preds = %5, %12
%15 = tail call signext i8 @fgetc(i32* %2)
%16 = tail call signext i8 @fgetc(i32* %3)
%17 = sext i8 %16 to i32
%18 = tail call i32 @fputc(i32 %17, i32* %4)
%19 = icmp eq i8 %15, 34
%20 = icmp eq i32 %9, 0
%21 = zext i1 %20 to i32
%22 = select i1 %19, i32 %21, i32 %9
%23 = icmp eq i8 %15, 39
%24 = icmp eq i32 %22, 0
%25 = select i1 %23, i1 %24, i1 false
%26 = icmp eq i32 %7, 0
%27 = zext i1 %26 to i32
%28 = select i1 %25, i32 %27, i32 %7
%29 = icmp eq i8 %15, 40
%30 = icmp eq i32 %11, 0
%31 = select i1 %29, i1 %30, i1 false
%32 = icmp eq i32 %28, 0
%33 = select i1 %31, i1 %32, i1 false
%34 = zext i1 %33 to i32
%35 = add nsw i32 %6, %34
%36 = icmp eq i8 %15, 41
%37 = select i1 %36, i1 %30, i1 false
%38 = select i1 %37, i1 %32, i1 false
%39 = sext i1 %38 to i32
%40 = add nsw i32 %35, %39
%41 = icmp eq i8 %15, 47
%42 = add nsw i32 %8, 1
%43 = select i1 %41, i32 %42, i32 0
%44 = icmp eq i32 %43, 2
%45 = select i1 %44, i1 %24, i1 false
br i1 %45, label %46, label %54
46: ; preds = %14
%47 = icmp eq i8 %15, 10
br i1 %47, label %54, label %48
48: ; preds = %46, %48
%49 = tail call signext i8 @fgetc(i32* %2)
%50 = tail call signext i8 @fgetc(i32* %3)
%51 = sext i8 %50 to i32
%52 = tail call i32 @fputc(i32 %51, i32* %4)
%53 = icmp eq i8 %49, 10
br i1 %53, label %54, label %48
54: ; preds = %48, %46, %14
%55 = phi i8 [ %15, %14 ], [ 10, %46 ], [ 10, %48 ]
%56 = phi i32 [ %43, %14 ], [ 0, %46 ], [ 0, %48 ]
%57 = icmp eq i8 %55, 123
%58 = zext i1 %57 to i32
%59 = add nsw i32 %11, %58
%60 = icmp eq i8 %55, 10
%61 = select i1 %60, i32 0, i32 %59
%62 = select i1 %60, i32 0, i32 %56
%63 = select i1 %60, i32 0, i32 %28
%64 = icmp eq i8 %55, 125
br i1 %64, label %65, label %80
65: ; preds = %54
%66 = icmp eq i32 %61, 0
%67 = icmp eq i32 %63, 0
%68 = select i1 %66, i1 %67, i1 false
%69 = icmp eq i32 %40, 0
%70 = select i1 %68, i1 %69, i1 false
br i1 %70, label %71, label %78
71: ; preds = %65
%72 = tail call i32 @fputc(i32 10, i32* %4)
%73 = tail call signext i8 @fgetc(i32* %3)
%74 = tail call signext i8 @fgetc(i32* %2)
%75 = sext i8 %73 to i32
%76 = tail call i32 @fputc(i32 %75, i32* %4)
%77 = tail call i32 @fputc(i32 10, i32* %4)
br label %80
78: ; preds = %65
%79 = add nsw i32 %61, -1
br label %80
80: ; preds = %71, %78, %54
%81 = phi i8 [ %74, %71 ], [ 125, %78 ], [ %55, %54 ]
%82 = phi i32 [ 0, %71 ], [ %79, %78 ], [ %61, %54 ]
%83 = load i8, i8* @EOF
%84 = icmp eq i8 %81, %83
br i1 %84, label %85, label %5
85: ; preds = %80
%86 = tail call i32 @fclose(i32* %2)
%87 = tail call i32 @fclose(i32* %1)
%88 = tail call i32 @fclose(i32* %3)
%89 = tail call i32 @fclose(i32* %4)
ret void
}