#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*/ empty();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ full();
int /*<<< orphan*/ pop(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(int, int);
int /*<<< orphan*/ puts(char *);
int sp();
int check_TeX_parentheses(const char *filename) {
  static char buffer[(1024 * 8)];
  FILE *f;
  size_t readed;
  int line = 1;
  int column = 1;
  int comment = 0;
  int level;
  char prev = 0;
  char *this;
  f = fopen(filename, "rb");
  if (f == NULL) {
    printf("Can't open file '%s'.\n", filename);
    return 0;
  }
  while (readed = fread(buffer, sizeof(char), (1024 * 8), f)) {
    this = buffer;
    while (readed--) {
      if (*this == '\n') {
        comment = 0;
        column = 1;
        line++;
        prev = *this ++;
        continue;
      }
      if (comment || prev == '\\') {
        if (*this == '\\')
          prev = 0;
        else
          prev = *this;
        this ++;
        column++;
        continue;
      }
      switch (*this) {
      case '%':
        comment = 1;
        break;
      case '{':
        if (!full())
          push(line, column);
        else {
          puts("Stack is full, recompile the program with larger stack "
               "(incrase STACK_SIZE).");
          goto error;
        }
        break;
      case '}':
        if (!empty())
          pop(NULL, NULL);
        else {
          printf("%s: extra closing bracket at line %d, column %d\n.", filename,
                 line, column);
          goto error;
        }
        break;
      }
      prev = *this ++;
      column++;
    }
  }
ok:
  if (!empty()) {
    if (sp() > 1)
      printf("There are some opened groups:\n");
    else
      printf("There is an opened group:\n");
    while (!empty()) {
      level = sp();
      pop(&line, &column);
      printf("%s: level %d, line %d, column %d\n", filename, level, line,
             column);
    }
  }
  fclose(f);
  return 1;
error:
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<check_TeX_parentheses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movb   $0x0,-0x31(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1202 <check_TeX_parentheses+0x62>
mov    -0x10(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1495 <check_TeX_parentheses+0x2f5>
jmp    1207 <check_TeX_parentheses+0x67>
mov    -0x18(%rbp),%rcx
lea    0x2e6e(%rip),%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
call   1040 <fread@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     13cc <check_TeX_parentheses+0x22c>
lea    0x2e4a(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     13c7 <check_TeX_parentheses+0x227>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1293 <check_TeX_parentheses+0xf3>
movl   $0x0,-0x2c(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
mov    (%rax),%al
mov    %al,-0x31(%rbp)
jmp    123a <check_TeX_parentheses+0x9a>
cmpl   $0x0,-0x2c(%rbp)
jne    12aa <check_TeX_parentheses+0x10a>
movsbl -0x31(%rbp),%eax
cmp    $0x5c,%eax
jne    12e6 <check_TeX_parentheses+0x146>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    12c3 <check_TeX_parentheses+0x123>
movb   $0x0,-0x31(%rbp)
jmp    12cc <check_TeX_parentheses+0x12c>
mov    -0x40(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x31(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    123a <check_TeX_parentheses+0x9a>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x44(%rbp)
sub    $0x25,%eax
je     1320 <check_TeX_parentheses+0x180>
jmp    12fe <check_TeX_parentheses+0x15e>
mov    -0x44(%rbp),%eax
sub    $0x7b,%eax
je     132c <check_TeX_parentheses+0x18c>
jmp    130f <check_TeX_parentheses+0x16f>
mov    -0x44(%rbp),%eax
sub    $0x7d,%eax
je     1362 <check_TeX_parentheses+0x1c2>
jmp    13a5 <check_TeX_parentheses+0x205>
movl   $0x1,-0x2c(%rbp)
jmp    13a5 <check_TeX_parentheses+0x205>
mov    $0x0,%al
call   10c0 <full@plt>
cmp    $0x0,%eax
jne    134c <check_TeX_parentheses+0x1ac>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   10a0 <push@plt>
jmp    135d <check_TeX_parentheses+0x1bd>
lea    0xcc7(%rip),%rdi
call   1030 <puts@plt>
jmp    1485 <check_TeX_parentheses+0x2e5>
jmp    13a5 <check_TeX_parentheses+0x205>
mov    $0x0,%al
call   1090 <empty@plt>
cmp    $0x0,%eax
jne    1383 <check_TeX_parentheses+0x1e3>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1080 <pop@plt>
jmp    13a0 <check_TeX_parentheses+0x200>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1485 <check_TeX_parentheses+0x2e5>
jmp    13a5 <check_TeX_parentheses+0x205>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
mov    (%rax),%al
mov    %al,-0x31(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    123a <check_TeX_parentheses+0x9a>
jmp    1207 <check_TeX_parentheses+0x67>
jmp    13d1 <check_TeX_parentheses+0x231>
mov    $0x0,%al
call   1090 <empty@plt>
cmp    $0x0,%eax
jne    1470 <check_TeX_parentheses+0x2d0>
mov    $0x0,%al
call   1050 <sp@plt>
cmp    $0x1,%eax
jle    1404 <check_TeX_parentheses+0x264>
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1412 <check_TeX_parentheses+0x272>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1417 <check_TeX_parentheses+0x277>
mov    $0x0,%al
call   1090 <empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1433 <check_TeX_parentheses+0x293>
jmp    146b <check_TeX_parentheses+0x2cb>
mov    $0x0,%al
call   1050 <sp@plt>
mov    %eax,-0x30(%rbp)
lea    -0x24(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1080 <pop@plt>
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1417 <check_TeX_parentheses+0x277>
jmp    1470 <check_TeX_parentheses+0x2d0>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1495 <check_TeX_parentheses+0x2f5>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_TeX_parentheses>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbp
movl   $0x1,0x14(%rsp)
movl   $0x1,0xc(%rsp)
lea    0xe38(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13e8 <check_TeX_parentheses+0x248>
mov    %rbp,0x20(%rsp)
lea    0x2e9e(%rip),%rdi
movl   $0x1,0x10(%rsp)
mov    $0x1,%esi
mov    $0x2000,%edx
mov    %rax,0x18(%rsp)
mov    %rax,%rcx
call   1040 <fread@plt>
test   %rax,%rax
je     1352 <check_TeX_parentheses+0x1b2>
mov    %rax,%rbp
xor    %ecx,%ecx
mov    $0x1,%ebx
lea    0x2e65(%rip),%r12
xor    %r14d,%r14d
xor    %r15d,%r15d
jmp    125f <check_TeX_parentheses+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %r13d,%ebx
lea    0x2e46(%rip),%r12
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x2000,%edx
mov    0x18(%rsp),%rcx
call   1040 <fread@plt>
xor    %ecx,%ecx
mov    %rax,%rbp
test   %rax,%rax
je     1352 <check_TeX_parentheses+0x1b2>
mov    %ebx,%ebx
xor    %r13d,%r13d
jmp    128c <check_TeX_parentheses+0xec>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x5c,%al
cmove  %ecx,%eax
mov    %eax,%r14d
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
add    $0x1,%r13
cmp    %r13,%rbp
je     1230 <check_TeX_parentheses+0x90>
movsbl (%r12,%r13,1),%eax
cmp    $0xa,%eax
je     12c0 <check_TeX_parentheses+0x120>
test   %r15d,%r15d
jne    1270 <check_TeX_parentheses+0xd0>
cmp    $0x5c,%r14b
je     1270 <check_TeX_parentheses+0xd0>
cmp    $0x7d,%eax
je     12e4 <check_TeX_parentheses+0x144>
xor    %r15d,%r15d
cmp    $0x7b,%eax
je     1301 <check_TeX_parentheses+0x161>
cmp    $0x25,%eax
jne    131f <check_TeX_parentheses+0x17f>
mov    $0x1,%r15d
jmp    131f <check_TeX_parentheses+0x17f>
nopl   0x0(%rax,%rax,1)
movl   $0x1,0xc(%rsp)
mov    0x10(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
mov    %eax,0x14(%rsp)
mov    $0xa,%r14b
xor    %r15d,%r15d
mov    $0x1,%ebx
jmp    132d <check_TeX_parentheses+0x18d>
xor    %eax,%eax
call   1090 <empty@plt>
test   %eax,%eax
jne    140c <check_TeX_parentheses+0x26c>
xor    %r15d,%r15d
xor    %edi,%edi
xor    %esi,%esi
call   1080 <pop@plt>
jmp    131d <check_TeX_parentheses+0x17d>
xor    %eax,%eax
call   10c0 <full@plt>
test   %eax,%eax
jne    142a <check_TeX_parentheses+0x28a>
lea    (%rbx,%r13,1),%rsi
mov    0x10(%rsp),%edi
call   10a0 <push@plt>
xor    %ecx,%ecx
mov    (%r12,%r13,1),%r14b
add    %r13d,%ebx
add    $0x1,%ebx
mov    %ebx,0xc(%rsp)
add    %r13,%r12
add    $0x1,%r12
mov    %r13,%rax
not    %rax
add    %rbp,%rax
add    $0xffffffffffffffff,%rbp
cmp    %r13,%rbp
mov    %rax,%rbp
jne    125f <check_TeX_parentheses+0xbf>
jmp    1233 <check_TeX_parentheses+0x93>
xor    %eax,%eax
call   1090 <empty@plt>
test   %eax,%eax
mov    0x20(%rsp),%rbx
jne    13d7 <check_TeX_parentheses+0x237>
xor    %eax,%eax
call   1050 <sp@plt>
cmp    $0x2,%eax
lea    0xd62(%rip),%rax
lea    0xd41(%rip),%rdi
cmovge %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <empty@plt>
test   %eax,%eax
jne    13d7 <check_TeX_parentheses+0x237>
lea    0x14(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0xcfa(%rip),%r14
nop
xor    %eax,%eax
call   1050 <sp@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r13,%rsi
call   1080 <pop@plt>
mov    0x14(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <empty@plt>
test   %eax,%eax
je     13a0 <check_TeX_parentheses+0x200>
mov    0x18(%rsp),%rdi
call   1060 <fclose@plt>
mov    $0x1,%ebx
jmp    13fb <check_TeX_parentheses+0x25b>
lea    0xc14(%rip),%rdi
xor    %ebx,%ebx
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    %r13d,%ebx
lea    0xc51(%rip),%rdi
mov    0x20(%rsp),%rsi
mov    0x10(%rsp),%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1436 <check_TeX_parentheses+0x296>
lea    0xbe9(%rip),%rdi
call   1030 <puts@plt>
mov    0x18(%rsp),%rdi
call   1060 <fclose@plt>
xor    %ebx,%ebx
jmp    13fb <check_TeX_parentheses+0x25b>

LLVM IR (-O0):
@check_TeX_parentheses.buffer = internal global [8192 x i8] zeroinitializer
@.str = [3 x i8] c"rb\00"
@.str.1 = [23 x i8] c"Can't open file '%s'.\0A\00"
@.str.2 = [77 x i8] c"Stack is full, recompile the program with larger stack (incrase STACK_SIZE).\00"
@.str.3 = [50 x i8] c"%s: extra closing bracket at line %d, column %d\0A.\00"
@.str.4 = [31 x i8] c"There are some opened groups:\0A\00"
@.str.5 = [27 x i8] c"There is an opened group:\0A\00"
@.str.6 = [34 x i8] c"%s: level %d, line %d, column %d\0A\00"
define i32 @check_TeX_parentheses(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8*
store i8* %0, i8** %3
store i32 1, i32* %6
store i32 1, i32* %7
store i32 0, i32* %8
store i8 0, i8* %10
%12 = load i8*, i8** %3
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %4
%14 = load i32*, i32** %4
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %17)
store i32 0, i32* %2
br label %125
19: ; preds = %1
br label %20
20: ; preds = %93, %19
%21 = load i32*, i32** %4
%22 = call i64 @fread(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), i32 1, i32 8192, i32* %21)
store i64 %22, i64* %5
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %94
24: ; preds = %20
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), i8** %11
br label %25
25: ; preds = %87, %56, %34, %24
%26 = load i64, i64* %5
%27 = add i64 %26, -1
store i64 %27, i64* %5
%28 = icmp ne i64 %26, 0
br i1 %28, label %29, label %93
29: ; preds = %25
%30 = load i8*, i8** %11
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %40
34: ; preds = %29
store i32 0, i32* %8
store i32 1, i32* %7
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
%37 = load i8*, i8** %11
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %11
%39 = load i8, i8* %37
store i8 %39, i8* %10
br label %25
40: ; preds = %29
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %40
%44 = load i8, i8* %10
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 92
br i1 %46, label %47, label %61
47: ; preds = %43, %40
%48 = load i8*, i8** %11
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 92
br i1 %51, label %52, label %53
52: ; preds = %47
store i8 0, i8* %10
br label %56
53: ; preds = %47
%54 = load i8*, i8** %11
%55 = load i8, i8* %54
store i8 %55, i8* %10
br label %56
56: ; preds = %53, %52
%57 = load i8*, i8** %11
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %11
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %25
61: ; preds = %43
%62 = load i8*, i8** %11
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
switch i32 %64, label %87 [
i32 37, label %65
i32 123, label %66
i32 125, label %76
]
65: ; preds = %61
store i32 1, i32* %8
br label %87
66: ; preds = %61
%67 = call i32 (...) @full()
%68 = icmp ne i32 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %66
%70 = load i32, i32* %6
%71 = load i32, i32* %7
%72 = call i32 @push(i32 %70, i32 %71)
br label %75
73: ; preds = %66
%74 = call i32 @puts(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.2, i64 0, i64 0))
br label %122
75: ; preds = %69
br label %87
76: ; preds = %61
%77 = call i32 (...) @empty()
%78 = icmp ne i32 %77, 0
br i1 %78, label %81, label %79
79: ; preds = %76
%80 = call i32 @pop(i32* null, i32* null)
br label %86
81: ; preds = %76
%82 = load i8*, i8** %3
%83 = load i32, i32* %6
%84 = load i32, i32* %7
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %82, i32 %83, i32 %84)
br label %122
86: ; preds = %79
br label %87
87: ; preds = %61, %86, %75, %65
%88 = load i8*, i8** %11
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %11
%90 = load i8, i8* %88
store i8 %90, i8* %10
%91 = load i32, i32* %7
%92 = add nsw i32 %91, 1
store i32 %92, i32* %7
br label %25
93: ; preds = %25
br label %20
94: ; preds = %20
br label %95
95: ; preds = %94
%96 = call i32 (...) @empty()
%97 = icmp ne i32 %96, 0
br i1 %97, label %119, label %98
98: ; preds = %95
%99 = call i32 (...) @sp()
%100 = icmp sgt i32 %99, 1
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %105
103: ; preds = %98
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %105
105: ; preds = %103, %101
br label %106
106: ; preds = %110, %105
%107 = call i32 (...) @empty()
%108 = icmp ne i32 %107, 0
%109 = xor i1 %108, true
br i1 %109, label %110, label %118
110: ; preds = %106
%111 = call i32 (...) @sp()
store i32 %111, i32* %9
%112 = call i32 @pop(i32* %6, i32* %7)
%113 = load i8*, i8** %3
%114 = load i32, i32* %9
%115 = load i32, i32* %6
%116 = load i32, i32* %7
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %113, i32 %114, i32 %115, i32 %116)
br label %106
118: ; preds = %106
br label %119
119: ; preds = %118, %95
%120 = load i32*, i32** %4
%121 = call i32 @fclose(i32* %120)
store i32 1, i32* %2
br label %125
122: ; preds = %81, %73
%123 = load i32*, i32** %4
%124 = call i32 @fclose(i32* %123)
store i32 0, i32* %2
br label %125
125: ; preds = %122, %119, %16
%126 = load i32, i32* %2
ret i32 %126
}

LLVM IR (-O2):
@check_TeX_parentheses.buffer = internal global [8192 x i8] zeroinitializer
@.str = [3 x i8] c"rb\00"
@.str.1 = [23 x i8] c"Can't open file '%s'.\0A\00"
@.str.2 = [77 x i8] c"Stack is full, recompile the program with larger stack (incrase STACK_SIZE).\00"
@.str.3 = [50 x i8] c"%s: extra closing bracket at line %d, column %d\0A.\00"
@.str.6 = [34 x i8] c"%s: level %d, line %d, column %d\0A\00"
@str = [26 x i8] c"There is an opened group:\00"
@str.7 = [30 x i8] c"There are some opened groups:\00"
define i32 @check_TeX_parentheses(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = tail call i64 @fread(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), i32 1, i32 8192, i32* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %87, label %21
11: ; preds = %1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %109
13: ; preds = %59, %40
%14 = phi i32 [ %41, %40 ], [ %22, %59 ]
%15 = phi i32 [ %42, %40 ], [ %63, %59 ]
%16 = phi i32 [ %43, %40 ], [ %24, %59 ]
%17 = phi i32 [ %44, %40 ], [ %28, %59 ]
%18 = phi i8 [ %45, %40 ], [ %61, %59 ]
%19 = tail call i64 @fread(i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), i32 1, i32 8192, i32* %6)
%20 = icmp eq i64 %19, 0
br i1 %20, label %87, label %48
21: ; preds = %8, %48
%22 = phi i32 [ %49, %48 ], [ 1, %8 ]
%23 = phi i32 [ %50, %48 ], [ 1, %8 ]
%24 = phi i32 [ %51, %48 ], [ 1, %8 ]
%25 = phi i64 [ %52, %48 ], [ %9, %8 ]
%26 = phi i8* [ %53, %48 ], [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), %8 ]
%27 = phi i8 [ %54, %48 ], [ 0, %8 ]
%28 = phi i32 [ %55, %48 ], [ 0, %8 ]
%29 = icmp ne i32 %28, 0
br label %30
30: ; preds = %21, %59
%31 = phi i32 [ %23, %21 ], [ %63, %59 ]
%32 = phi i64 [ %25, %21 ], [ %35, %59 ]
%33 = phi i8* [ %26, %21 ], [ %62, %59 ]
%34 = phi i8 [ %27, %21 ], [ %61, %59 ]
%35 = add i64 %32, -1
%36 = load i8, i8* %33
%37 = icmp eq i8 %36, 10
br i1 %37, label %38, label %56
38: ; preds = %30
store i32 1, i32* %3
%39 = add nsw i32 %22, 1
store i32 %39, i32* %2
br label %40
40: ; preds = %38, %82
%41 = phi i32 [ %22, %82 ], [ %39, %38 ]
%42 = phi i32 [ %86, %82 ], [ 1, %38 ]
%43 = phi i32 [ %83, %82 ], [ %39, %38 ]
%44 = phi i32 [ %84, %82 ], [ 0, %38 ]
%45 = phi i8 [ %85, %82 ], [ 10, %38 ]
%46 = getelementptr inbounds i8, i8* %33, i64 1
%47 = icmp eq i64 %35, 0
br i1 %47, label %13, label %48
48: ; preds = %40, %13
%49 = phi i32 [ %41, %40 ], [ %14, %13 ]
%50 = phi i32 [ %42, %40 ], [ %15, %13 ]
%51 = phi i32 [ %43, %40 ], [ %16, %13 ]
%52 = phi i64 [ %35, %40 ], [ %19, %13 ]
%53 = phi i8* [ %46, %40 ], [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @check_TeX_parentheses.buffer, i64 0, i64 0), %13 ]
%54 = phi i8 [ %45, %40 ], [ %18, %13 ]
%55 = phi i32 [ %44, %40 ], [ %17, %13 ]
br label %21
56: ; preds = %30
%57 = icmp eq i8 %34, 92
%58 = select i1 %29, i1 true, i1 %57
br i1 %58, label %59, label %65
59: ; preds = %56
%60 = icmp eq i8 %36, 92
%61 = select i1 %60, i8 0, i8 %36
%62 = getelementptr inbounds i8, i8* %33, i64 1
%63 = add nsw i32 %31, 1
store i32 %63, i32* %3
%64 = icmp eq i64 %35, 0
br i1 %64, label %13, label %30
65: ; preds = %56
%66 = sext i8 %36 to i32
switch i32 %66, label %82 [
i32 37, label %67
i32 123, label %68
i32 125, label %75
]
67: ; preds = %65
br label %82
68: ; preds = %65
%69 = tail call i32 (...) @full()
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = tail call i32 @push(i32 %22, i32 %31)
br label %82
73: ; preds = %68
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.2, i64 0, i64 0))
br label %107
75: ; preds = %65
%76 = tail call i32 (...) @empty()
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = tail call i32 @pop(i32* null, i32* null)
br label %82
80: ; preds = %75
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 %24, i32 %31)
br label %107
82: ; preds = %65, %78, %71, %67
%83 = phi i32 [ %24, %65 ], [ %24, %78 ], [ %22, %71 ], [ %24, %67 ]
%84 = phi i32 [ 0, %65 ], [ 0, %78 ], [ 0, %71 ], [ 1, %67 ]
%85 = load i8, i8* %33
%86 = add nsw i32 %31, 1
store i32 %86, i32* %3
br label %40
87: ; preds = %13, %8
%88 = tail call i32 (...) @empty()
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %105
90: ; preds = %87
%91 = tail call i32 (...) @sp()
%92 = icmp sgt i32 %91, 1
%93 = select i1 %92, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0)
%94 = tail call i32 @puts(i8* dereferenceable(1) %93)
%95 = call i32 (...) @empty()
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %105
97: ; preds = %90, %97
%98 = call i32 (...) @sp()
%99 = call i32 @pop(i32* %2, i32* %3)
%100 = load i32, i32* %2
%101 = load i32, i32* %3
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %0, i32 %98, i32 %100, i32 %101)
%103 = call i32 (...) @empty()
%104 = icmp eq i32 %103, 0
br i1 %104, label %97, label %105
105: ; preds = %97, %90, %87
%106 = call i32 @fclose(i32* %6)
br label %109
107: ; preds = %80, %73
%108 = tail call i32 @fclose(i32* %6)
br label %109
109: ; preds = %107, %105, %11
%110 = phi i32 [ 0, %11 ], [ 0, %107 ], [ 1, %105 ]
ret i32 %110
}