#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 */
char EOF;
int /*<<< orphan*/ bb();
int /*<<< orphan*/ bcindent();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sem(char *);
int /*<<< orphan*/ strcat(char *, char *);
int main(int arg, char *argv[]) {
  int handle, bracketcount, count = 0, i;
  char s[100], c, copy;
  for (i = 2; i < arg; i++) {
    strcat(argv[1], " ");
    strcat(argv[1], argv[i]);
  }
  sem(argv[1]);
  bcindent();
  bb();
  FILE *f, *fp;
  FILE *fpc;
  f = fopen("temp2.txt", "a+");
  fp = fopen("temp.txt", "w");
  if (f == NULL) {
    printf("file not exist");
  } else {
    while (1) {
      c = fgetc(f);
      if (c == EOF) {
        break;
      } else {
        if (c == '\n') {
          c = fgetc(f);
          if (c == ' ' || c == '\t' || c == '\n') {
            while (1) {
              c = fgetc(f);
              if (c != ' ' && c != '\t' && c != '\n')
                break;
            }
          }
          if (c == '}') {
            count--;
          }
          fprintf(fp, "\n");
          for (i = count; i > 0; i--) {
            fprintf(fp, "\t");
          }
          if (c == '{') {
            count++;
          }
        }
        fprintf(fp, "%c", c);
      }
    }
  }
  fclose(f);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fe <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2e(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10b0 <strcat@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <main+0x27>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <sem@plt>
mov    $0x0,%al
call   1090 <bcindent@plt>
mov    $0x0,%al
call   1080 <bb@plt>
lea    0xde2(%rip),%rdi
lea    0xde5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0xa0(%rbp)
lea    0xdd5(%rip),%rdi
lea    0xdd7(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    126c <main+0xdc>
lea    0xdb8(%rip),%rdi
call   1040 <printf@plt>
jmp    13ee <main+0x25e>
jmp    1271 <main+0xe1>
mov    -0xa0(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x91(%rbp)
movsbl -0x91(%rbp),%eax
mov    0x2d57(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    12a1 <main+0x111>
jmp    13e9 <main+0x259>
movsbl -0x91(%rbp),%eax
cmp    $0xa,%eax
jne    13c8 <main+0x238>
mov    -0xa0(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x91(%rbp)
movsbl -0x91(%rbp),%eax
cmp    $0x20,%eax
je     12f3 <main+0x163>
movsbl -0x91(%rbp),%eax
cmp    $0x9,%eax
je     12f3 <main+0x163>
movsbl -0x91(%rbp),%eax
cmp    $0xa,%eax
jne    1349 <main+0x1b9>
jmp    12f8 <main+0x168>
mov    -0xa0(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x91(%rbp)
movsbl -0x91(%rbp),%eax
cmp    $0x20,%eax
je     133f <main+0x1af>
movsbl -0x91(%rbp),%eax
cmp    $0x9,%eax
je     133f <main+0x1af>
movsbl -0x91(%rbp),%eax
cmp    $0xa,%eax
je     133f <main+0x1af>
jmp    1344 <main+0x1b4>
jmp    12f8 <main+0x168>
jmp    1349 <main+0x1b9>
movsbl -0x91(%rbp),%eax
cmp    $0x7d,%eax
jne    1362 <main+0x1d2>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xa8(%rbp),%rdi
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    13aa <main+0x21a>
mov    -0xa8(%rbp),%rdi
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    137d <main+0x1ed>
movsbl -0x91(%rbp),%eax
cmp    $0x7b,%eax
jne    13c3 <main+0x233>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13c8 <main+0x238>
mov    -0xa8(%rbp),%rdi
movsbl -0x91(%rbp),%edx
lea    0xc50(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1271 <main+0xe1>
jmp    13ee <main+0x25e>
mov    -0xa0(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jl     11e2 <main+0x52>
mov    %edi,%r15d
mov    $0x2,%ebp
lea    0xe4e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rbx),%rdi
mov    %r14,%rsi
call   10b0 <strcat@plt>
mov    0x8(%rbx),%rdi
mov    (%rbx,%rbp,8),%rsi
call   10b0 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    11c0 <main+0x30>
mov    0x8(%rbx),%rdi
call   1070 <sem@plt>
xor    %eax,%eax
call   1090 <bcindent@plt>
xor    %eax,%eax
call   1080 <bb@plt>
lea    0xe02(%rip),%rdi
lea    0xe05(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
lea    0xdf9(%rip),%rdi
lea    0xdfb(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %r15,%r15
je     130a <main+0x17a>
mov    %r15,%rdi
call   1050 <fgetc@plt>
mov    0x2dab(%rip),%rbp
cmp    0x0(%rbp),%al
je     1316 <main+0x186>
mov    %eax,%ebx
xor    %r12d,%r12d
movabs $0x100000600,%r13
jmp    1290 <main+0x100>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
cmp    $0x7b,%bl
sete   %al
add    %eax,%r12d
mov    0x2d76(%rip),%rbp
movsbl %bl,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    %r15,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
cmp    0x0(%rbp),%al
je     1316 <main+0x186>
cmp    $0xa,%bl
jne    1272 <main+0xe2>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
cmp    $0x20,%al
ja     12b7 <main+0x127>
movzbl %bl,%eax
bt     %rax,%r13
jb     12a0 <main+0x110>
xor    %ebp,%ebp
cmp    $0x7d,%bl
sete   %bpl
mov    %r12,(%rsp)
sub    %ebp,%r12d
mov    $0xa,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
test   %r12d,%r12d
jle    1260 <main+0xd0>
neg    %ebp
mov    (%rsp),%rax
add    %eax,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x9,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     12f0 <main+0x160>
jmp    1260 <main+0xd0>
lea    0xd09(%rip),%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [10 x i8] c"temp2.txt\00"
@.str.2 = [3 x i8] c"a+\00"
@.str.3 = [9 x i8] c"temp.txt\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [15 x i8] c"file not exist\00"
@EOF = global i8 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 2, %4 ], [ %15, %7 ]
%9 = load i8*, i8** %5
%10 = tail call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8*, i8** %1, i64 %8
%13 = load i8*, i8** %12
%14 = tail call i32 @strcat(i8* %11, i8* %13)
%15 = add nuw nsw i64 %8, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %17, label %7
17: ; preds = %7, %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @sem(i8* %19)
%21 = tail call i32 (...) @bcindent()
%22 = tail call i32 (...) @bb()
%23 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32* %23, null
br i1 %25, label %30, label %26
26: ; preds = %17
%27 = tail call signext i8 @fgetc(i32* %23)
%28 = load i8, i8* @EOF
%29 = icmp eq i8 %27, %28
br i1 %29, label %66, label %32
30: ; preds = %17
%31 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %66
32: ; preds = %26, %58
%33 = phi i8 [ %63, %58 ], [ %27, %26 ]
%34 = phi i32 [ %60, %58 ], [ 0, %26 ]
%35 = icmp eq i8 %33, 10
br i1 %35, label %36, label %58
36: ; preds = %32
%37 = tail call signext i8 @fgetc(i32* %23)
switch i8 %37, label %42 [
i8 32, label %38
i8 10, label %38
i8 9, label %38
]
38: ; preds = %36, %36, %36
br label %39
39: ; preds = %41, %38
%40 = tail call signext i8 @fgetc(i32* %23)
switch i8 %40, label %42 [
i8 32, label %41
i8 10, label %41
i8 9, label %41
]
41: ; preds = %39, %39, %39
br label %39
42: ; preds = %39, %36
%43 = phi i8 [ %37, %36 ], [ %40, %39 ]
%44 = icmp eq i8 %43, 125
%45 = sext i1 %44 to i32
%46 = add nsw i32 %34, %45
%47 = tail call i32 @fputc(i32 10, i32* %24)
%48 = icmp sgt i32 %46, 0
br i1 %48, label %49, label %54
49: ; preds = %42, %49
%50 = phi i32 [ %52, %49 ], [ %46, %42 ]
%51 = tail call i32 @fputc(i32 9, i32* %24)
%52 = add nsw i32 %50, -1
%53 = icmp ugt i32 %50, 1
br i1 %53, label %49, label %54
54: ; preds = %49, %42
%55 = icmp eq i8 %43, 123
%56 = zext i1 %55 to i32
%57 = add nsw i32 %46, %56
br label %58
58: ; preds = %54, %32
%59 = phi i8 [ %33, %32 ], [ %43, %54 ]
%60 = phi i32 [ %34, %32 ], [ %57, %54 ]
%61 = sext i8 %59 to i32
%62 = tail call i32 @fputc(i32 %61, i32* %24)
%63 = tail call signext i8 @fgetc(i32* %23)
%64 = load i8, i8* @EOF
%65 = icmp eq i8 %63, %64
br i1 %65, label %66, label %32
66: ; preds = %58, %26, %30
%67 = tail call i32 @fclose(i32* %23)
%68 = tail call i32 @fclose(i32* %24)
ret i32 0
}