#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 */

/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int ch;
  int loop = 0;
  int loops[0x10000] = {0};
  char lp = 0;
  char lastop = ' ';
  int op_cnt = 1;
  printf("; generated by bf2nasm, https://github.com/cjxgm/bf2nasm\n"
         "[global _start]\n"
         "\n"
         "[section .bss]\n"
         "mem:\tresb 300000\n"
         "\n"
         "[section .text]\n\n"
         "_start:\n"
         "\tmov\t\tedi, mem\n"
         "\tmov\t\tedx, 1\n\n");
  while ((ch = getchar()) != EOF) {
    if (ch == lastop)
      op_cnt++;
    else {
      switch (lastop) {
      case '+':
        if (op_cnt == 1)
          printf("\tinc\t\tbyte [edi]\n");
        else
          printf("\tadd\t\tbyte [edi], %d\n", op_cnt);
        break;
      case '-':
        if (op_cnt == 1)
          printf("\tdec\t\tbyte [edi]\n");
        else
          printf("\tsub\t\tbyte [edi], %d\n", op_cnt);
        break;
      case '>':
        if (op_cnt == 1)
          printf("\tinc\t\tedi\n");
        else
          printf("\tadd\t\tedi, %d\n", op_cnt);
        break;
      case '<':
        if (op_cnt == 1)
          printf("\tdec\t\tedi\n");
        else
          printf("\tsub\t\tedi, %d\n", op_cnt);
        break;
      case ',':
        while (op_cnt--)
          printf("\tmov\t\teax, 3\n"
                 "\tmov\t\tebx, 0\n"
                 "\tmov\t\tecx, edi\n"
                 "\tint\t\t80h\n");
        break;
      case '.':
        while (op_cnt--)
          printf("\tmov\t\teax, 4\n"
                 "\tmov\t\tebx, 1\n"
                 "\tmov\t\tecx, edi\n"
                 "\tint\t\t80h\n");
        break;
      case '[':
        while (op_cnt--) {
          loops[lp] = loop++;
          printf("s%d:\n", loops[lp]);
          printf("\tcmp\t\tbyte [edi], 0\n");
          printf("\tje\t\te%d\n", loops[lp]);
          lp++;
        }
        break;
      case ']':
        while (op_cnt--) {
          lp--;
          printf("\tjmp\t\ts%d\n", loops[lp]);
          printf("e%d:\n", loops[lp]);
        }
        break;
      default:
        break;
      }
      lastop = ch;
      op_cnt = 1;
    }
  }
  printf("\n\tmov\t\teax, 1\n");
  printf("\txor\t\tebx, ebx\n");
  printf("\tint\t\t80h\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x40010(%rbp),%rdi
xor    %esi,%esi
mov    $0x40000,%edx
call   1040 <memset@plt>
movb   $0x0,-0x40011(%rbp)
movb   $0x20,-0x40012(%rbp)
movl   $0x1,-0x40018(%rbp)
lea    0xf51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
je     146d <main+0x33d>
mov    -0x8(%rbp),%eax
movsbl -0x40012(%rbp),%ecx
cmp    %ecx,%eax
jne    11c1 <main+0x91>
mov    -0x40018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40018(%rbp)
jmp    1468 <main+0x338>
movsbl -0x40012(%rbp),%eax
add    $0xffffffd5,%eax
mov    %eax,%ecx
mov    %rcx,-0x40020(%rbp)
sub    $0x32,%eax
ja     1450 <main+0x320>
mov    -0x40020(%rbp),%rax
lea    0xe15(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x1,-0x40018(%rbp)
jne    1214 <main+0xe4>
lea    0xf66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1228 <main+0xf8>
mov    -0x40018(%rbp),%esi
lea    0xf5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1455 <main+0x325>
cmpl   $0x1,-0x40018(%rbp)
jne    124d <main+0x11d>
lea    0xf55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1261 <main+0x131>
mov    -0x40018(%rbp),%esi
lea    0xf4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1455 <main+0x325>
cmpl   $0x1,-0x40018(%rbp)
jne    1286 <main+0x156>
lea    0xf44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129a <main+0x16a>
mov    -0x40018(%rbp),%esi
lea    0xf36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1455 <main+0x325>
cmpl   $0x1,-0x40018(%rbp)
jne    12bf <main+0x18f>
lea    0xf25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d3 <main+0x1a3>
mov    -0x40018(%rbp),%esi
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1455 <main+0x325>
jmp    12dd <main+0x1ad>
mov    -0x40018(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40018(%rbp)
cmp    $0x0,%eax
je     130a <main+0x1da>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dd <main+0x1ad>
jmp    1455 <main+0x325>
jmp    1314 <main+0x1e4>
mov    -0x40018(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40018(%rbp)
cmp    $0x0,%eax
je     1341 <main+0x211>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1314 <main+0x1e4>
jmp    1455 <main+0x325>
jmp    134b <main+0x21b>
mov    -0x40018(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40018(%rbp)
cmp    $0x0,%eax
je     13da <main+0x2aa>
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbq -0x40011(%rbp),%rax
ff
mov    %ecx,-0x40010(%rbp,%rax,4)
movsbq -0x40011(%rbp),%rax
ff
mov    -0x40010(%rbp,%rax,4),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbq -0x40011(%rbp),%rax
ff
mov    -0x40010(%rbp,%rax,4),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40011(%rbp),%al
add    $0x1,%al
mov    %al,-0x40011(%rbp)
jmp    134b <main+0x21b>
jmp    1455 <main+0x325>
jmp    13e4 <main+0x2b4>
mov    -0x40018(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40018(%rbp)
cmp    $0x0,%eax
je     144b <main+0x31b>
mov    -0x40011(%rbp),%al
add    $0xff,%al
mov    %al,-0x40011(%rbp)
movsbq -0x40011(%rbp),%rax
ff
mov    -0x40010(%rbp,%rax,4),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbq -0x40011(%rbp),%rax
ff
mov    -0x40010(%rbp,%rax,4),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13e4 <main+0x2b4>
jmp    1455 <main+0x325>
jmp    1455 <main+0x325>
mov    -0x8(%rbp),%eax
mov    %al,-0x40012(%rbp)
movl   $0x1,-0x40018(%rbp)
jmp    1182 <main+0x52>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40018,%rsp
lea    0x10(%rsp),%rdi
mov    $0x40000,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xfce(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e6c(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    11b9 <main+0x79>
lea    0x1050(%rip),%rdi
call   1030 <puts@plt>
lea    0x1052(%rip),%rdi
call   1030 <puts@plt>
lea    0x1055(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r14d
mov    $0x20,%bl
mov    $0x1,%r15d
xor    %r13d,%r13d
movl   $0x0,0xc(%rsp)
jmp    11f3 <main+0xb3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r14d
cmp    0x0(%rbp),%eax
je     1181 <main+0x41>
movsbl %bl,%eax
cmp    %eax,%r14d
je     11e0 <main+0xa0>
add    $0xffffffd5,%eax
cmp    $0x32,%eax
ja     13ac <main+0x26c>
lea    0xdf2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
lea    0x102b(%rip),%rbx
lea    0xef3(%rip),%rbp
jmp    *%rax
cmp    $0x1,%r15d
jne    1380 <main+0x240>
lea    0x1069(%rip),%rdi
call   1030 <puts@plt>
jmp    13ac <main+0x26c>
test   %r15d,%r15d
je     13ac <main+0x26c>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%r15d
jne    1250 <main+0x110>
jmp    13ac <main+0x26c>
cmp    $0x1,%r15d
jne    1389 <main+0x249>
lea    0x101a(%rip),%rdi
call   1030 <puts@plt>
jmp    13ac <main+0x26c>
test   %r15d,%r15d
lea    0xf8c(%rip),%rbx
je     13ac <main+0x26c>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%r15d
jne    1290 <main+0x150>
jmp    13ac <main+0x26c>
cmp    $0x1,%r15d
jne    1392 <main+0x252>
lea    0xfd0(%rip),%rdi
call   1030 <puts@plt>
jmp    13ac <main+0x26c>
mov    0xc(%rsp),%eax
mov    %eax,%r12d
test   %r15d,%r15d
je     13ac <main+0x26c>
xchg   %ax,%ax
lea    0x1(%r12),%ebx
movsbq %r13b,%r13
mov    %r12d,0x10(%rsp,%r13,4)
mov    %rbp,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1e(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13b
mov    %ebx,0xc(%rsp)
mov    %ebx,%r12d
add    $0xffffffff,%r15d
jne    12d0 <main+0x190>
jmp    13ac <main+0x26c>
test   %r15d,%r15d
lea    0xdfe(%rip),%r12
lea    0xe02(%rip),%rbp
je     13ac <main+0x26c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xff,%r13b
movsbq %r13b,%rax
mov    0x10(%rsp,%rax,4),%ebx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%r15d
jne    1340 <main+0x200>
jmp    13ac <main+0x26c>
cmp    $0x1,%r15d
jne    139b <main+0x25b>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
jmp    13ac <main+0x26c>
lea    0xd45(%rip),%rdi
jmp    13a2 <main+0x262>
lea    0xd52(%rip),%rdi
jmp    13a2 <main+0x262>
lea    0xd5f(%rip),%rdi
jmp    13a2 <main+0x262>
lea    0xd65(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r15d
mov    %r14d,%ebx
mov    0x2c2c(%rip),%rbp
jmp    11e4 <main+0xa4>

LLVM IR (-O0):
@.str = [162 x i8] c"; generated by bf2nasm, https://github.com/cjxgm/bf2nasm\0A[global _start]\0A\0A[section .bss]\0Amem:\09resb 300000\0A\0A[section .text]\0A\0A_start:\0A\09mov\09\09edi, mem\0A\09mov\09\09edx, 1\0A\0A\00"
@EOF = global i32 0
@.str.1 = [18 x i8] c"\09inc\09\09byte [edi]\0A\00"
@.str.2 = [22 x i8] c"\09add\09\09byte [edi], %d\0A\00"
@.str.3 = [18 x i8] c"\09dec\09\09byte [edi]\0A\00"
@.str.4 = [22 x i8] c"\09sub\09\09byte [edi], %d\0A\00"
@.str.5 = [11 x i8] c"\09inc\09\09edi\0A\00"
@.str.6 = [15 x i8] c"\09add\09\09edi, %d\0A\00"
@.str.7 = [11 x i8] c"\09dec\09\09edi\0A\00"
@.str.8 = [15 x i8] c"\09sub\09\09edi, %d\0A\00"
@.str.9 = [52 x i8] c"\09mov\09\09eax, 3\0A\09mov\09\09ebx, 0\0A\09mov\09\09ecx, edi\0A\09int\09\0980h\0A\00"
@.str.10 = [52 x i8] c"\09mov\09\09eax, 4\0A\09mov\09\09ebx, 1\0A\09mov\09\09ecx, edi\0A\09int\09\0980h\0A\00"
@.str.11 = [6 x i8] c"s%d:\0A\00"
@.str.12 = [21 x i8] c"\09cmp\09\09byte [edi], 0\0A\00"
@.str.13 = [10 x i8] c"\09je\09\09e%d\0A\00"
@.str.14 = [11 x i8] c"\09jmp\09\09s%d\0A\00"
@.str.15 = [6 x i8] c"e%d:\0A\00"
@.str.16 = [15 x i8] c"\0A\09mov\09\09eax, 1\0A\00"
@.str.17 = [16 x i8] c"\09xor\09\09ebx, ebx\0A\00"
@.str.18 = [12 x i8] c"\09int\09\0980h\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [65536 x i32]
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%8 = bitcast [65536 x i32]* %4 to i8*
store i8 0, i8* %5
store i8 32, i8* %6
store i32 1, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %125, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %2
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %126
14: ; preds = %10
%15 = load i32, i32* %2
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %15, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %125
22: ; preds = %14
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
switch i32 %24, label %121 [
i32 43, label %25
i32 45, label %34
i32 62, label %43
i32 60, label %52
i32 44, label %61
i32 46, label %69
i32 91, label %77
i32 93, label %102
]
25: ; preds = %22
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %33
30: ; preds = %25
%31 = load i32, i32* %7
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %28
br label %122
34: ; preds = %22
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %42
39: ; preds = %34
%40 = load i32, i32* %7
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %37
br label %122
43: ; preds = %22
%44 = load i32, i32* %7
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %51
48: ; preds = %43
%49 = load i32, i32* %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %46
br label %122
52: ; preds = %22
%53 = load i32, i32* %7
%54 = icmp eq i32 %53, 1
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %60
57: ; preds = %52
%58 = load i32, i32* %7
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %57, %55
br label %122
61: ; preds = %22
br label %62
62: ; preds = %66, %61
%63 = load i32, i32* %7
%64 = add nsw i32 %63, -1
store i32 %64, i32* %7
%65 = icmp ne i32 %63, 0
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0))
br label %62
68: ; preds = %62
br label %122
69: ; preds = %22
br label %70
70: ; preds = %74, %69
%71 = load i32, i32* %7
%72 = add nsw i32 %71, -1
store i32 %72, i32* %7
%73 = icmp ne i32 %71, 0
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0))
br label %70
76: ; preds = %70
br label %122
77: ; preds = %22
br label %78
78: ; preds = %82, %77
%79 = load i32, i32* %7
%80 = add nsw i32 %79, -1
store i32 %80, i32* %7
%81 = icmp ne i32 %79, 0
br i1 %81, label %82, label %101
82: ; preds = %78
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
%85 = load i8, i8* %5
%86 = sext i8 %85 to i64
%87 = getelementptr inbounds [65536 x i32], [65536 x i32]* %4, i64 0, i64 %86
store i32 %83, i32* %87
%88 = load i8, i8* %5
%89 = sext i8 %88 to i64
%90 = getelementptr inbounds [65536 x i32], [65536 x i32]* %4, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%94 = load i8, i8* %5
%95 = sext i8 %94 to i64
%96 = getelementptr inbounds [65536 x i32], [65536 x i32]* %4, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %97)
%99 = load i8, i8* %5
%100 = add i8 %99, 1
store i8 %100, i8* %5
br label %78
101: ; preds = %78
br label %122
102: ; preds = %22
br label %103
103: ; preds = %107, %102
%104 = load i32, i32* %7
%105 = add nsw i32 %104, -1
store i32 %105, i32* %7
%106 = icmp ne i32 %104, 0
br i1 %106, label %107, label %120
107: ; preds = %103
%108 = load i8, i8* %5
%109 = add i8 %108, -1
store i8 %109, i8* %5
%110 = load i8, i8* %5
%111 = sext i8 %110 to i64
%112 = getelementptr inbounds [65536 x i32], [65536 x i32]* %4, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %113)
%115 = load i8, i8* %5
%116 = sext i8 %115 to i64
%117 = getelementptr inbounds [65536 x i32], [65536 x i32]* %4, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 %118)
br label %103
120: ; preds = %103
br label %122
121: ; preds = %22
br label %122
122: ; preds = %121, %120, %101, %76, %68, %60, %51, %42, %33
%123 = load i32, i32* %2
%124 = trunc i32 %123 to i8
store i8 %124, i8* %6
store i32 1, i32* %7
br label %125
125: ; preds = %122, %19
br label %10
126: ; preds = %10
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0))
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0))
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.2 = [22 x i8] c"\09add\09\09byte [edi], %d\0A\00"
@.str.4 = [22 x i8] c"\09sub\09\09byte [edi], %d\0A\00"
@.str.6 = [15 x i8] c"\09add\09\09edi, %d\0A\00"
@.str.8 = [15 x i8] c"\09sub\09\09edi, %d\0A\00"
@.str.11 = [6 x i8] c"s%d:\0A\00"
@.str.13 = [10 x i8] c"\09je\09\09e%d\0A\00"
@.str.14 = [11 x i8] c"\09jmp\09\09s%d\0A\00"
@.str.15 = [6 x i8] c"e%d:\0A\00"
@str = [161 x i8] c"; generated by bf2nasm, https://github.com/cjxgm/bf2nasm\0A[global _start]\0A\0A[section .bss]\0Amem:\09resb 300000\0A\0A[section .text]\0A\0A_start:\0A\09mov\09\09edi, mem\0A\09mov\09\09edx, 1\0A\00"
@str.19 = [14 x i8] c"\0A\09mov\09\09eax, 1\00"
@str.20 = [15 x i8] c"\09xor\09\09ebx, ebx\00"
@str.21 = [11 x i8] c"\09int\09\0980h\0A\00"
@str.22 = [20 x i8] c"\09cmp\09\09byte [edi], 0\00"
@str.23 = [51 x i8] c"\09mov\09\09eax, 4\0A\09mov\09\09ebx, 1\0A\09mov\09\09ecx, edi\0A\09int\09\0980h\00"
@str.24 = [51 x i8] c"\09mov\09\09eax, 3\0A\09mov\09\09ebx, 0\0A\09mov\09\09ecx, edi\0A\09int\09\0980h\00"
@str.25 = [10 x i8] c"\09dec\09\09edi\00"
@str.26 = [10 x i8] c"\09inc\09\09edi\00"
@str.27 = [17 x i8] c"\09dec\09\09byte [edi]\00"
@str.28 = [17 x i8] c"\09inc\09\09byte [edi]\00"
define i32 @main() {
%1 = alloca [65536 x i32]
%2 = bitcast [65536 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([161 x i8], [161 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %96, label %7
7: ; preds = %0, %88
%8 = phi i32 [ %93, %88 ], [ %4, %0 ]
%9 = phi i32 [ %92, %88 ], [ 1, %0 ]
%10 = phi i8 [ %91, %88 ], [ 32, %0 ]
%11 = phi i8 [ %90, %88 ], [ 0, %0 ]
%12 = phi i32 [ %89, %88 ], [ 0, %0 ]
%13 = sext i8 %10 to i32
%14 = icmp eq i32 %8, %13
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = add nsw i32 %9, 1
br label %88
17: ; preds = %7
switch i32 %13, label %84 [
i32 43, label %26
i32 45, label %32
i32 62, label %38
i32 60, label %44
i32 44, label %24
i32 46, label %22
i32 91, label %20
i32 93, label %18
]
18: ; preds = %17
%19 = icmp eq i32 %9, 0
br i1 %19, label %84, label %73
20: ; preds = %17
%21 = icmp eq i32 %9, 0
br i1 %21, label %84, label %60
22: ; preds = %17
%23 = icmp eq i32 %9, 0
br i1 %23, label %84, label %55
24: ; preds = %17
%25 = icmp eq i32 %9, 0
br i1 %25, label %84, label %50
26: ; preds = %17
%27 = icmp eq i32 %9, 1
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.28, i64 0, i64 0))
br label %84
30: ; preds = %26
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %84
32: ; preds = %17
%33 = icmp eq i32 %9, 1
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.27, i64 0, i64 0))
br label %84
36: ; preds = %32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %9)
br label %84
38: ; preds = %17
%39 = icmp eq i32 %9, 1
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.26, i64 0, i64 0))
br label %84
42: ; preds = %38
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %9)
br label %84
44: ; preds = %17
%45 = icmp eq i32 %9, 1
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.25, i64 0, i64 0))
br label %84
48: ; preds = %44
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %9)
br label %84
50: ; preds = %24, %50
%51 = phi i32 [ %52, %50 ], [ %9, %24 ]
%52 = add nsw i32 %51, -1
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.24, i64 0, i64 0))
%54 = icmp eq i32 %52, 0
br i1 %54, label %84, label %50
55: ; preds = %22, %55
%56 = phi i32 [ %57, %55 ], [ %9, %22 ]
%57 = add nsw i32 %56, -1
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.23, i64 0, i64 0))
%59 = icmp eq i32 %57, 0
br i1 %59, label %84, label %55
60: ; preds = %20, %60
%61 = phi i32 [ %64, %60 ], [ %9, %20 ]
%62 = phi i8 [ %71, %60 ], [ %11, %20 ]
%63 = phi i32 [ %65, %60 ], [ %12, %20 ]
%64 = add nsw i32 %61, -1
%65 = add nsw i32 %63, 1
%66 = sext i8 %62 to i64
%67 = getelementptr inbounds [65536 x i32], [65536 x i32]* %1, i64 0, i64 %66
store i32 %63, i32* %67
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %63)
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.22, i64 0, i64 0))
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %63)
%71 = add i8 %62, 1
%72 = icmp eq i32 %64, 0
br i1 %72, label %84, label %60
73: ; preds = %18, %73
%74 = phi i32 [ %76, %73 ], [ %9, %18 ]
%75 = phi i8 [ %77, %73 ], [ %11, %18 ]
%76 = add nsw i32 %74, -1
%77 = add i8 %75, -1
%78 = sext i8 %77 to i64
%79 = getelementptr inbounds [65536 x i32], [65536 x i32]* %1, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %80)
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 %80)
%83 = icmp eq i32 %76, 0
br i1 %83, label %84, label %73
84: ; preds = %73, %60, %55, %50, %18, %20, %22, %24, %17, %46, %48, %40, %42, %34, %36, %28, %30
%85 = phi i32 [ %12, %17 ], [ %12, %46 ], [ %12, %48 ], [ %12, %40 ], [ %12, %42 ], [ %12, %34 ], [ %12, %36 ], [ %12, %28 ], [ %12, %30 ], [ %12, %24 ], [ %12, %22 ], [ %12, %20 ], [ %12, %18 ], [ %12, %50 ], [ %12, %55 ], [ %65, %60 ], [ %12, %73 ]
%86 = phi i8 [ %11, %17 ], [ %11, %46 ], [ %11, %48 ], [ %11, %40 ], [ %11, %42 ], [ %11, %34 ], [ %11, %36 ], [ %11, %28 ], [ %11, %30 ], [ %11, %24 ], [ %11, %22 ], [ %11, %20 ], [ %11, %18 ], [ %11, %50 ], [ %11, %55 ], [ %71, %60 ], [ %77, %73 ]
%87 = trunc i32 %8 to i8
br label %88
88: ; preds = %84, %15
%89 = phi i32 [ %12, %15 ], [ %85, %84 ]
%90 = phi i8 [ %11, %15 ], [ %86, %84 ]
%91 = phi i8 [ %10, %15 ], [ %87, %84 ]
%92 = phi i32 [ %16, %15 ], [ 1, %84 ]
%93 = tail call i32 (...) @getchar()
%94 = load i32, i32* @EOF
%95 = icmp eq i32 %93, %94
br i1 %95, label %96, label %7
96: ; preds = %88, %0
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.19, i64 0, i64 0))
%98 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
%99 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.21, i64 0, i64 0))
ret i32 0
}