#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strrepeat(char *, char *, int);
int main(int argc, char *argv[]) {
  int i = 0, rc = 0, bf_size = 0, c_size = 0, counter = 0, depth = 0;
  int plus = 0, minus = 0, right = 0, left = 0, dot = 0;
  char *bf_program = NULL, *bf_data = NULL, *bf_chars = NULL, *c_program = NULL;
  char output[30000] = "", line[300] = "";
  char indent1[30] = "", indent2[30] = "", pattern[60] = "";
  FILE *bf = NULL;
  FILE *c = NULL;
  if (argc < 2) {
    printf("bf2c (v%s)\n\nUsage: bf2c <program.bf> [<output.c>]\n", "1.0.1");
    rc = 1;
    goto cleanup;
  }
  bf_program = argv[1];
  bf = fopen(bf_program, "r");
  if (!bf) {
    printf("Could not open %s\n", bf_program);
    rc = 1;
    goto cleanup;
  }
  fseek(bf, 0, SEEK_END);
  bf_size = ftell(bf);
  fseek(bf, 0, SEEK_SET);
  if (!bf_size || bf_size == 0) {
    printf("%s is empty\n", bf_program);
    rc = 1;
    goto cleanup;
  }
  bf_data = malloc(sizeof(char) * bf_size);
  if (fread(bf_data, 1, bf_size, bf) != bf_size) {
    printf("Could not read %s\n", bf_program);
    rc = 1;
    goto cleanup;
  }
  bf_chars = malloc(sizeof(char) * bf_size);
  for (i = 0, counter = 0; i < bf_size; i++) {
    switch (bf_data[i]) {
    case ']':
    case '[':
    case '+':
    case '-':
    case '>':
    case '<':
    case '.':
    case ',':
      bf_chars[counter++] = bf_data[i];
    default:
      break;
    }
  }
  bf_size = counter;
  strcpy(output, "#include <stdio.h>\n\nint main() {\n\tint c = 0, i = 0;\n");
  strcat(output, "\tstatic int b[30000];\n\n");
  for (i = 0; i < bf_size; i++) {
    switch (bf_chars[i]) {
    case ']':
      depth--;
      strrepeat(output, "\t", depth);
      strcat(output, "\t}\n\n");
      break;
    case '[':
      strcat(output, "\n");
      strrepeat(output, "\t", depth);
      strcat(output, "\twhile(b[c] != 0) {\n");
      depth++;
      break;
    case '+':
      if (i + 1 < bf_size && bf_chars[i + 1] == '+') {
        plus++;
      } else {
        strrepeat(output, "\t", depth);
        if (plus > 0) {
          sprintf(line, "\tb[c] += %d;\n", ++plus);
          strcat(output, line);
          plus = 0;
        } else {
          strcat(output, "\t++b[c];\n");
        }
      }
      break;
    case '-':
      if (i + 1 < bf_size && bf_chars[i + 1] == '-') {
        minus++;
      } else {
        strrepeat(output, "\t", depth);
        if (minus > 0) {
          sprintf(line, "\tb[c] -= %d;\n", ++minus);
          strcat(output, line);
          minus = 0;
        } else {
          strcat(output, "\t--b[c];\n");
        }
      }
      break;
    case '>':
      if (i + 1 < bf_size && bf_chars[i + 1] == '>') {
        right++;
      } else {
        strrepeat(output, "\t", depth);
        if (right > 0) {
          sprintf(line, "\tc += %d;\n", ++right);
          strcat(output, line);
          right = 0;
        } else {
          strcat(output, "\t++c;\n");
        }
      }
      break;
    case '<':
      if (i + 1 < bf_size && bf_chars[i + 1] == '<') {
        left++;
      } else {
        strrepeat(output, "\t", depth);
        if (left > 0) {
          sprintf(line, "\tc -= %d;\n", ++left);
          strcat(output, line);
          left = 0;
        } else {
          strcat(output, "\t--c;\n");
        }
      }
      break;
    case '.':
      indent1[0] = '\0';
      indent2[0] = '\0';
      if (i + 1 < bf_size && bf_chars[i + 1] == '.') {
        dot++;
      } else {
        strrepeat(output, "\t", depth);
        if (dot > 0) {
          strrepeat(indent1, "\t", depth + 1);
          strrepeat(indent2, "\t", depth);
          strcpy(pattern, "\n\tfor (i = 0; i < %d; i++) {");
          strcat(pattern, "\n%s\tputchar(b[c]);\n%s\t}\n\n");
          sprintf(line, pattern, ++dot, indent1, indent2);
          strcat(output, line);
          dot = 0;
        } else {
          strcat(output, "\tputchar(b[c]);\n");
        }
      }
      break;
    case ',':
      strrepeat(output, "\t", depth);
      strcat(output, "\tb[c] = getchar();\n");
      break;
    default:
      break;
    }
  }
  strcat(output, "\n\treturn 0;\n");
  strcat(output, "}");
  if (argc < 3) {
    printf("%s\n", output);
    rc = 0;
    goto cleanup;
  }
  c_program = argv[2];
  c = fopen(c_program, "w+");
  if (!c) {
    printf("Could not open %s\n", c_program);
    rc = 1;
    goto cleanup;
  }
  c_size = strlen(output);
  if (fwrite(output, 1, c_size, c) != c_size) {
    printf("Could not write to %s\n", c_program);
    rc = 1;
    goto cleanup;
  }
cleanup:
  if (bf) {
    fclose(bf);
  }
  if (c) {
    fclose(c);
  }
  if (bf_data) {
    free(bf_data);
  }
  if (bf_chars) {
    free(bf_chars);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7760,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
lea    -0x7590(%rbp),%rdi
xor    %esi,%esi
mov    $0x7530,%edx
call   1090 <memset@plt>
lea    -0x76c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1090 <memset@plt>
lea    -0x76e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1090 <memset@plt>
lea    -0x7700(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1090 <memset@plt>
lea    -0x7740(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1090 <memset@plt>
movq   $0x0,-0x7748(%rbp)
movq   $0x0,-0x7750(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1314 <main+0x124>
lea    0xdd0(%rip),%rdi
lea    0xdfc(%rip),%rsi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x7748(%rbp)
cmpq   $0x0,-0x7748(%rbp)
jne    1361 <main+0x171>
mov    -0x48(%rbp),%rsi
lea    0xdb7(%rip),%rdi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
mov    -0x7748(%rbp),%rdi
mov    0x2c79(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    -0x7748(%rbp),%rdi
call   10a0 <ftell@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x7748(%rbp),%rdi
mov    0x2c43(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10d0 <fseek@plt>
cmpl   $0x0,-0x1c(%rbp)
je     13b2 <main+0x1c2>
cmpl   $0x0,-0x1c(%rbp)
jne    13ce <main+0x1de>
mov    -0x48(%rbp),%rsi
lea    0xd5d(%rip),%rdi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
movslq -0x1c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x7748(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fread@plt>
cmp    -0x1c(%rbp),%eax
je     141e <main+0x22e>
mov    -0x48(%rbp),%rsi
lea    0xd1a(%rip),%rdi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
movslq -0x1c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14f6 <main+0x306>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x7754(%rbp)
add    $0xffffffd5,%eax
sub    $0x4,%eax
jb     14be <main+0x2ce>
jmp    146e <main+0x27e>
mov    -0x7754(%rbp),%eax
sub    $0x3c,%eax
je     14be <main+0x2ce>
jmp    1482 <main+0x292>
mov    -0x7754(%rbp),%eax
sub    $0x3e,%eax
je     14be <main+0x2ce>
jmp    1496 <main+0x2a6>
mov    -0x7754(%rbp),%eax
sub    $0x5b,%eax
je     14be <main+0x2ce>
jmp    14aa <main+0x2ba>
mov    -0x7754(%rbp),%eax
sub    $0x5d,%eax
jne    14de <main+0x2ee>
jmp    14be <main+0x2ce>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x58(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    14e3 <main+0x2f3>
jmp    14e8 <main+0x2f8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    143f <main+0x24f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x7590(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x7590(%rbp),%rdi
lea    0xc52(%rip),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1a1a <main+0x82a>
mov    -0x58(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffd5,%eax
mov    %eax,%ecx
mov    %rcx,-0x7760(%rbp)
sub    $0x32,%eax
ja     1a02 <main+0x812>
mov    -0x7760(%rbp),%rax
lea    0xa9c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xc00(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    -0x7590(%rbp),%rdi
lea    0xc8a(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1a07 <main+0x817>
lea    -0x7590(%rbp),%rdi
lea    0xbd3(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xbbf(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    -0x7590(%rbp),%rdi
lea    0xbae(%rip),%rsi
call   10f0 <strcat@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1a07 <main+0x817>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    1625 <main+0x435>
mov    -0x58(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
jne    1625 <main+0x435>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    169a <main+0x4aa>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xb51(%rip),%rsi
call   10c0 <strrepeat@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1682 <main+0x492>
lea    -0x76c0(%rbp),%rdi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
lea    0xb42(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x7590(%rbp),%rdi
lea    -0x76c0(%rbp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x2c(%rbp)
jmp    1695 <main+0x4a5>
lea    -0x7590(%rbp),%rdi
lea    0xb1c(%rip),%rsi
call   10f0 <strcat@plt>
jmp    169a <main+0x4aa>
jmp    1a07 <main+0x817>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    16d6 <main+0x4e6>
mov    -0x58(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    16d6 <main+0x4e6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    174b <main+0x55b>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xaa0(%rip),%rsi
call   10c0 <strrepeat@plt>
cmpl   $0x0,-0x30(%rbp)
jle    1733 <main+0x543>
lea    -0x76c0(%rbp),%rdi
mov    -0x30(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x30(%rbp)
lea    0xaa9(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x7590(%rbp),%rdi
lea    -0x76c0(%rbp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x30(%rbp)
jmp    1746 <main+0x556>
lea    -0x7590(%rbp),%rdi
lea    0xa83(%rip),%rsi
call   10f0 <strcat@plt>
jmp    174b <main+0x55b>
jmp    1a07 <main+0x817>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    1787 <main+0x597>
mov    -0x58(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3e,%eax
jne    1787 <main+0x597>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    17fc <main+0x60c>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0x9ef(%rip),%rsi
call   10c0 <strrepeat@plt>
cmpl   $0x0,-0x34(%rbp)
jle    17e4 <main+0x5f4>
lea    -0x76c0(%rbp),%rdi
mov    -0x34(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x34(%rbp)
lea    0xa10(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x7590(%rbp),%rdi
lea    -0x76c0(%rbp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x34(%rbp)
jmp    17f7 <main+0x607>
lea    -0x7590(%rbp),%rdi
lea    0x9e7(%rip),%rsi
call   10f0 <strcat@plt>
jmp    17fc <main+0x60c>
jmp    1a07 <main+0x817>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    1838 <main+0x648>
mov    -0x58(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3c,%eax
jne    1838 <main+0x648>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    18ad <main+0x6bd>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0x93e(%rip),%rsi
call   10c0 <strrepeat@plt>
cmpl   $0x0,-0x38(%rbp)
jle    1895 <main+0x6a5>
lea    -0x76c0(%rbp),%rdi
mov    -0x38(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x38(%rbp)
lea    0x971(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x7590(%rbp),%rdi
lea    -0x76c0(%rbp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x38(%rbp)
jmp    18a8 <main+0x6b8>
lea    -0x7590(%rbp),%rdi
lea    0x948(%rip),%rsi
call   10f0 <strcat@plt>
jmp    18ad <main+0x6bd>
jmp    1a07 <main+0x817>
movb   $0x0,-0x76e0(%rbp)
movb   $0x0,-0x7700(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0x1c(%rbp),%eax
jge    18f7 <main+0x707>
mov    -0x58(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    18f7 <main+0x707>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    19cf <main+0x7df>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0x87f(%rip),%rsi
call   10c0 <strrepeat@plt>
cmpl   $0x0,-0x3c(%rbp)
jle    19b7 <main+0x7c7>
lea    -0x76e0(%rbp),%rdi
mov    -0x28(%rbp),%edx
add    $0x1,%edx
lea    0x85c(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    -0x7700(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0x846(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    -0x7740(%rbp),%rdi
lea    0x89e(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x7740(%rbp),%rdi
lea    0x8a8(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x76c0(%rbp),%rdi
lea    -0x7740(%rbp),%rsi
mov    -0x3c(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x3c(%rbp)
lea    -0x76e0(%rbp),%rcx
lea    -0x7700(%rbp),%r8
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x7590(%rbp),%rdi
lea    -0x76c0(%rbp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,-0x3c(%rbp)
jmp    19ca <main+0x7da>
lea    -0x7590(%rbp),%rdi
lea    0x864(%rip),%rsi
call   10f0 <strcat@plt>
jmp    19cf <main+0x7df>
jmp    1a07 <main+0x817>
lea    -0x7590(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0x7a2(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    -0x7590(%rbp),%rdi
lea    0x842(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1a07 <main+0x817>
jmp    1a07 <main+0x817>
jmp    1a0c <main+0x81c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1529 <main+0x339>
lea    -0x7590(%rbp),%rdi
lea    0x826(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x7590(%rbp),%rdi
lea    0x820(%rip),%rsi
call   10f0 <strcat@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1a69 <main+0x879>
lea    -0x7590(%rbp),%rsi
lea    0x6de(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x18(%rbp)
jmp    1b0a <main+0x91a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    0x7dd(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x7750(%rbp)
cmpq   $0x0,-0x7750(%rbp)
jne    1ab6 <main+0x8c6>
mov    -0x60(%rbp),%rsi
lea    0x662(%rip),%rdi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
lea    -0x7590(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x20(%rbp)
lea    -0x7590(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x7750(%rbp),%rcx
mov    $0x1,%esi
call   1110 <fwrite@plt>
cmp    -0x20(%rbp),%eax
je     1b05 <main+0x915>
mov    -0x60(%rbp),%rsi
lea    0x76c(%rip),%rdi
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    1b0a <main+0x91a>
jmp    1b0a <main+0x91a>
cmpq   $0x0,-0x7748(%rbp)
je     1b24 <main+0x934>
mov    -0x7748(%rbp),%rdi
call   1060 <fclose@plt>
cmpq   $0x0,-0x7750(%rbp)
je     1b3e <main+0x94e>
mov    -0x7750(%rbp),%rdi
call   1060 <fclose@plt>
cmpq   $0x0,-0x50(%rbp)
je     1b52 <main+0x962>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x58(%rbp)
je     1b66 <main+0x976>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x7760,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7728,%rsp
mov    %rsi,%r12
mov    %edi,%ebx
lea    0x1f0(%rsp),%rdi
mov    $0x7530,%edx
xor    %esi,%esi
call   1090 <memset@plt>
lea    0xc0(%rsp),%rdi
mov    $0x12c,%edx
xor    %esi,%esi
call   1090 <memset@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x6e(%rsp)
movaps %xmm0,0x60(%rsp)
movups %xmm0,0x4e(%rsp)
movaps %xmm0,0x40(%rsp)
movups %xmm0,0xac(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
cmp    $0x1,%ebx
jg     1282 <main+0x92>
lea    0xe5b(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1080 <printf@plt>
jmp    18f5 <main+0x705>
mov    0x8(%r12),%r13
lea    0xe77(%rip),%rsi
mov    %r13,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     135e <main+0x16e>
mov    %rax,%r14
mov    0x2d3f(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %r14,%rdi
call   10a0 <ftell@plt>
mov    %eax,%ebp
mov    0x2d12(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
test   %ebp,%ebp
je     1372 <main+0x182>
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    %ebp,%eax
jne    138f <main+0x19f>
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
test   %ebp,%ebp
mov    %r14,0x30(%rsp)
mov    %r12,0x38(%rsp)
mov    %ebx,0x2c(%rsp)
jle    13a9 <main+0x1b9>
mov    %ebp,%r8d
cmp    $0x1,%ebp
jne    1909 <main+0x719>
xor    %ecx,%ecx
xor    %ebp,%ebp
test   $0x1,%r8b
je     13ab <main+0x1bb>
movsbl (%r15,%rcx,1),%eax
lea    -0x2b(%rax),%ecx
cmp    $0x32,%ecx
ja     13ab <main+0x1bb>
movabs $0x50000000a000f,%rdx
bt     %rcx,%rdx
jae    13ab <main+0x1bb>
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,0x0(%r13,%rcx,1)
jmp    13ab <main+0x1bb>
lea    0xda2(%rip),%rdi
mov    %r13,%rsi
call   1080 <printf@plt>
jmp    18f5 <main+0x705>
lea    0xda1(%rip),%rdi
mov    %r13,%rsi
call   1080 <printf@plt>
xor    %r15d,%r15d
mov    %r14,%rbp
xor    %r13d,%r13d
jmp    18d3 <main+0x6e3>
lea    0xd91(%rip),%rdi
mov    %r13,%rsi
call   1080 <printf@plt>
xor    %r13d,%r13d
mov    %r14,%rbp
jmp    18d3 <main+0x6e3>
xor    %ebp,%ebp
lea    0xd88(%rip),%rsi
lea    0x1f0(%rsp),%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xda6(%rip),%rsi
mov    %r14,%rdi
call   10f0 <strcat@plt>
test   %ebp,%ebp
jle    1821 <main+0x631>
mov    %ebp,%ebp
mov    %rbp,0x20(%rsp)
neg    %rbp
movl   $0x0,0x1c(%rsp)
mov    $0x1,%r14d
lea    0x1f0(%rsp),%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x18(%rsp)
xor    %r12d,%r12d
jmp    1467 <main+0x277>
lea    0x1f0(%rsp),%rdi
lea    0xd5a(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
lea    0x1f0(%rsp),%rdi
lea    0xdf6(%rip),%rsi
call   10f0 <strcat@plt>
lea    0x1f0(%rsp),%rbx
lea    (%r14,%rbp,1),%rax
add    $0x1,%rax
add    $0x1,%r14
cmp    $0x1,%rax
je     1821 <main+0x631>
movsbl -0x1(%r13,%r14,1),%eax
add    $0xffffffd5,%eax
cmp    $0x32,%eax
ja     1451 <main+0x261>
lea    0xb84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmp    0x20(%rsp),%r14
jae    15ad <main+0x3bd>
cmpb   $0x2b,0x0(%r13,%r14,1)
jne    15ad <main+0x3bd>
addl   $0x1,0x18(%rsp)
jmp    1451 <main+0x261>
cmp    0x20(%rsp),%r14
jae    15de <main+0x3ee>
cmpb   $0x2d,0x0(%r13,%r14,1)
jne    15de <main+0x3ee>
addl   $0x1,0x14(%rsp)
jmp    1451 <main+0x261>
movb   $0x0,0x60(%rsp)
movb   $0x0,0x40(%rsp)
cmp    0x20(%rsp),%r14
jae    160f <main+0x41f>
cmpb   $0x2e,0x0(%r13,%r14,1)
jne    160f <main+0x41f>
addl   $0x1,0x1c(%rsp)
jmp    1451 <main+0x261>
cmp    0x20(%rsp),%r14
jae    1640 <main+0x450>
cmpb   $0x3c,0x0(%r13,%r14,1)
jne    1640 <main+0x450>
addl   $0x1,0xc(%rsp)
jmp    1451 <main+0x261>
cmp    0x20(%rsp),%r14
jae    1671 <main+0x481>
cmpb   $0x3e,0x0(%r13,%r14,1)
jne    1671 <main+0x481>
addl   $0x1,0x10(%rsp)
jmp    1451 <main+0x261>
lea    0x1f0(%rsp),%rdi
lea    0xc48(%rip),%rsi
call   10f0 <strcat@plt>
lea    0x1f0(%rsp),%rdi
lea    0xc36(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
lea    0x1f0(%rsp),%rdi
lea    0xc21(%rip),%rsi
call   10f0 <strcat@plt>
lea    0x1f0(%rsp),%rbx
add    $0x1,%r12d
jmp    1451 <main+0x261>
add    $0xffffffff,%r12d
lea    0x1f0(%rsp),%rdi
lea    0xbf6(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
lea    0x1f0(%rsp),%rdi
lea    0xc7c(%rip),%rsi
jmp    1444 <main+0x254>
mov    %rbx,%rdi
lea    0xbd0(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
cmpl   $0x0,0x18(%rsp)
jg     16a2 <main+0x4b2>
mov    %rbx,%rdi
lea    0xbd8(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1451 <main+0x261>
mov    %rbx,%rdi
lea    0xb9f(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
cmpl   $0x0,0x14(%rsp)
jg     16dc <main+0x4ec>
mov    %rbx,%rdi
lea    0xbbf(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1451 <main+0x261>
mov    %rbx,%rdi
lea    0xb6e(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
cmpl   $0x0,0x1c(%rsp)
jg     1716 <main+0x526>
mov    %rbx,%rdi
lea    0xbf3(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1451 <main+0x261>
mov    %rbx,%rdi
lea    0xb3d(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
cmpl   $0x0,0xc(%rsp)
jg     17ad <main+0x5bd>
mov    %rbx,%rdi
lea    0xb84(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1451 <main+0x261>
mov    %rbx,%rdi
lea    0xb0c(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
cmpl   $0x0,0x10(%rsp)
jg     17e7 <main+0x5f7>
mov    %rbx,%rdi
lea    0xb41(%rip),%rsi
call   10f0 <strcat@plt>
jmp    1451 <main+0x261>
mov    0x18(%rsp),%edx
add    $0x1,%edx
lea    0xc0(%rsp),%rdi
lea    0xae6(%rip),%rsi
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc0(%rsp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,0x18(%rsp)
jmp    1451 <main+0x261>
mov    0x14(%rsp),%edx
add    $0x1,%edx
lea    0xc0(%rsp),%rdi
lea    0xac4(%rip),%rsi
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc0(%rsp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,0x14(%rsp)
jmp    1451 <main+0x261>
lea    0x1(%r12),%edx
lea    0x60(%rsp),%rdi
lea    0xa60(%rip),%rsi
call   10c0 <strrepeat@plt>
lea    0x40(%rsp),%rdi
lea    0xa4f(%rip),%rsi
mov    %r12d,%edx
call   10c0 <strrepeat@plt>
lea    0x80(%rsp),%rdi
lea    0xaa3(%rip),%rsi
call   1040 <strcpy@plt>
lea    0x80(%rsp),%rdi
lea    0xaac(%rip),%rsi
call   10f0 <strcat@plt>
mov    0x1c(%rsp),%edx
add    $0x1,%edx
lea    0xc0(%rsp),%rdi
lea    0x80(%rsp),%rsi
lea    0x60(%rsp),%rcx
lea    0x40(%rsp),%r8
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc0(%rsp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,0x1c(%rsp)
jmp    1451 <main+0x261>
mov    0xc(%rsp),%edx
add    $0x1,%edx
lea    0xc0(%rsp),%rdi
lea    0xa1d(%rip),%rsi
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc0(%rsp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,0xc(%rsp)
jmp    1451 <main+0x261>
mov    0x10(%rsp),%edx
add    $0x1,%edx
lea    0xc0(%rsp),%rdi
lea    0x9d1(%rip),%rsi
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc0(%rsp),%rsi
call   10f0 <strcat@plt>
movl   $0x0,0x10(%rsp)
jmp    1451 <main+0x261>
lea    0xa26(%rip),%rsi
lea    0x1f0(%rsp),%rbp
mov    %rbp,%rdi
call   10f0 <strcat@plt>
lea    0xa1c(%rip),%rsi
mov    %rbp,%rdi
call   10f0 <strcat@plt>
cmpl   $0x2,0x2c(%rsp)
jg     1869 <main+0x679>
lea    0x8e1(%rip),%rdi
lea    0x1f0(%rsp),%rsi
call   1080 <printf@plt>
mov    0x30(%rsp),%rbp
jmp    18d3 <main+0x6e3>
mov    0x38(%rsp),%rax
mov    0x10(%rax),%r12
lea    0x9e4(%rip),%rsi
mov    %r12,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
mov    0x30(%rsp),%r14
je     196c <main+0x77c>
mov    %rax,%rbp
lea    0x1f0(%rsp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ebx
lea    0x1f0(%rsp),%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %rbp,%rcx
call   1110 <fwrite@plt>
cmp    %ebx,%eax
je     18cb <main+0x6db>
lea    0x99d(%rip),%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
test   %r15,%r15
je     18e8 <main+0x6f8>
mov    %r15,%rdi
call   1030 <free@plt>
test   %r13,%r13
je     18f5 <main+0x705>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x7728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8d,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
movabs $0x50000000a000f,%rsi
xor    %ebp,%ebp
jmp    192d <main+0x73d>
nop
add    $0x2,%rcx
cmp    %rcx,%rdx
je     132e <main+0x13e>
movsbl (%r15,%rcx,1),%edi
lea    -0x2b(%rdi),%eax
cmp    $0x32,%eax
ja     194b <main+0x75b>
bt     %rax,%rsi
jae    194b <main+0x75b>
movslq %ebp,%rax
add    $0x1,%ebp
mov    %dil,0x0(%r13,%rax,1)
movsbl 0x1(%r15,%rcx,1),%edi
lea    -0x2b(%rdi),%eax
cmp    $0x32,%eax
ja     1920 <main+0x730>
bt     %rax,%rsi
jae    1920 <main+0x730>
movslq %ebp,%rax
add    $0x1,%ebp
mov    %dil,0x0(%r13,%rax,1)
jmp    1920 <main+0x730>
lea    0x794(%rip),%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
jmp    13a1 <main+0x1b1>

LLVM IR (-O0):
@.str = [51 x i8] c"bf2c (v%s)\0A\0AUsage: bf2c <program.bf> [<output.c>]\0A\00"
@.str.1 = [6 x i8] c"1.0.1\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"Could not open %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [13 x i8] c"%s is empty\0A\00"
@.str.5 = [19 x i8] c"Could not read %s\0A\00"
@.str.6 = [53 x i8] c"#include <stdio.h>\0A\0Aint main() {\0A\09int c = 0, i = 0;\0A\00"
@.str.7 = [24 x i8] c"\09static int b[30000];\0A\0A\00"
@.str.8 = [2 x i8] c"\09\00"
@.str.9 = [5 x i8] c"\09}\0A\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [21 x i8] c"\09while(b[c] != 0) {\0A\00"
@.str.12 = [14 x i8] c"\09b[c] += %d;\0A\00"
@.str.13 = [10 x i8] c"\09++b[c];\0A\00"
@.str.14 = [14 x i8] c"\09b[c] -= %d;\0A\00"
@.str.15 = [10 x i8] c"\09--b[c];\0A\00"
@.str.16 = [11 x i8] c"\09c += %d;\0A\00"
@.str.17 = [7 x i8] c"\09++c;\0A\00"
@.str.18 = [11 x i8] c"\09c -= %d;\0A\00"
@.str.19 = [7 x i8] c"\09--c;\0A\00"
@.str.20 = [29 x i8] c"\0A\09for (i = 0; i < %d; i++) {\00"
@.str.21 = [26 x i8] c"\0A%s\09putchar(b[c]);\0A%s\09}\0A\0A\00"
@.str.22 = [17 x i8] c"\09putchar(b[c]);\0A\00"
@.str.23 = [20 x i8] c"\09b[c] = getchar();\0A\00"
@.str.24 = [13 x i8] c"\0A\09return 0;\0A\00"
@.str.25 = [2 x i8] c"}\00"
@.str.26 = [4 x i8] c"%s\0A\00"
@.str.27 = [3 x i8] c"w+\00"
@.str.28 = [23 x i8] c"Could not write to %s\0A\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 i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca [30000 x i8]
%22 = alloca [300 x i8]
%23 = alloca [30 x i8]
%24 = alloca [30 x i8]
%25 = alloca [60 x i8]
%26 = alloca i32*
%27 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
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
store i8* null, i8** %17
store i8* null, i8** %18
store i8* null, i8** %19
store i8* null, i8** %20
%28 = bitcast [30000 x i8]* %21 to i8*
%29 = bitcast [300 x i8]* %22 to i8*
%30 = bitcast [30 x i8]* %23 to i8*
%31 = bitcast [30 x i8]* %24 to i8*
%32 = bitcast [60 x i8]* %25 to i8*
store i32* null, i32** %26
store i32* null, i32** %27
%33 = load i32, i32* %4
%34 = icmp slt i32 %33, 2
br i1 %34, label %35, label %37
35: ; preds = %2
%36 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %7
br label %389
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
store i8* %40, i8** %17
%41 = load i8*, i8** %17
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %42, i32** %26
%43 = load i32*, i32** %26
%44 = icmp ne i32* %43, null
br i1 %44, label %48, label %45
45: ; preds = %37
%46 = load i8*, i8** %17
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %46)
store i32 1, i32* %7
br label %389
48: ; preds = %37
%49 = load i32*, i32** %26
%50 = load i32, i32* @SEEK_END
%51 = call i32 @fseek(i32* %49, i32 0, i32 %50)
%52 = load i32*, i32** %26
%53 = call i32 @ftell(i32* %52)
store i32 %53, i32* %8
%54 = load i32*, i32** %26
%55 = load i32, i32* @SEEK_SET
%56 = call i32 @fseek(i32* %54, i32 0, i32 %55)
%57 = load i32, i32* %8
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %48
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %59, %48
%63 = load i8*, i8** %17
%64 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %63)
store i32 1, i32* %7
br label %389
65: ; preds = %59
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = mul i64 1, %67
%69 = trunc i64 %68 to i32
%70 = call i8* @malloc(i32 %69)
store i8* %70, i8** %18
%71 = load i8*, i8** %18
%72 = load i32, i32* %8
%73 = load i32*, i32** %26
%74 = call i32 @fread(i8* %71, i32 1, i32 %72, i32* %73)
%75 = load i32, i32* %8
%76 = icmp ne i32 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %65
%78 = load i8*, i8** %17
%79 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %78)
store i32 1, i32* %7
br label %389
80: ; preds = %65
%81 = load i32, i32* %8
%82 = sext i32 %81 to i64
%83 = mul i64 1, %82
%84 = trunc i64 %83 to i32
%85 = call i8* @malloc(i32 %84)
store i8* %85, i8** %19
store i32 0, i32* %6
store i32 0, i32* %10
br label %86
86: ; preds = %110, %80
%87 = load i32, i32* %6
%88 = load i32, i32* %8
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %113
90: ; preds = %86
%91 = load i8*, i8** %18
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
switch i32 %96, label %108 [
i32 93, label %97
i32 91, label %97
i32 43, label %97
i32 45, label %97
i32 62, label %97
i32 60, label %97
i32 46, label %97
i32 44, label %97
]
97: ; preds = %90, %90, %90, %90, %90, %90, %90, %90
%98 = load i8*, i8** %18
%99 = load i32, i32* %6
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %98, i64 %100
%102 = load i8, i8* %101
%103 = load i8*, i8** %19
%104 = load i32, i32* %10
%105 = add nsw i32 %104, 1
store i32 %105, i32* %10
%106 = sext i32 %104 to i64
%107 = getelementptr inbounds i8, i8* %103, i64 %106
store i8 %102, i8* %107
br label %108
108: ; preds = %90, %97
br label %109
109: ; preds = %108
br label %110
110: ; preds = %109
%111 = load i32, i32* %6
%112 = add nsw i32 %111, 1
store i32 %112, i32* %6
br label %86
113: ; preds = %86
%114 = load i32, i32* %10
store i32 %114, i32* %8
%115 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%116 = call i32 @strcpy(i8* %115, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0))
%117 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%118 = call i32 @strcat(i8* %117, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %6
br label %119
119: ; preds = %352, %113
%120 = load i32, i32* %6
%121 = load i32, i32* %8
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %355
123: ; preds = %119
%124 = load i8*, i8** %19
%125 = load i32, i32* %6
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %124, i64 %126
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
switch i32 %129, label %350 [
i32 93, label %130
i32 91, label %138
i32 43, label %148
i32 45, label %184
i32 62, label %220
i32 60, label %256
i32 46, label %292
i32 44, label %344
]
130: ; preds = %123
%131 = load i32, i32* %11
%132 = add nsw i32 %131, -1
store i32 %132, i32* %11
%133 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%134 = load i32, i32* %11
%135 = call i32 @strrepeat(i8* %133, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %134)
%136 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%137 = call i32 @strcat(i8* %136, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %351
138: ; preds = %123
%139 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%140 = call i32 @strcat(i8* %139, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%141 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%142 = load i32, i32* %11
%143 = call i32 @strrepeat(i8* %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %142)
%144 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%145 = call i32 @strcat(i8* %144, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%146 = load i32, i32* %11
%147 = add nsw i32 %146, 1
store i32 %147, i32* %11
br label %351
148: ; preds = %123
%149 = load i32, i32* %6
%150 = add nsw i32 %149, 1
%151 = load i32, i32* %8
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %165
153: ; preds = %148
%154 = load i8*, i8** %19
%155 = load i32, i32* %6
%156 = add nsw i32 %155, 1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %154, i64 %157
%159 = load i8, i8* %158
%160 = sext i8 %159 to i32
%161 = icmp eq i32 %160, 43
br i1 %161, label %162, label %165
162: ; preds = %153
%163 = load i32, i32* %12
%164 = add nsw i32 %163, 1
store i32 %164, i32* %12
br label %183
165: ; preds = %153, %148
%166 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%167 = load i32, i32* %11
%168 = call i32 @strrepeat(i8* %166, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %167)
%169 = load i32, i32* %12
%170 = icmp sgt i32 %169, 0
br i1 %170, label %171, label %179
171: ; preds = %165
%172 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%173 = load i32, i32* %12
%174 = add nsw i32 %173, 1
store i32 %174, i32* %12
%175 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %172, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %174)
%176 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%177 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%178 = call i32 @strcat(i8* %176, i8* %177)
store i32 0, i32* %12
br label %182
179: ; preds = %165
%180 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%181 = call i32 @strcat(i8* %180, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %182
182: ; preds = %179, %171
br label %183
183: ; preds = %182, %162
br label %351
184: ; preds = %123
%185 = load i32, i32* %6
%186 = add nsw i32 %185, 1
%187 = load i32, i32* %8
%188 = icmp slt i32 %186, %187
br i1 %188, label %189, label %201
189: ; preds = %184
%190 = load i8*, i8** %19
%191 = load i32, i32* %6
%192 = add nsw i32 %191, 1
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8, i8* %190, i64 %193
%195 = load i8, i8* %194
%196 = sext i8 %195 to i32
%197 = icmp eq i32 %196, 45
br i1 %197, label %198, label %201
198: ; preds = %189
%199 = load i32, i32* %13
%200 = add nsw i32 %199, 1
store i32 %200, i32* %13
br label %219
201: ; preds = %189, %184
%202 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%203 = load i32, i32* %11
%204 = call i32 @strrepeat(i8* %202, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %203)
%205 = load i32, i32* %13
%206 = icmp sgt i32 %205, 0
br i1 %206, label %207, label %215
207: ; preds = %201
%208 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%209 = load i32, i32* %13
%210 = add nsw i32 %209, 1
store i32 %210, i32* %13
%211 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %208, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %210)
%212 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%213 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%214 = call i32 @strcat(i8* %212, i8* %213)
store i32 0, i32* %13
br label %218
215: ; preds = %201
%216 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%217 = call i32 @strcat(i8* %216, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
br label %218
218: ; preds = %215, %207
br label %219
219: ; preds = %218, %198
br label %351
220: ; preds = %123
%221 = load i32, i32* %6
%222 = add nsw i32 %221, 1
%223 = load i32, i32* %8
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %237
225: ; preds = %220
%226 = load i8*, i8** %19
%227 = load i32, i32* %6
%228 = add nsw i32 %227, 1
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8, i8* %226, i64 %229
%231 = load i8, i8* %230
%232 = sext i8 %231 to i32
%233 = icmp eq i32 %232, 62
br i1 %233, label %234, label %237
234: ; preds = %225
%235 = load i32, i32* %14
%236 = add nsw i32 %235, 1
store i32 %236, i32* %14
br label %255
237: ; preds = %225, %220
%238 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%239 = load i32, i32* %11
%240 = call i32 @strrepeat(i8* %238, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %239)
%241 = load i32, i32* %14
%242 = icmp sgt i32 %241, 0
br i1 %242, label %243, label %251
243: ; preds = %237
%244 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%245 = load i32, i32* %14
%246 = add nsw i32 %245, 1
store i32 %246, i32* %14
%247 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %244, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %246)
%248 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%249 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%250 = call i32 @strcat(i8* %248, i8* %249)
store i32 0, i32* %14
br label %254
251: ; preds = %237
%252 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%253 = call i32 @strcat(i8* %252, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
br label %254
254: ; preds = %251, %243
br label %255
255: ; preds = %254, %234
br label %351
256: ; preds = %123
%257 = load i32, i32* %6
%258 = add nsw i32 %257, 1
%259 = load i32, i32* %8
%260 = icmp slt i32 %258, %259
br i1 %260, label %261, label %273
261: ; preds = %256
%262 = load i8*, i8** %19
%263 = load i32, i32* %6
%264 = add nsw i32 %263, 1
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i8, i8* %262, i64 %265
%267 = load i8, i8* %266
%268 = sext i8 %267 to i32
%269 = icmp eq i32 %268, 60
br i1 %269, label %270, label %273
270: ; preds = %261
%271 = load i32, i32* %15
%272 = add nsw i32 %271, 1
store i32 %272, i32* %15
br label %291
273: ; preds = %261, %256
%274 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%275 = load i32, i32* %11
%276 = call i32 @strrepeat(i8* %274, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %275)
%277 = load i32, i32* %15
%278 = icmp sgt i32 %277, 0
br i1 %278, label %279, label %287
279: ; preds = %273
%280 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%281 = load i32, i32* %15
%282 = add nsw i32 %281, 1
store i32 %282, i32* %15
%283 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %280, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0), i32 %282)
%284 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%285 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%286 = call i32 @strcat(i8* %284, i8* %285)
store i32 0, i32* %15
br label %290
287: ; preds = %273
%288 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%289 = call i32 @strcat(i8* %288, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %290
290: ; preds = %287, %279
br label %291
291: ; preds = %290, %270
br label %351
292: ; preds = %123
%293 = getelementptr inbounds [30 x i8], [30 x i8]* %23, i64 0, i64 0
store i8 0, i8* %293
%294 = getelementptr inbounds [30 x i8], [30 x i8]* %24, i64 0, i64 0
store i8 0, i8* %294
%295 = load i32, i32* %6
%296 = add nsw i32 %295, 1
%297 = load i32, i32* %8
%298 = icmp slt i32 %296, %297
br i1 %298, label %299, label %311
299: ; preds = %292
%300 = load i8*, i8** %19
%301 = load i32, i32* %6
%302 = add nsw i32 %301, 1
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds i8, i8* %300, i64 %303
%305 = load i8, i8* %304
%306 = sext i8 %305 to i32
%307 = icmp eq i32 %306, 46
br i1 %307, label %308, label %311
308: ; preds = %299
%309 = load i32, i32* %16
%310 = add nsw i32 %309, 1
store i32 %310, i32* %16
br label %343
311: ; preds = %299, %292
%312 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%313 = load i32, i32* %11
%314 = call i32 @strrepeat(i8* %312, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %313)
%315 = load i32, i32* %16
%316 = icmp sgt i32 %315, 0
br i1 %316, label %317, label %339
317: ; preds = %311
%318 = getelementptr inbounds [30 x i8], [30 x i8]* %23, i64 0, i64 0
%319 = load i32, i32* %11
%320 = add nsw i32 %319, 1
%321 = call i32 @strrepeat(i8* %318, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %320)
%322 = getelementptr inbounds [30 x i8], [30 x i8]* %24, i64 0, i64 0
%323 = load i32, i32* %11
%324 = call i32 @strrepeat(i8* %322, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %323)
%325 = getelementptr inbounds [60 x i8], [60 x i8]* %25, i64 0, i64 0
%326 = call i32 @strcpy(i8* %325, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.20, i64 0, i64 0))
%327 = getelementptr inbounds [60 x i8], [60 x i8]* %25, i64 0, i64 0
%328 = call i32 @strcat(i8* %327, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0))
%329 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%330 = getelementptr inbounds [60 x i8], [60 x i8]* %25, i64 0, i64 0
%331 = load i32, i32* %16
%332 = add nsw i32 %331, 1
store i32 %332, i32* %16
%333 = getelementptr inbounds [30 x i8], [30 x i8]* %23, i64 0, i64 0
%334 = getelementptr inbounds [30 x i8], [30 x i8]* %24, i64 0, i64 0
%335 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %329, i8* %330, i32 %332, i8* %333, i8* %334)
%336 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%337 = getelementptr inbounds [300 x i8], [300 x i8]* %22, i64 0, i64 0
%338 = call i32 @strcat(i8* %336, i8* %337)
store i32 0, i32* %16
br label %342
339: ; preds = %311
%340 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%341 = call i32 @strcat(i8* %340, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0))
br label %342
342: ; preds = %339, %317
br label %343
343: ; preds = %342, %308
br label %351
344: ; preds = %123
%345 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%346 = load i32, i32* %11
%347 = call i32 @strrepeat(i8* %345, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %346)
%348 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%349 = call i32 @strcat(i8* %348, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i64 0, i64 0))
br label %351
350: ; preds = %123
br label %351
351: ; preds = %350, %344, %343, %291, %255, %219, %183, %138, %130
br label %352
352: ; preds = %351
%353 = load i32, i32* %6
%354 = add nsw i32 %353, 1
store i32 %354, i32* %6
br label %119
355: ; preds = %119
%356 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%357 = call i32 @strcat(i8* %356, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0))
%358 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%359 = call i32 @strcat(i8* %358, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.25, i64 0, i64 0))
%360 = load i32, i32* %4
%361 = icmp slt i32 %360, 3
br i1 %361, label %362, label %365
362: ; preds = %355
%363 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%364 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i8* %363)
store i32 0, i32* %7
br label %389
365: ; preds = %355
%366 = load i8**, i8*** %5
%367 = getelementptr inbounds i8*, i8** %366, i64 2
%368 = load i8*, i8** %367
store i8* %368, i8** %20
%369 = load i8*, i8** %20
%370 = call i32* @fopen(i8* %369, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0))
store i32* %370, i32** %27
%371 = load i32*, i32** %27
%372 = icmp ne i32* %371, null
br i1 %372, label %376, label %373
373: ; preds = %365
%374 = load i8*, i8** %20
%375 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %374)
store i32 1, i32* %7
br label %389
376: ; preds = %365
%377 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%378 = call i32 @strlen(i8* %377)
store i32 %378, i32* %9
%379 = getelementptr inbounds [30000 x i8], [30000 x i8]* %21, i64 0, i64 0
%380 = load i32, i32* %9
%381 = load i32*, i32** %27
%382 = call i32 @fwrite(i8* %379, i32 1, i32 %380, i32* %381)
%383 = load i32, i32* %9
%384 = icmp ne i32 %382, %383
br i1 %384, label %385, label %388
385: ; preds = %376
%386 = load i8*, i8** %20
%387 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.28, i64 0, i64 0), i8* %386)
store i32 1, i32* %7
br label %389
388: ; preds = %376
br label %389
389: ; preds = %388, %385, %373, %362, %77, %62, %45, %35
%390 = load i32*, i32** %26
%391 = icmp ne i32* %390, null
br i1 %391, label %392, label %395
392: ; preds = %389
%393 = load i32*, i32** %26
%394 = call i32 @fclose(i32* %393)
br label %395
395: ; preds = %392, %389
%396 = load i32*, i32** %27
%397 = icmp ne i32* %396, null
br i1 %397, label %398, label %401
398: ; preds = %395
%399 = load i32*, i32** %27
%400 = call i32 @fclose(i32* %399)
br label %401
401: ; preds = %398, %395
%402 = load i8*, i8** %18
%403 = icmp ne i8* %402, null
br i1 %403, label %404, label %407
404: ; preds = %401
%405 = load i8*, i8** %18
%406 = call i32 @free(i8* %405)
br label %407
407: ; preds = %404, %401
%408 = load i8*, i8** %19
%409 = icmp ne i8* %408, null
br i1 %409, label %410, label %413
410: ; preds = %407
%411 = load i8*, i8** %19
%412 = call i32 @free(i8* %411)
br label %413
413: ; preds = %410, %407
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"bf2c (v%s)\0A\0AUsage: bf2c <program.bf> [<output.c>]\0A\00"
@.str.1 = [6 x i8] c"1.0.1\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"Could not open %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [13 x i8] c"%s is empty\0A\00"
@.str.5 = [19 x i8] c"Could not read %s\0A\00"
@.str.6 = [53 x i8] c"#include <stdio.h>\0A\0Aint main() {\0A\09int c = 0, i = 0;\0A\00"
@.str.7 = [24 x i8] c"\09static int b[30000];\0A\0A\00"
@.str.8 = [2 x i8] c"\09\00"
@.str.9 = [5 x i8] c"\09}\0A\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [21 x i8] c"\09while(b[c] != 0) {\0A\00"
@.str.12 = [14 x i8] c"\09b[c] += %d;\0A\00"
@.str.13 = [10 x i8] c"\09++b[c];\0A\00"
@.str.14 = [14 x i8] c"\09b[c] -= %d;\0A\00"
@.str.15 = [10 x i8] c"\09--b[c];\0A\00"
@.str.16 = [11 x i8] c"\09c += %d;\0A\00"
@.str.17 = [7 x i8] c"\09++c;\0A\00"
@.str.18 = [11 x i8] c"\09c -= %d;\0A\00"
@.str.19 = [7 x i8] c"\09--c;\0A\00"
@.str.20 = [29 x i8] c"\0A\09for (i = 0; i < %d; i++) {\00"
@.str.21 = [26 x i8] c"\0A%s\09putchar(b[c]);\0A%s\09}\0A\0A\00"
@.str.22 = [17 x i8] c"\09putchar(b[c]);\0A\00"
@.str.23 = [20 x i8] c"\09b[c] = getchar();\0A\00"
@.str.24 = [13 x i8] c"\0A\09return 0;\0A\00"
@.str.25 = [2 x i8] c"}\00"
@.str.26 = [4 x i8] c"%s\0A\00"
@.str.27 = [3 x i8] c"w+\00"
@.str.28 = [23 x i8] c"Could not write to %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [30000 x i8]
%4 = alloca [300 x i8]
%5 = alloca [30 x i8]
%6 = alloca [30 x i8]
%7 = alloca [60 x i8]
%8 = getelementptr inbounds [30000 x i8], [30000 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [60 x i8], [60 x i8]* %7, i64 0, i64 0
%13 = icmp slt i32 %0, 2
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %254
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %254
23: ; preds = %16
%24 = load i32, i32* @SEEK_END
%25 = tail call i32 @fseek(i32* %19, i32 0, i32 %24)
%26 = tail call i32 @ftell(i32* %19)
%27 = load i32, i32* @SEEK_SET
%28 = tail call i32 @fseek(i32* %19, i32 0, i32 %27)
%29 = icmp eq i32 %26, 0
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %18)
br label %242
32: ; preds = %23
%33 = tail call i8* @malloc(i32 %26)
%34 = tail call i32 @fread(i8* %33, i32 1, i32 %26, i32* %19)
%35 = icmp eq i32 %34, %26
br i1 %35, label %38, label %36
36: ; preds = %32
%37 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %18)
br label %242
38: ; preds = %32
%39 = tail call i8* @malloc(i32 %26)
%40 = icmp sgt i32 %26, 0
br i1 %40, label %41, label %86
41: ; preds = %38
%42 = zext i32 %26 to i64
%43 = and i64 %42, 1
%44 = icmp eq i32 %26, 1
br i1 %44, label %73, label %45
45: ; preds = %41
%46 = and i64 %42, 4294967294
br label %47
47: ; preds = %68, %45
%48 = phi i64 [ 0, %45 ], [ %70, %68 ]
%49 = phi i32 [ 0, %45 ], [ %69, %68 ]
%50 = phi i64 [ 0, %45 ], [ %71, %68 ]
%51 = getelementptr inbounds i8, i8* %33, i64 %48
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
switch i32 %53, label %58 [
i32 93, label %54
i32 91, label %54
i32 43, label %54
i32 45, label %54
i32 62, label %54
i32 60, label %54
i32 46, label %54
i32 44, label %54
]
54: ; preds = %47, %47, %47, %47, %47, %47, %47, %47
%55 = add nsw i32 %49, 1
%56 = sext i32 %49 to i64
%57 = getelementptr inbounds i8, i8* %39, i64 %56
store i8 %52, i8* %57
br label %58
58: ; preds = %47, %54
%59 = phi i32 [ %49, %47 ], [ %55, %54 ]
%60 = or i64 %48, 1
%61 = getelementptr inbounds i8, i8* %33, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
switch i32 %63, label %68 [
i32 93, label %64
i32 91, label %64
i32 43, label %64
i32 45, label %64
i32 62, label %64
i32 60, label %64
i32 46, label %64
i32 44, label %64
]
64: ; preds = %58, %58, %58, %58, %58, %58, %58, %58
%65 = add nsw i32 %59, 1
%66 = sext i32 %59 to i64
%67 = getelementptr inbounds i8, i8* %39, i64 %66
store i8 %62, i8* %67
br label %68
68: ; preds = %64, %58
%69 = phi i32 [ %59, %58 ], [ %65, %64 ]
%70 = add nuw nsw i64 %48, 2
%71 = add i64 %50, 2
%72 = icmp eq i64 %71, %46
br i1 %72, label %73, label %47
73: ; preds = %68, %41
%74 = phi i32 [ undef, %41 ], [ %69, %68 ]
%75 = phi i64 [ 0, %41 ], [ %70, %68 ]
%76 = phi i32 [ 0, %41 ], [ %69, %68 ]
%77 = icmp eq i64 %43, 0
br i1 %77, label %86, label %78
78: ; preds = %73
%79 = getelementptr inbounds i8, i8* %33, i64 %75
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
switch i32 %81, label %86 [
i32 93, label %82
i32 91, label %82
i32 43, label %82
i32 45, label %82
i32 62, label %82
i32 60, label %82
i32 46, label %82
i32 44, label %82
]
82: ; preds = %78, %78, %78, %78, %78, %78, %78, %78
%83 = add nsw i32 %76, 1
%84 = sext i32 %76 to i64
%85 = getelementptr inbounds i8, i8* %39, i64 %84
store i8 %80, i8* %85
br label %86
86: ; preds = %73, %82, %78, %38
%87 = phi i32 [ 0, %38 ], [ %74, %73 ], [ %76, %78 ], [ %83, %82 ]
%88 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0))
%89 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%90 = icmp sgt i32 %87, 0
br i1 %90, label %91, label %221
91: ; preds = %86
%92 = zext i32 %87 to i64
%93 = zext i32 %87 to i64
br label %94
94: ; preds = %91, %212
%95 = phi i64 [ 0, %91 ], [ %219, %212 ]
%96 = phi i32 [ 0, %91 ], [ %218, %212 ]
%97 = phi i32 [ 0, %91 ], [ %217, %212 ]
%98 = phi i32 [ 0, %91 ], [ %216, %212 ]
%99 = phi i32 [ 0, %91 ], [ %215, %212 ]
%100 = phi i32 [ 0, %91 ], [ %214, %212 ]
%101 = phi i32 [ 0, %91 ], [ %213, %212 ]
%102 = getelementptr inbounds i8, i8* %39, i64 %95
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
switch i32 %104, label %212 [
i32 93, label %105
i32 91, label %109
i32 43, label %114
i32 45, label %132
i32 62, label %150
i32 60, label %168
i32 46, label %186
i32 44, label %209
]
105: ; preds = %94
%106 = add nsw i32 %101, -1
%107 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %106)
%108 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %212
109: ; preds = %94
%110 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%111 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%112 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%113 = add nsw i32 %101, 1
br label %212
114: ; preds = %94
%115 = add nuw nsw i64 %95, 1
%116 = icmp ult i64 %115, %92
br i1 %116, label %117, label %123
117: ; preds = %114
%118 = getelementptr inbounds i8, i8* %39, i64 %115
%119 = load i8, i8* %118
%120 = icmp eq i8 %119, 43
br i1 %120, label %121, label %123
121: ; preds = %117
%122 = add nsw i32 %100, 1
br label %212
123: ; preds = %117, %114
%124 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%125 = icmp sgt i32 %100, 0
br i1 %125, label %126, label %130
126: ; preds = %123
%127 = add nuw nsw i32 %100, 1
%128 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %127)
%129 = call i32 @strcat(i8* %8, i8* %9)
br label %212
130: ; preds = %123
%131 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %212
132: ; preds = %94
%133 = add nuw nsw i64 %95, 1
%134 = icmp ult i64 %133, %92
br i1 %134, label %135, label %141
135: ; preds = %132
%136 = getelementptr inbounds i8, i8* %39, i64 %133
%137 = load i8, i8* %136
%138 = icmp eq i8 %137, 45
br i1 %138, label %139, label %141
139: ; preds = %135
%140 = add nsw i32 %99, 1
br label %212
141: ; preds = %135, %132
%142 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%143 = icmp sgt i32 %99, 0
br i1 %143, label %144, label %148
144: ; preds = %141
%145 = add nuw nsw i32 %99, 1
%146 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %145)
%147 = call i32 @strcat(i8* %8, i8* %9)
br label %212
148: ; preds = %141
%149 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
br label %212
150: ; preds = %94
%151 = add nuw nsw i64 %95, 1
%152 = icmp ult i64 %151, %92
br i1 %152, label %153, label %159
153: ; preds = %150
%154 = getelementptr inbounds i8, i8* %39, i64 %151
%155 = load i8, i8* %154
%156 = icmp eq i8 %155, 62
br i1 %156, label %157, label %159
157: ; preds = %153
%158 = add nsw i32 %98, 1
br label %212
159: ; preds = %153, %150
%160 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%161 = icmp sgt i32 %98, 0
br i1 %161, label %162, label %166
162: ; preds = %159
%163 = add nuw nsw i32 %98, 1
%164 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i32 %163)
%165 = call i32 @strcat(i8* %8, i8* %9)
br label %212
166: ; preds = %159
%167 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
br label %212
168: ; preds = %94
%169 = add nuw nsw i64 %95, 1
%170 = icmp ult i64 %169, %92
br i1 %170, label %171, label %177
171: ; preds = %168
%172 = getelementptr inbounds i8, i8* %39, i64 %169
%173 = load i8, i8* %172
%174 = icmp eq i8 %173, 60
br i1 %174, label %175, label %177
175: ; preds = %171
%176 = add nsw i32 %97, 1
br label %212
177: ; preds = %171, %168
%178 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%179 = icmp sgt i32 %97, 0
br i1 %179, label %180, label %184
180: ; preds = %177
%181 = add nuw nsw i32 %97, 1
%182 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0), i32 %181)
%183 = call i32 @strcat(i8* %8, i8* %9)
br label %212
184: ; preds = %177
%185 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %212
186: ; preds = %94
store i8 0, i8* %10
store i8 0, i8* %11
%187 = add nuw nsw i64 %95, 1
%188 = icmp ult i64 %187, %92
br i1 %188, label %189, label %195
189: ; preds = %186
%190 = getelementptr inbounds i8, i8* %39, i64 %187
%191 = load i8, i8* %190
%192 = icmp eq i8 %191, 46
br i1 %192, label %193, label %195
193: ; preds = %189
%194 = add nsw i32 %96, 1
br label %212
195: ; preds = %189, %186
%196 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%197 = icmp sgt i32 %96, 0
br i1 %197, label %198, label %207
198: ; preds = %195
%199 = add nsw i32 %101, 1
%200 = call i32 @strrepeat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %199)
%201 = call i32 @strrepeat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%202 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.20, i64 0, i64 0))
%203 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0))
%204 = add nuw nsw i32 %96, 1
%205 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %9, i8* %12, i32 %204, i8* %10, i8* %11)
%206 = call i32 @strcat(i8* %8, i8* %9)
br label %212
207: ; preds = %195
%208 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0))
br label %212
209: ; preds = %94
%210 = call i32 @strrepeat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %101)
%211 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i64 0, i64 0))
br label %212
212: ; preds = %105, %109, %209, %126, %130, %121, %144, %148, %139, %162, %166, %157, %180, %184, %175, %198, %207, %193, %94
%213 = phi i32 [ %101, %94 ], [ %101, %209 ], [ %101, %193 ], [ %101, %198 ], [ %101, %207 ], [ %101, %175 ], [ %101, %180 ], [ %101, %184 ], [ %101, %157 ], [ %101, %162 ], [ %101, %166 ], [ %101, %139 ], [ %101, %144 ], [ %101, %148 ], [ %101, %121 ], [ %101, %126 ], [ %101, %130 ], [ %113, %109 ], [ %106, %105 ]
%214 = phi i32 [ %100, %94 ], [ %100, %209 ], [ %100, %193 ], [ %100, %198 ], [ %100, %207 ], [ %100, %175 ], [ %100, %180 ], [ %100, %184 ], [ %100, %157 ], [ %100, %162 ], [ %100, %166 ], [ %100, %139 ], [ %100, %144 ], [ %100, %148 ], [ %122, %121 ], [ 0, %126 ], [ %100, %130 ], [ %100, %109 ], [ %100, %105 ]
%215 = phi i32 [ %99, %94 ], [ %99, %209 ], [ %99, %193 ], [ %99, %198 ], [ %99, %207 ], [ %99, %175 ], [ %99, %180 ], [ %99, %184 ], [ %99, %157 ], [ %99, %162 ], [ %99, %166 ], [ %140, %139 ], [ 0, %144 ], [ %99, %148 ], [ %99, %121 ], [ %99, %126 ], [ %99, %130 ], [ %99, %109 ], [ %99, %105 ]
%216 = phi i32 [ %98, %94 ], [ %98, %209 ], [ %98, %193 ], [ %98, %198 ], [ %98, %207 ], [ %98, %175 ], [ %98, %180 ], [ %98, %184 ], [ %158, %157 ], [ 0, %162 ], [ %98, %166 ], [ %98, %139 ], [ %98, %144 ], [ %98, %148 ], [ %98, %121 ], [ %98, %126 ], [ %98, %130 ], [ %98, %109 ], [ %98, %105 ]
%217 = phi i32 [ %97, %94 ], [ %97, %209 ], [ %97, %193 ], [ %97, %198 ], [ %97, %207 ], [ %176, %175 ], [ 0, %180 ], [ %97, %184 ], [ %97, %157 ], [ %97, %162 ], [ %97, %166 ], [ %97, %139 ], [ %97, %144 ], [ %97, %148 ], [ %97, %121 ], [ %97, %126 ], [ %97, %130 ], [ %97, %109 ], [ %97, %105 ]
%218 = phi i32 [ %96, %94 ], [ %96, %209 ], [ %194, %193 ], [ 0, %198 ], [ %96, %207 ], [ %96, %175 ], [ %96, %180 ], [ %96, %184 ], [ %96, %157 ], [ %96, %162 ], [ %96, %166 ], [ %96, %139 ], [ %96, %144 ], [ %96, %148 ], [ %96, %121 ], [ %96, %126 ], [ %96, %130 ], [ %96, %109 ], [ %96, %105 ]
%219 = add nuw nsw i64 %95, 1
%220 = icmp eq i64 %219, %93
br i1 %220, label %221, label %94
221: ; preds = %212, %86
%222 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0))
%223 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.25, i64 0, i64 0))
%224 = icmp slt i32 %0, 3
br i1 %224, label %225, label %227
225: ; preds = %221
%226 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i8* %8)
br label %242
227: ; preds = %221
%228 = getelementptr inbounds i8*, i8** %1, i64 2
%229 = load i8*, i8** %228
%230 = call i32* @fopen(i8* %229, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0))
%231 = icmp eq i32* %230, null
br i1 %231, label %232, label %234
232: ; preds = %227
%233 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %229)
br label %242
234: ; preds = %227
%235 = call i32 @strlen(i8* %8)
%236 = call i32 @fwrite(i8* %8, i32 1, i32 %235, i32* %230)
%237 = icmp eq i32 %236, %235
br i1 %237, label %240, label %238
238: ; preds = %234
%239 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.28, i64 0, i64 0), i8* %229)
br label %240
240: ; preds = %234, %238
%241 = call i32 @fclose(i32* %19)
br label %242
242: ; preds = %232, %225, %36, %30, %240
%243 = phi i32* [ %230, %240 ], [ %19, %30 ], [ %19, %36 ], [ %19, %225 ], [ %19, %232 ]
%244 = phi i8* [ %33, %240 ], [ null, %30 ], [ %33, %36 ], [ %33, %225 ], [ %33, %232 ]
%245 = phi i8* [ %39, %240 ], [ null, %30 ], [ null, %36 ], [ %39, %225 ], [ %39, %232 ]
%246 = call i32 @fclose(i32* %243)
%247 = icmp eq i8* %244, null
br i1 %247, label %250, label %248
248: ; preds = %242
%249 = call i32 @free(i8* %244)
br label %250
250: ; preds = %248, %242
%251 = icmp eq i8* %245, null
br i1 %251, label %254, label %252
252: ; preds = %250
%253 = call i32 @free(i8* %245)
br label %254
254: ; preds = %14, %21, %252, %250
ret i32 0
}