#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*/ fail(char *, ...);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, ...);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ md5(char *, int, char *);
int sscanf(char *, char *, int *, ...);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
scalar_t__ strnicmp(char *, char *, int /*<<< orphan*/);
char *strstr(char *, char *);
int main(int argc, char *argv[]) {
  static char buf[4096];
  static char data[(1024 * 1024 * 32)];
  static char md5str[33];
  char *p;
  FILE *fp, *sfp;
  int len, ptr, diff, flag, a, b, c;
  if (argc == 1) {
    sfp = stdin;
  } else {
    if (argc != 2)
      fail("usage: %s [script_file_name]", argv[0]);
    sfp = fopen(argv[1], "r");
    if (!sfp)
      fail("can't open script file: %s", argv[1]);
  }
  while (fscanf(sfp, "%s", buf) == 1) {
    if (strncmp(buf, "/*", 2) == 0) {
      while (fscanf(sfp, "%s", buf) == 1)
        if (strstr(buf, "*/"))
          break;
    } else if (*buf == '#' || *buf == ';' || strncmp(buf, "//", 2) == 0) {
      fscanf(sfp, "%*[^\n]");
    } else if (*buf == '?') {
      if (md5(data, len, md5str) < 0)
        fail("can't calculate md5");
      flag = 0;
      p = buf + 1;
      while (1) {
        if (strnicmp(md5str, p, strlen(md5str)) == 0) {
          flag = 1;
          break;
        }
        p = strstr(p, "||");
        if (!p)
          break;
        p += 2;
      }
      if (!flag)
        fail("md5sum mismatch");
    } else if (*buf == '<') {
      fp = fopen(buf + 1, "rb");
      if (!fp)
        fail("can't open input file: %s", buf + 1);
      len = fread(data, 1, (1024 * 1024 * 32), fp);
      if (len <= 0)
        fail("read failed", buf + 1);
      if (len >= (1024 * 1024 * 32))
        fail("data buffer is too small");
      fclose(fp);
    } else if (*buf == '>') {
      fp = fopen(buf + 1, "wb");
      if (!fp)
        fail("can't open output file: %s", buf + 1);
      if (fwrite(data, 1, len, fp) != len)
        fail("write failed");
      fclose(fp);
    } else if (*buf == ':') {
      if (sscanf(buf, ":%x/%x", &a, &b) == 2) {
        diff = a - b;
        ptr = a;
      } else if (sscanf(buf, ":/%x", &b) == 1) {
        ptr = b + diff;
      } else if (sscanf(buf, ":%x", &a) == 1) {
        ptr = a;
      } else
        fail("invalid position instruction: %s", buf);
    } else if (sscanf(buf, "%x", &c) == 1) {
      if (c < 0 || c > 0xff)
        fail("invalid byte: %s", buf);
      data[ptr++] = c;
    } else
      fail("unrecognized instruction: %s", buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11f3 <main+0x33>
mov    0x2e01(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1250 <main+0x90>
cmpl   $0x2,-0x8(%rbp)
je     1212 <main+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfc(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    124b <main+0x8b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
jmp    1250 <main+0x90>
jmp    1255 <main+0x95>
mov    -0x28(%rbp),%rdi
lea    0xdd7(%rip),%rsi
lea    0x2e29(%rip),%rdx
mov    $0x0,%al
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    16de <main+0x51e>
lea    0x2e12(%rip),%rdi
lea    0xdb5(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12ec <main+0x12c>
jmp    129e <main+0xde>
mov    -0x28(%rbp),%rdi
lea    0xd8e(%rip),%rsi
lea    0x2de0(%rip),%rdx
mov    $0x0,%al
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    12e7 <main+0x127>
lea    0x2dc9(%rip),%rdi
lea    0xd6f(%rip),%rsi
call   10e0 <strstr@plt>
cmp    $0x0,%rax
je     12e2 <main+0x122>
jmp    12e7 <main+0x127>
jmp    129e <main+0xde>
jmp    16d9 <main+0x519>
movsbl 0x2d9d(%rip),%eax
cmp    $0x23,%eax
je     132e <main+0x16e>
movsbl 0x2d8d(%rip),%eax
cmp    $0x3b,%eax
je     132e <main+0x16e>
lea    0x2d7d(%rip),%rdi
lea    0xd26(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1345 <main+0x185>
mov    -0x28(%rbp),%rdi
lea    0xd0a(%rip),%rsi
mov    $0x0,%al
call   1090 <fscanf@plt>
jmp    16d4 <main+0x514>
movsbl 0x2d44(%rip),%eax
cmp    $0x3f,%eax
jne    1427 <main+0x267>
mov    -0x2c(%rbp),%esi
lea    0x3d31(%rip),%rdi
lea    0x2003d2a(%rip),%rdx
call   10d0 <md5@plt>
cmp    $0x0,%rax
jge    1383 <main+0x1c3>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
movl   $0x0,-0x38(%rbp)
lea    0x2cff(%rip),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    0x2003ce8(%rip),%rdi
call   1080 <strlen@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0x2003cd6(%rip),%rdi
call   1040 <strnicmp@plt>
cmp    $0x0,%rax
jne    13d5 <main+0x215>
movl   $0x1,-0x38(%rbp)
jmp    140a <main+0x24a>
mov    -0x18(%rbp),%rdi
lea    0xc7e(%rip),%rsi
call   10e0 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13f9 <main+0x239>
jmp    140a <main+0x24a>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1399 <main+0x1d9>
cmpl   $0x0,-0x38(%rbp)
jne    1422 <main+0x262>
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
jmp    16cf <main+0x50f>
movsbl 0x2c62(%rip),%eax
cmp    $0x3c,%eax
jne    14df <main+0x31f>
lea    0x2c52(%rip),%rdi
add    $0x1,%rdi
lea    0xc28(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1476 <main+0x2b6>
lea    0xc10(%rip),%rdi
lea    0x2c25(%rip),%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x20(%rbp),%rcx
lea    0x3c0f(%rip),%rdi
mov    $0x1,%esi
mov    $0x2000000,%edx
call   1050 <fread@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jg     14b6 <main+0x2f6>
lea    0xbea(%rip),%rdi
lea    0x2be5(%rip),%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1060 <fail@plt>
cmpl   $0x2000000,-0x2c(%rbp)
jl     14d1 <main+0x311>
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x20(%rbp),%rdi
call   1070 <fclose@plt>
jmp    16ca <main+0x50a>
movsbl 0x2baa(%rip),%eax
cmp    $0x3e,%eax
jne    156b <main+0x3ab>
lea    0x2b9a(%rip),%rdi
add    $0x1,%rdi
lea    0xbb2(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    152e <main+0x36e>
lea    0xb9a(%rip),%rdi
lea    0x2b6d(%rip),%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0x3b54(%rip),%rdi
mov    $0x1,%esi
call   10c0 <fwrite@plt>
cmp    -0x2c(%rbp),%eax
je     155d <main+0x39d>
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x20(%rbp),%rdi
call   1070 <fclose@plt>
jmp    16c5 <main+0x505>
movsbl 0x2b1e(%rip),%eax
cmp    $0x3a,%eax
jne    1636 <main+0x476>
lea    0x2b0e(%rip),%rdi
lea    0xb55(%rip),%rsi
lea    -0x3c(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x2,%eax
jne    15b5 <main+0x3f5>
mov    -0x3c(%rbp),%eax
sub    -0x40(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1631 <main+0x471>
lea    0x2ad4(%rip),%rdi
lea    0xb22(%rip),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    15e5 <main+0x425>
mov    -0x40(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    162c <main+0x46c>
lea    0x2aa4(%rip),%rdi
lea    0xaf7(%rip),%rsi
lea    -0x3c(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    1612 <main+0x452>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1627 <main+0x467>
lea    0xad5(%rip),%rdi
lea    0x2a70(%rip),%rsi
mov    $0x0,%al
call   1060 <fail@plt>
jmp    162c <main+0x46c>
jmp    1631 <main+0x471>
jmp    16c0 <main+0x500>
lea    0x2a53(%rip),%rdi
lea    0xaa3(%rip),%rsi
lea    -0x44(%rbp),%rdx
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    16a6 <main+0x4e6>
cmpl   $0x0,-0x44(%rbp)
jl     166f <main+0x4af>
cmpl   $0xff,-0x44(%rbp)
jle    1684 <main+0x4c4>
lea    0xa99(%rip),%rdi
lea    0x2a13(%rip),%rsi
mov    $0x0,%al
call   1060 <fail@plt>
mov    -0x44(%rbp),%eax
mov    %al,%dl
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp)
movslq %eax,%rcx
lea    0x39f2(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    16bb <main+0x4fb>
lea    0xa73(%rip),%rdi
lea    0x29dc(%rip),%rsi
mov    $0x0,%al
call   1060 <fail@plt>
jmp    16c0 <main+0x500>
jmp    16c5 <main+0x505>
jmp    16ca <main+0x50a>
jmp    16cf <main+0x50f>
jmp    16d4 <main+0x514>
jmp    16d9 <main+0x519>
jmp    1255 <main+0x95>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
je     11f9 <main+0x39>
cmp    $0x1,%edi
jne    11e7 <main+0x27>
mov    0x2e06(%rip),%rax
mov    (%rax),%r14
jmp    1226 <main+0x66>
mov    0x0(%rbp),%rsi
lea    0xe26(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
mov    0x8(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1226 <main+0x66>
mov    0x8(%rbp),%rsi
lea    0xe1b(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <fail@plt>
lea    0xe22(%rip),%rsi
lea    0x2e5c(%rip),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    161a <main+0x45a>
lea    0x2e42(%rip),%r12
lea    0xdfd(%rip),%r15
lea    0xdf3(%rip),%rbx
lea    0xdf2(%rip),%r13
lea    0xdf1(%rip),%rbp
jmp    1296 <main+0xd6>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <fscanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    161a <main+0x45a>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1340 <main+0x180>
mov    0x2ddb(%rip),%al
cmp    $0x23,%al
je     1270 <main+0xb0>
cmp    $0x3b,%al
je     1270 <main+0xb0>
mov    %r12,%rdi
lea    0xd91(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1270 <main+0xb0>
mov    0x2db4(%rip),%al
add    $0xc6,%al
cmp    $0x5,%al
ja     13dc <main+0x21c>
movzbl %al,%eax
lea    0xd10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r12,%rdi
lea    0xdf3(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x2,%eax
jne    1563 <main+0x3a3>
mov    0x8(%rsp),%eax
mov    %eax,(%rsp)
sub    0x4(%rsp),%eax
mov    %eax,0x14(%rsp)
jmp    127d <main+0xbd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    127d <main+0xbd>
mov    %r12,%rdi
mov    %r13,%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     1340 <main+0x180>
jmp    127d <main+0xbd>
lea    0x2d1c(%rip),%rdi
lea    0xd4f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
jne    13a1 <main+0x1e1>
lea    0xd41(%rip),%rdi
lea    0x2cfd(%rip),%rsi
mov    %rax,%rbp
xor    %eax,%eax
call   1060 <fail@plt>
mov    %rbp,%rax
lea    0x3ce8(%rip),%rdi
mov    $0x1,%esi
mov    0xc(%rsp),%ebp
mov    %ebp,%edx
mov    %rax,0x18(%rsp)
mov    %rax,%rcx
call   10c0 <fwrite@plt>
cmp    %ebp,%eax
je     13d2 <main+0x212>
lea    0xd1e(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
mov    0x18(%rsp),%rdi
jmp    15bc <main+0x3fc>
mov    %r12,%rdi
lea    0xd19(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    158e <main+0x3ce>
mov    0x10(%rsp),%eax
cmp    $0x100,%eax
mov    (%rsp),%edx
jb     1421 <main+0x261>
lea    0xd17(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fail@plt>
mov    (%rsp),%edx
mov    0x10(%rsp),%eax
movslq %edx,%rcx
add    $0x1,%edx
mov    %edx,(%rsp)
lea    0x3c5f(%rip),%rdx
mov    %al,(%rcx,%rdx,1)
jmp    127d <main+0xbd>
lea    0x2c51(%rip),%rdi
lea    0xc42(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1469 <main+0x2a9>
lea    0xc31(%rip),%rdi
lea    0x2c2f(%rip),%rsi
xor    %eax,%eax
call   1060 <fail@plt>
lea    0x3c20(%rip),%rdi
mov    $0x1,%esi
mov    $0x2000000,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
test   %eax,%eax
mov    %eax,0xc(%rsp)
jle    15a4 <main+0x3e4>
cmp    $0x2000000,%eax
jb     15b9 <main+0x3f9>
lea    0xc12(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
jmp    15b9 <main+0x3f9>
lea    0x3bdd(%rip),%rdi
mov    0xc(%rsp),%esi
lea    0x2003bd2(%rip),%rbp
mov    %rbp,%rdx
call   10d0 <md5@plt>
test   %rax,%rax
jns    14d9 <main+0x319>
lea    0xb90(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
lea    0x2ba6(%rip),%rbp
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <strnicmp@plt>
test   %rax,%rax
je     15c1 <main+0x401>
mov    %r14,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
lea    0xb5c(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     15cd <main+0x40d>
mov    %rax,%rbp
add    $0x2,%rbp
mov    %r13,%r14
mov    %r15,%r13
lea    0x2003b54(%rip),%r15
mov    %r15,%rdi
call   1080 <strlen@plt>
mov    %r15,%rdi
mov    %r13,%r15
mov    %r14,%r13
mov    0x20(%rsp),%r14
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <strnicmp@plt>
test   %rax,%rax
jne    1510 <main+0x350>
jmp    15c1 <main+0x401>
mov    %r12,%rdi
lea    0xb90(%rip),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    15e7 <main+0x427>
mov    0x4(%rsp),%eax
add    0x14(%rsp),%eax
mov    %eax,(%rsp)
jmp    127d <main+0xbd>
lea    0xba3(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fail@plt>
jmp    127d <main+0xbd>
lea    0xafb(%rip),%rdi
lea    0x2adf(%rip),%rsi
xor    %eax,%eax
call   1060 <fail@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
lea    0xa93(%rip),%rbp
jmp    127d <main+0xbd>
lea    0xaa5(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
lea    0xa79(%rip),%rbp
jmp    127d <main+0xbd>
mov    %r12,%rdi
lea    0xb11(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    160e <main+0x44e>
mov    0x8(%rsp),%eax
mov    %eax,(%rsp)
jmp    127d <main+0xbd>
lea    0xaf1(%rip),%rdi
jmp    1595 <main+0x3d5>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.buf = internal global [4096 x i8] zeroinitializer
@main.data = internal global [33554432 x i8] zeroinitializer
@main.md5str = internal global [33 x i8] zeroinitializer
@stdin = global i32* null
@.str = [29 x i8] c"usage: %s [script_file_name]\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"can't open script file: %s\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [3 x i8] c"/*\00"
@.str.5 = [3 x i8] c"*/\00"
@.str.6 = [3 x i8] c"//\00"
@.str.7 = [7 x i8] c"%*[^\0A]\00"
@.str.8 = [20 x i8] c"can't calculate md5\00"
@.str.9 = [3 x i8] c"||\00"
@.str.10 = [16 x i8] c"md5sum mismatch\00"
@.str.11 = [3 x i8] c"rb\00"
@.str.12 = [26 x i8] c"can't open input file: %s\00"
@.str.13 = [12 x i8] c"read failed\00"
@.str.14 = [25 x i8] c"data buffer is too small\00"
@.str.15 = [3 x i8] c"wb\00"
@.str.16 = [27 x i8] c"can't open output file: %s\00"
@.str.17 = [13 x i8] c"write failed\00"
@.str.18 = [7 x i8] c":%x/%x\00"
@.str.19 = [5 x i8] c":/%x\00"
@.str.20 = [4 x i8] c":%x\00"
@.str.21 = [33 x i8] c"invalid position instruction: %s\00"
@.str.22 = [3 x i8] c"%x\00"
@.str.23 = [17 x i8] c"invalid byte: %s\00"
@.str.24 = [29 x i8] c"unrecognized instruction: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = load i32*, i32** @stdin
store i32* %19, i32** %8
br label %41
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 2
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %23, %20
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %8
%33 = load i32*, i32** %8
%34 = icmp ne i32* %33, null
br i1 %34, label %40, label %35
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %35, %28
br label %41
41: ; preds = %40, %18
br label %42
42: ; preds = %207, %41
%43 = load i32*, i32** %8
%44 = call i32 (i32*, i8*, ...) @fscanf(i32* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %208
46: ; preds = %42
%47 = call i64 @strncmp(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %46
br label %50
50: ; preds = %58, %49
%51 = load i32*, i32** %8
%52 = call i32 (i32*, i8*, ...) @fscanf(i32* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = call i8* @strstr(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %58
57: ; preds = %54
br label %59
58: ; preds = %54
br label %50
59: ; preds = %57, %50
br label %207
60: ; preds = %46
%61 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 35
br i1 %63, label %71, label %64
64: ; preds = %60
%65 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 59
br i1 %67, label %71, label %68
68: ; preds = %64
%69 = call i64 @strncmp(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68, %64, %60
%72 = load i32*, i32** %8
%73 = call i32 (i32*, i8*, ...) @fscanf(i32* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %206
74: ; preds = %68
%75 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 63
br i1 %77, label %78, label %106
78: ; preds = %74
%79 = load i32, i32* %9
%80 = call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 %79, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0))
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %84
84: ; preds = %82, %78
store i32 0, i32* %12
store i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i8** %6
br label %85
85: ; preds = %84, %97
%86 = load i8*, i8** %6
%87 = call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0))
%88 = call i64 @strnicmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0), i8* %86, i32 %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %85
store i32 1, i32* %12
br label %100
91: ; preds = %85
%92 = load i8*, i8** %6
%93 = call i8* @strstr(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i8* %93, i8** %6
%94 = load i8*, i8** %6
%95 = icmp ne i8* %94, null
br i1 %95, label %97, label %96
96: ; preds = %91
br label %100
97: ; preds = %91
%98 = load i8*, i8** %6
%99 = getelementptr inbounds i8, i8* %98, i64 2
store i8* %99, i8** %6
br label %85
100: ; preds = %96, %90
%101 = load i32, i32* %12
%102 = icmp ne i32 %101, 0
br i1 %102, label %105, label %103
103: ; preds = %100
%104 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %105
105: ; preds = %103, %100
br label %205
106: ; preds = %74
%107 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 60
br i1 %109, label %110, label %131
110: ; preds = %106
%111 = call i32* @fopen(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %111, i32** %7
%112 = load i32*, i32** %7
%113 = icmp ne i32* %112, null
br i1 %113, label %116, label %114
114: ; preds = %110
%115 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %116
116: ; preds = %114, %110
%117 = load i32*, i32** %7
%118 = call i32 @fread(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 1, i32 33554432, i32* %117)
store i32 %118, i32* %9
%119 = load i32, i32* %9
%120 = icmp sle i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %116
%122 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %123
123: ; preds = %121, %116
%124 = load i32, i32* %9
%125 = icmp sge i32 %124, 33554432
br i1 %125, label %126, label %128
126: ; preds = %123
%127 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
br label %128
128: ; preds = %126, %123
%129 = load i32*, i32** %7
%130 = call i32 @fclose(i32* %129)
br label %204
131: ; preds = %106
%132 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 62
br i1 %134, label %135, label %152
135: ; preds = %131
%136 = call i32* @fopen(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
store i32* %136, i32** %7
%137 = load i32*, i32** %7
%138 = icmp ne i32* %137, null
br i1 %138, label %141, label %139
139: ; preds = %135
%140 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %141
141: ; preds = %139, %135
%142 = load i32, i32* %9
%143 = load i32*, i32** %7
%144 = call i32 @fwrite(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 1, i32 %142, i32* %143)
%145 = load i32, i32* %9
%146 = icmp ne i32 %144, %145
br i1 %146, label %147, label %149
147: ; preds = %141
%148 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
br label %149
149: ; preds = %147, %141
%150 = load i32*, i32** %7
%151 = call i32 @fclose(i32* %150)
br label %203
152: ; preds = %131
%153 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
%154 = sext i8 %153 to i32
%155 = icmp eq i32 %154, 58
br i1 %155, label %156, label %181
156: ; preds = %152
%157 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32* %13, i32* %14)
%158 = icmp eq i32 %157, 2
br i1 %158, label %159, label %164
159: ; preds = %156
%160 = load i32, i32* %13
%161 = load i32, i32* %14
%162 = sub nsw i32 %160, %161
store i32 %162, i32* %11
%163 = load i32, i32* %13
store i32 %163, i32* %10
br label %180
164: ; preds = %156
%165 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32* %14)
%166 = icmp eq i32 %165, 1
br i1 %166, label %167, label %171
167: ; preds = %164
%168 = load i32, i32* %14
%169 = load i32, i32* %11
%170 = add nsw i32 %168, %169
store i32 %170, i32* %10
br label %179
171: ; preds = %164
%172 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32* %13)
%173 = icmp eq i32 %172, 1
br i1 %173, label %174, label %176
174: ; preds = %171
%175 = load i32, i32* %13
store i32 %175, i32* %10
br label %178
176: ; preds = %171
%177 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
br label %178
178: ; preds = %176, %174
br label %179
179: ; preds = %178, %167
br label %180
180: ; preds = %179, %159
br label %202
181: ; preds = %152
%182 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i32* %15)
%183 = icmp eq i32 %182, 1
br i1 %183, label %184, label %199
184: ; preds = %181
%185 = load i32, i32* %15
%186 = icmp slt i32 %185, 0
br i1 %186, label %190, label %187
187: ; preds = %184
%188 = load i32, i32* %15
%189 = icmp sgt i32 %188, 255
br i1 %189, label %190, label %192
190: ; preds = %187, %184
%191 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
br label %192
192: ; preds = %190, %187
%193 = load i32, i32* %15
%194 = trunc i32 %193 to i8
%195 = load i32, i32* %10
%196 = add nsw i32 %195, 1
store i32 %196, i32* %10
%197 = sext i32 %195 to i64
%198 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 %197
store i8 %194, i8* %198
br label %201
199: ; preds = %181
%200 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
br label %201
201: ; preds = %199, %192
br label %202
202: ; preds = %201, %180
br label %203
203: ; preds = %202, %149
br label %204
204: ; preds = %203, %128
br label %205
205: ; preds = %204, %105
br label %206
206: ; preds = %205, %71
br label %207
207: ; preds = %206, %59
br label %42
208: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@main.buf = internal global [4096 x i8] zeroinitializer
@main.data = internal global [33554432 x i8] zeroinitializer
@main.md5str = internal global [33 x i8] zeroinitializer
@stdin = global i32* null
@.str = [29 x i8] c"usage: %s [script_file_name]\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"can't open script file: %s\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [3 x i8] c"/*\00"
@.str.5 = [3 x i8] c"*/\00"
@.str.6 = [3 x i8] c"//\00"
@.str.7 = [7 x i8] c"%*[^\0A]\00"
@.str.8 = [20 x i8] c"can't calculate md5\00"
@.str.9 = [3 x i8] c"||\00"
@.str.10 = [16 x i8] c"md5sum mismatch\00"
@.str.11 = [3 x i8] c"rb\00"
@.str.12 = [26 x i8] c"can't open input file: %s\00"
@.str.13 = [12 x i8] c"read failed\00"
@.str.14 = [25 x i8] c"data buffer is too small\00"
@.str.15 = [3 x i8] c"wb\00"
@.str.16 = [27 x i8] c"can't open output file: %s\00"
@.str.17 = [13 x i8] c"write failed\00"
@.str.18 = [7 x i8] c":%x/%x\00"
@.str.19 = [5 x i8] c":/%x\00"
@.str.20 = [4 x i8] c":%x\00"
@.str.21 = [33 x i8] c"invalid position instruction: %s\00"
@.str.22 = [3 x i8] c"%x\00"
@.str.23 = [17 x i8] c"invalid byte: %s\00"
@.str.24 = [29 x i8] c"unrecognized instruction: %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
switch i32 %0, label %11 [
i32 1, label %9
i32 2, label %14
]
9: ; preds = %2
%10 = load i32*, i32** @stdin
br label %22
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %2, %11
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i8*, i8** %15
%21 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %14, %19, %9
%23 = phi i32* [ %10, %9 ], [ %17, %14 ], [ null, %19 ]
%24 = call i32 (i32*, i8*, ...) @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %138
26: ; preds = %22, %132
%27 = phi i32 [ %135, %132 ], [ undef, %22 ]
%28 = phi i32 [ %134, %132 ], [ undef, %22 ]
%29 = phi i32 [ %133, %132 ], [ undef, %22 ]
%30 = call i64 @strncmp(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %26, %35
%33 = call i32 (i32*, i8*, ...) @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %132
35: ; preds = %32
%36 = call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp eq i8* %36, null
br i1 %37, label %32, label %132
38: ; preds = %26
%39 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
switch i8 %39, label %40 [
i8 59, label %43
i8 35, label %43
]
40: ; preds = %38
%41 = call i64 @strncmp(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %38, %38, %40
%44 = call i32 (i32*, i8*, ...) @fscanf(i32* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %132
45: ; preds = %40
%46 = load i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0)
switch i8 %46, label %115 [
i8 63, label %47
i8 60, label %67
i8 62, label %83
i8 58, label %95
]
47: ; preds = %45
%48 = call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 %29, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0))
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
%53 = call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0))
%54 = call i64 @strnicmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i32 %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %132, label %60
56: ; preds = %60
%57 = call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0))
%58 = call i64 @strnicmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str, i64 0, i64 0), i8* %64, i32 %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %132, label %60
60: ; preds = %52, %56
%61 = phi i8* [ %64, %56 ], [ getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), %52 ]
%62 = call i8* @strstr(i8* dereferenceable(1) %61, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%63 = icmp eq i8* %62, null
%64 = getelementptr inbounds i8, i8* %62, i64 2
br i1 %63, label %65, label %56
65: ; preds = %60
%66 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %132
67: ; preds = %45
%68 = call i32* @fopen(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %72
72: ; preds = %70, %67
%73 = call i32 @fread(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 1, i32 33554432, i32* %68)
%74 = icmp slt i32 %73, 1
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %81
77: ; preds = %72
%78 = icmp ugt i32 %73, 33554431
br i1 %78, label %79, label %81
79: ; preds = %77
%80 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
br label %81
81: ; preds = %75, %79, %77
%82 = call i32 @fclose(i32* %68)
br label %132
83: ; preds = %45
%84 = call i32* @fopen(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0))
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 1))
br label %88
88: ; preds = %86, %83
%89 = call i32 @fwrite(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 0), i32 1, i32 %29, i32* %84)
%90 = icmp eq i32 %89, %29
br i1 %90, label %93, label %91
91: ; preds = %88
%92 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
br label %93
93: ; preds = %91, %88
%94 = call i32 @fclose(i32* %84)
br label %132
95: ; preds = %45
%96 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32* %3, i32* %4)
%97 = icmp eq i32 %96, 2
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = load i32, i32* %3
%100 = load i32, i32* %4
%101 = sub nsw i32 %99, %100
br label %132
102: ; preds = %95
%103 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32* %4)
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %108
105: ; preds = %102
%106 = load i32, i32* %4
%107 = add nsw i32 %106, %27
br label %132
108: ; preds = %102
%109 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32* %3)
%110 = icmp eq i32 %109, 1
br i1 %110, label %111, label %113
111: ; preds = %108
%112 = load i32, i32* %3
br label %132
113: ; preds = %108
%114 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
br label %132
115: ; preds = %45
%116 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i32* %5)
%117 = icmp eq i32 %116, 1
br i1 %117, label %118, label %130
118: ; preds = %115
%119 = load i32, i32* %5
%120 = icmp ugt i32 %119, 255
br i1 %120, label %121, label %124
121: ; preds = %118
%122 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%123 = load i32, i32* %5
br label %124
124: ; preds = %118, %121
%125 = phi i32 [ %119, %118 ], [ %123, %121 ]
%126 = trunc i32 %125 to i8
%127 = add nsw i32 %28, 1
%128 = sext i32 %28 to i64
%129 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data, i64 0, i64 %128
store i8 %126, i8* %129
br label %132
130: ; preds = %115
%131 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
br label %132
132: ; preds = %56, %32, %35, %52, %43, %81, %105, %113, %111, %98, %130, %124, %93, %65
%133 = phi i32 [ %29, %43 ], [ %29, %65 ], [ %73, %81 ], [ %29, %93 ], [ %29, %98 ], [ %29, %105 ], [ %29, %111 ], [ %29, %113 ], [ %29, %124 ], [ %29, %130 ], [ %29, %52 ], [ %29, %35 ], [ %29, %32 ], [ %29, %56 ]
%134 = phi i32 [ %28, %43 ], [ %28, %65 ], [ %28, %81 ], [ %28, %93 ], [ %99, %98 ], [ %107, %105 ], [ %112, %111 ], [ %28, %113 ], [ %127, %124 ], [ %28, %130 ], [ %28, %52 ], [ %28, %35 ], [ %28, %32 ], [ %28, %56 ]
%135 = phi i32 [ %27, %43 ], [ %27, %65 ], [ %27, %81 ], [ %27, %93 ], [ %101, %98 ], [ %27, %105 ], [ %27, %111 ], [ %27, %113 ], [ %27, %124 ], [ %27, %130 ], [ %27, %52 ], [ %27, %35 ], [ %27, %32 ], [ %27, %56 ]
%136 = call i32 (i32*, i8*, ...) @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%137 = icmp eq i32 %136, 1
br i1 %137, label %26, label %138
138: ; preds = %132, %22
ret i32 0
}