#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;
struct TYPE_4__ {
  int e_shoff;
  size_t e_shstrndx;
  int e_shnum;
};
struct TYPE_3__ {
  int sh_offset;
  int sh_name;
};
typedef TYPE_1__ Elf64_Shdr;
typedef TYPE_2__ Elf64_Ehdr;

/* Variables and functions */
char *ReadFile(char *, int *);
int /*<<< orphan*/ WriteFile(char *, char *, int);
int atoi(char *);
int getopt(int, char **, char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
scalar_t__ mkdir(char *, int);
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  uint64_t b = 0x0;
  uint32_t s = 0;
  uint32_t e = 0;
  uint32_t m = 0;
  char *n = ".text.bench";
  char *o = NULL;
  char *i = NULL;
  char *d = "./data/cubin/fuz/";
  int c = 0;
  while ((c = getopt(argc, argv, "b:s:e:m:o:i:n:d:")) != -1) {
    switch (c) {
    case 'b': {
      sscanf(optarg, "%lx", &b);
      break;
    }
    case 's': {
      s = atoi(optarg);
      break;
    }
    case 'e': {
      e = atoi(optarg);
      break;
    }
    case 'm': {
      m = atoi(optarg);
      break;
    }
    case 'o': {
      o = optarg;
      break;
    }
    case 'i': {
      i = optarg;
      break;
    }
    case 'n': {
      n = optarg;
      break;
    }
    case 'd': {
      d = optarg;
      break;
    }
    }
  }
  printf("base:  0x%016lx\n", b);
  printf("start: %d\n", s);
  printf("end:   %d\n", e);
  printf("mode:  ");
  switch (m) {
  case 3: {
    printf("shift-fill up to e zeros in b\n");
    break;
  }
  case 2: {
    printf("f|= 1<<i;\n");
    break;
  }
  case 1: {
    printf("f = 1<<i;\n");
    break;
  }
  case 0:
  default: {
    printf("f = i++; \n");
    break;
  }
  }
  if (e <= s && s != 0 && e != 0) {
    printf("End <= Start\n");
    return 1;
  }
  if (!i) {
    printf("No input  file\n");
    return 1;
  }
  if (!o) {
    printf("No output file\n");
    return 1;
  }
  uint32_t size = 0;
  char *cubin = ReadFile(i, &size);
  char *out = malloc(size);
  char *pos = 0;
  memcpy(out, cubin, size);
  Elf64_Ehdr *eh = (Elf64_Ehdr *)out;
  Elf64_Shdr *sh = (Elf64_Shdr *)(out + eh->e_shoff);
  char *shstr = (char *)eh + sh[eh->e_shstrndx].sh_offset;
  int j;
  for (j = 0; j < eh->e_shnum; j++) {
    Elf64_Shdr *hdr = &sh[j];
    char *name = (char *)(shstr + hdr->sh_name);
    if (strcmp(name, n) == 0) {
      pos = (char *)eh + hdr->sh_offset;
      break;
    }
  }
  if (!pos) {
    printf("No section\n");
    return 1;
  }
  uint64_t x = 0;
  uint64_t f = 0;
  uint64_t l = e - s;
  printf("l=%ld\n", l);
  switch (m) {
  case 0: {
    x = 0;
    break;
  }
  case 1:
  case 2:
  case 3: {
    x = 1;
    break;
  }
  }
  if (mkdir(d, 0777)) {
    printf("Can't create %s\n", d);
  }
  j = 0;
  while (1) {
    switch (m) {
    case 3: {
      if (x == ((uint64_t)1) << e) {
        return 0;
      }
      f = b | x;
      x <<= 1;
      if (f == b) {
        continue;
      }
      break;
    }
    case 2: {
      if (x == (((uint64_t)1) << (l))) {
        return 0;
      }
      f |= x << s;
      x <<= 1;
      break;
    }
    case 1: {
      if (x == (((uint64_t)1) << (l))) {
        return 0;
      }
      f = x << s;
      x <<= 1;
      break;
    }
    default:
    case 0: {
      if (x == (((uint64_t)1) << (l + 1))) {
        return 0;
      }
      f = x << s;
      x++;
      break;
    }
    }
    uint64_t y = b | f;
    printf("f = 0x%016lx\n", f);
    printf("y = 0x%016lx\n", y);
    char filename[1024] = {0};
    sprintf(filename, "%s%016lx.cubin", d, y);
    *((uint64_t *)pos) = y;
    WriteFile(filename, out, size);
    j++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%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)
lea    0xe6c(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
lea    0xe5d(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe56(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
je     1320 <main+0x160>
mov    -0x44(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x4a8(%rbp)
sub    $0x11,%eax
ja     131b <main+0x15b>
mov    -0x4a8(%rbp),%rax
lea    0xdb9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d81(%rip),%rax
mov    (%rax),%rdi
lea    0xe16(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   10b0 <sscanf@plt>
jmp    131b <main+0x15b>
mov    0x2d62(%rip),%rax
mov    (%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    131b <main+0x15b>
mov    0x2d4b(%rip),%rax
mov    (%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    131b <main+0x15b>
mov    0x2d34(%rip),%rax
mov    (%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    131b <main+0x15b>
mov    0x2d1d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    131b <main+0x15b>
mov    0x2d0a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    131b <main+0x15b>
mov    0x2cf7(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    131b <main+0x15b>
mov    0x2ce4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1222 <main+0x62>
mov    -0x14(%rbp),%esi
lea    0xd71(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x4b1(%rbp)
call   1050 <printf@plt>
mov    -0x4b1(%rbp),%al
mov    -0x18(%rbp),%esi
lea    0xd65(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4b1(%rbp),%al
mov    -0x1c(%rbp),%esi
lea    0xd5b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4b1(%rbp),%al
lea    0xd54(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %rax,-0x4b0(%rbp)
sub    $0x3,%rax
ja     13dc <main+0x21c>
mov    -0x4b0(%rbp),%rax
lea    0xc6b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ea <main+0x22a>
lea    0xd31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ea <main+0x22a>
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ea <main+0x22a>
jmp    13dc <main+0x21c>
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1424 <main+0x264>
cmpl   $0x0,-0x18(%rbp)
je     1424 <main+0x264>
cmpl   $0x0,-0x1c(%rbp)
je     1424 <main+0x264>
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    184d <main+0x68d>
cmpq   $0x0,-0x38(%rbp)
jne    1449 <main+0x289>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    184d <main+0x68d>
cmpq   $0x0,-0x30(%rbp)
jne    146e <main+0x2ae>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    184d <main+0x68d>
movl   $0x0,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <ReadFile@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x68(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    -0x68(%rbp),%rdx
mov    0x8(%rdx),%rdx
movslq (%rcx,%rdx,8),%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x68(%rbp),%rcx
cmp    0x10(%rcx),%eax
jge    156c <main+0x3ac>
mov    -0x70(%rbp),%rax
movslq -0x7c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x88(%rbp)
mov    -0x78(%rbp),%rax
mov    -0x88(%rbp),%rcx
movslq 0x4(%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1559 <main+0x399>
mov    -0x68(%rbp),%rax
mov    -0x88(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
jmp    156c <main+0x3ac>
jmp    155e <main+0x39e>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    14e6 <main+0x326>
cmpq   $0x0,-0x60(%rbp)
jne    1591 <main+0x3d1>
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    184d <main+0x68d>
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%esi
lea    0xb84(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4b8(%rbp)
test   %eax,%eax
je     15f4 <main+0x434>
jmp    15dd <main+0x41d>
mov    -0x4b8(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1603 <main+0x443>
jmp    160d <main+0x44d>
movl   $0x0,-0x94(%rbp)
jmp    160d <main+0x44d>
movl   $0x1,-0x94(%rbp)
mov    -0x40(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1637 <main+0x477>
mov    -0x40(%rbp),%rsi
lea    0xb1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x20(%rbp),%eax
mov    %rax,-0x4c0(%rbp)
sub    $0x3,%rax
ja     1768 <main+0x5a8>
mov    -0x4c0(%rbp),%rax
lea    0x9b0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x94(%rbp),%eax
mov    -0x1c(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    168f <main+0x4cf>
movl   $0x0,-0x4(%rbp)
jmp    184d <main+0x68d>
mov    -0x14(%rbp),%eax
or     -0x94(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    16c1 <main+0x501>
jmp    163e <main+0x47e>
jmp    17b9 <main+0x5f9>
mov    -0x94(%rbp),%eax
mov    -0x9c(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    16ef <main+0x52f>
movl   $0x0,-0x4(%rbp)
jmp    184d <main+0x68d>
mov    -0x94(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
or     -0x98(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    17b9 <main+0x5f9>
mov    -0x94(%rbp),%eax
mov    -0x9c(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    1743 <main+0x583>
movl   $0x0,-0x4(%rbp)
jmp    184d <main+0x68d>
mov    -0x94(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    17b9 <main+0x5f9>
jmp    176d <main+0x5ad>
mov    -0x94(%rbp),%eax
mov    -0x9c(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jne    1799 <main+0x5d9>
movl   $0x0,-0x4(%rbp)
jmp    184d <main+0x68d>
mov    -0x94(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x14(%rbp),%eax
or     -0x98(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x98(%rbp),%esi
lea    0x987(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xa0(%rbp),%esi
lea    0x981(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <memset@plt>
lea    -0x4a0(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0xa0(%rbp),%ecx
lea    0x95d(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0xa0(%rbp),%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x4a0(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1090 <WriteFile@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    163e <main+0x47e>
mov    -0x4(%rbp),%eax
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe57(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe57(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe5d(%rip),%r12
lea    0xde4(%rip),%rbx
mov    0x2dd5(%rip),%rbp
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,0x28(%rsp)
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rax
mov    %rax,0x20(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   10d0 <getopt@plt>
lea    -0x62(%rax),%ecx
cmp    $0x11,%ecx
ja     12cf <main+0xff>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x0(%rbp),%rdi
lea    0xe09(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10c0 <sscanf@plt>
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,(%rsp)
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rax
mov    %rax,0x10(%rsp)
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %rax,0x28(%rsp)
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rax
mov    %rax,0x18(%rsp)
jmp    1250 <main+0x80>
mov    0x0(%rbp),%r13
jmp    1250 <main+0x80>
mov    0x0(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,0x4(%rsp)
jmp    1250 <main+0x80>
cmp    $0xffffffff,%eax
jne    1250 <main+0x80>
mov    0xc(%rsp),%esi
lea    0xda4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xda7(%rip),%rdi
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd9e(%rip),%rdi
mov    (%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd96(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x28(%rsp),%rax
lea    -0x1(%rax),%r12d
cmp    $0x2,%r12d
ja     1341 <main+0x171>
movslq %r12d,%rax
lea    0xd10(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1348 <main+0x178>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
je     1365 <main+0x195>
cmp    %ebx,%ebp
jg     1365 <main+0x195>
test   %ebx,%ebx
je     1365 <main+0x195>
lea    0xdcc(%rip),%rdi
jmp    140d <main+0x23d>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     13fd <main+0x22d>
test   %r13,%r13
je     1406 <main+0x236>
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1050 <ReadFile@plt>
mov    %rax,%r14
mov    0x8(%rsp),%ebp
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1090 <memcpy@plt>
cmpl   $0x0,0x10(%r15)
jle    13f4 <main+0x224>
movslq (%r15),%rax
lea    (%r15,%rax,1),%r14
mov    0x8(%r15),%rcx
movslq (%r14,%rcx,8),%rbp
add    %r15,%rbp
lea    (%rax,%r15,1),%r13
add    $0x4,%r13
xor    %ebx,%ebx
nop
movslq 0x0(%r13,%rbx,8),%rdi
add    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1429 <main+0x259>
add    $0x1,%rbx
movslq 0x10(%r15),%rax
cmp    %rax,%rbx
jl     13d0 <main+0x200>
lea    0xd26(%rip),%rdi
jmp    140d <main+0x23d>
lea    0xcff(%rip),%rdi
jmp    140d <main+0x23d>
lea    0xd05(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq (%r14,%rbx,8),%rax
mov    %rax,0x18(%rsp)
mov    (%rsp),%r14d
sub    0x4(%rsp),%r14d
lea    0xc74(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %r13d,%r13d
cmp    $0x3,%r12d
setb   %bl
mov    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     147e <main+0x2ae>
lea    0xc49(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %bl,%r13b
mov    $0x1,%eax
mov    $0x1,%ebp
mov    (%rsp),%ecx
shl    %cl,%ebp
mov    $0x1,%edx
mov    %r14d,%ecx
shl    %cl,%edx
mov    %edx,(%rsp)
add    $0x1,%r14b
mov    %r14d,%ecx
shl    %cl,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
mov    %r13d,%r12d
jmp    1520 <main+0x350>
mov    %r13d,%r12d
or     %ebx,%r14d
lea    0xc10(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc0e(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x400,%edx
lea    0x30(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
mov    %r13,%rdi
lea    0xbf4(%rip),%rsi
mov    0x20(%rsp),%rdx
mov    %r14d,%ecx
call   10f0 <sprintf@plt>
mov    0x18(%rsp),%rax
mov    %r14d,(%r15,%rax,1)
mov    0x8(%rsp),%edx
mov    %r13,%rdi
mov    %r15,%rsi
call   10a0 <WriteFile@plt>
mov    %r12d,%r13d
mov    %ebx,%eax
mov    0xc(%rsp),%r14d
mov    0x28(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
cmp    $0x3,%ecx
jne    154d <main+0x37d>
cmp    %ebp,%r12d
je     15a5 <main+0x3d5>
mov    %r14d,%ebx
or     %r12d,%ebx
add    %r12d,%r12d
cmp    %r14d,%ebx
je     1530 <main+0x360>
jmp    14b4 <main+0x2e4>
cmp    $0x1,%ecx
je     1575 <main+0x3a5>
cmp    $0x2,%ecx
jne    158c <main+0x3bc>
cmp    (%rsp),%r13d
je     15a5 <main+0x3d5>
mov    %r13d,%edx
mov    0x4(%rsp),%ecx
shl    %cl,%edx
or     %edx,%eax
add    %r13d,%r13d
mov    %r13d,%r12d
mov    %eax,%ebx
jmp    14b4 <main+0x2e4>
cmp    (%rsp),%r13d
je     15a5 <main+0x3d5>
mov    %r13d,%ebx
mov    0x4(%rsp),%ecx
shl    %cl,%ebx
add    %r13d,%r13d
jmp    14b1 <main+0x2e1>
cmp    0x10(%rsp),%r13d
je     15a5 <main+0x3d5>
mov    %r13d,%ebx
mov    0x4(%rsp),%ecx
shl    %cl,%ebx
add    $0x1,%r13d
jmp    14b1 <main+0x2e1>
xor    %eax,%eax
jmp    1417 <main+0x247>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i64, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [12 x i8] c".text.bench\00"
@.str.1 = [18 x i8] c"./data/cubin/fuz/\00"
@.str.2 = [17 x i8] c"b:s:e:m:o:i:n:d:\00"
@optarg = global i8* null
@.str.3 = [4 x i8] c"%lx\00"
@.str.4 = [17 x i8] c"base: 0x%016lx\0A\00"
@.str.5 = [11 x i8] c"start: %d\0A\00"
@.str.6 = [11 x i8] c"end: %d\0A\00"
@.str.7 = [8 x i8] c"mode: \00"
@.str.8 = [31 x i8] c"shift-fill up to e zeros in b\0A\00"
@.str.9 = [11 x i8] c"f|= 1<<i;\0A\00"
@.str.10 = [11 x i8] c"f = 1<<i;\0A\00"
@.str.11 = [11 x i8] c"f = i++; \0A\00"
@.str.12 = [14 x i8] c"End <= Start\0A\00"
@.str.13 = [16 x i8] c"No input file\0A\00"
@.str.14 = [16 x i8] c"No output file\0A\00"
@.str.15 = [12 x i8] c"No section\0A\00"
@.str.16 = [7 x i8] c"l=%ld\0A\00"
@.str.17 = [17 x i8] c"Can't create %s\0A\00"
@.str.18 = [14 x i8] c"f = 0x%016lx\0A\00"
@.str.19 = [14 x i8] c"y = 0x%016lx\0A\00"
@.str.20 = [15 x i8] c"%s%016lx.cubin\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 i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca %struct.TYPE_4__*
%20 = alloca %struct.TYPE_3__*
%21 = alloca i8*
%22 = alloca i32
%23 = alloca %struct.TYPE_3__*
%24 = alloca i8*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca [1024 x i8]
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 i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* null, i8** %11
store i8* null, i8** %12
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %13
store i32 0, i32* %14
br label %30
30: ; preds = %57, %2
%31 = load i32, i32* %4
%32 = load i8**, i8*** %5
%33 = call i32 @getopt(i32 %31, i8** %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 %33, i32* %14
%34 = icmp ne i32 %33, -1
br i1 %34, label %35, label %58
35: ; preds = %30
%36 = load i32, i32* %14
switch i32 %36, label %57 [
i32 98, label %37
i32 115, label %40
i32 101, label %43
i32 109, label %46
i32 111, label %49
i32 105, label %51
i32 110, label %53
i32 100, label %55
]
37: ; preds = %35
%38 = load i8*, i8** @optarg
%39 = call i32 @sscanf(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %6)
br label %57
40: ; preds = %35
%41 = load i8*, i8** @optarg
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %7
br label %57
43: ; preds = %35
%44 = load i8*, i8** @optarg
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %8
br label %57
46: ; preds = %35
%47 = load i8*, i8** @optarg
%48 = call i32 @atoi(i8* %47)
store i32 %48, i32* %9
br label %57
49: ; preds = %35
%50 = load i8*, i8** @optarg
store i8* %50, i8** %11
br label %57
51: ; preds = %35
%52 = load i8*, i8** @optarg
store i8* %52, i8** %12
br label %57
53: ; preds = %35
%54 = load i8*, i8** @optarg
store i8* %54, i8** %10
br label %57
55: ; preds = %35
%56 = load i8*, i8** @optarg
store i8* %56, i8** %13
br label %57
57: ; preds = %35, %55, %53, %51, %49, %46, %43, %40, %37
br label %30
58: ; preds = %30
%59 = load i32, i32* %6
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %8
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %63)
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%66 = load i32, i32* %9
switch i32 %66, label %74 [
i32 3, label %67
i32 2, label %69
i32 1, label %71
i32 0, label %73
]
67: ; preds = %58
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %76
69: ; preds = %58
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
br label %76
71: ; preds = %58
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %76
73: ; preds = %58
br label %74
74: ; preds = %58, %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
br label %76
76: ; preds = %74, %71, %69, %67
%77 = load i32, i32* %8
%78 = load i32, i32* %7
%79 = icmp sle i32 %77, %78
br i1 %79, label %80, label %88
80: ; preds = %76
%81 = load i32, i32* %7
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* %8
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %263
88: ; preds = %83, %80, %76
%89 = load i8*, i8** %12
%90 = icmp ne i8* %89, null
br i1 %90, label %93, label %91
91: ; preds = %88
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %263
93: ; preds = %88
%94 = load i8*, i8** %11
%95 = icmp ne i8* %94, null
br i1 %95, label %98, label %96
96: ; preds = %93
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
store i32 1, i32* %3
br label %263
98: ; preds = %93
store i32 0, i32* %15
%99 = load i8*, i8** %12
%100 = call i8* @ReadFile(i8* %99, i32* %15)
store i8* %100, i8** %16
%101 = load i32, i32* %15
%102 = call i8* @malloc(i32 %101)
store i8* %102, i8** %17
store i8* null, i8** %18
%103 = load i8*, i8** %17
%104 = load i8*, i8** %16
%105 = load i32, i32* %15
%106 = call i32 @memcpy(i8* %103, i8* %104, i32 %105)
%107 = load i8*, i8** %17
%108 = bitcast i8* %107 to %struct.TYPE_4__*
store %struct.TYPE_4__* %108, %struct.TYPE_4__** %19
%109 = load i8*, i8** %17
%110 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%111 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %110, i32 0, i32 0
%112 = load i32, i32* %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %109, i64 %113
%115 = bitcast i8* %114 to %struct.TYPE_3__*
store %struct.TYPE_3__* %115, %struct.TYPE_3__** %20
%116 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%117 = bitcast %struct.TYPE_4__* %116 to i8*
%118 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%119 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%120 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %119, i32 0, i32 1
%121 = load i64, i64* %120
%122 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %118, i64 %121
%123 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %122, i32 0, i32 0
%124 = load i32, i32* %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %117, i64 %125
store i8* %126, i8** %21
store i32 0, i32* %22
br label %127
127: ; preds = %157, %98
%128 = load i32, i32* %22
%129 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%130 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %129, i32 0, i32 2
%131 = load i32, i32* %130
%132 = icmp slt i32 %128, %131
br i1 %132, label %133, label %160
133: ; preds = %127
%134 = load %struct.TYPE_3__*, %struct.TYPE_3__** %20
%135 = load i32, i32* %22
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %134, i64 %136
store %struct.TYPE_3__* %137, %struct.TYPE_3__** %23
%138 = load i8*, i8** %21
%139 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%140 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %139, i32 0, i32 1
%141 = load i32, i32* %140
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8, i8* %138, i64 %142
store i8* %143, i8** %24
%144 = load i8*, i8** %24
%145 = load i8*, i8** %10
%146 = call i64 @strcmp(i8* %144, i8* %145)
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %156
148: ; preds = %133
%149 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%150 = bitcast %struct.TYPE_4__* %149 to i8*
%151 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%152 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %151, i32 0, i32 0
%153 = load i32, i32* %152
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8, i8* %150, i64 %154
store i8* %155, i8** %18
br label %160
156: ; preds = %133
br label %157
157: ; preds = %156
%158 = load i32, i32* %22
%159 = add nsw i32 %158, 1
store i32 %159, i32* %22
br label %127
160: ; preds = %148, %127
%161 = load i8*, i8** %18
%162 = icmp ne i8* %161, null
br i1 %162, label %165, label %163
163: ; preds = %160
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
store i32 1, i32* %3
br label %263
165: ; preds = %160
store i32 0, i32* %25
store i32 0, i32* %26
%166 = load i32, i32* %8
%167 = load i32, i32* %7
%168 = sub nsw i32 %166, %167
store i32 %168, i32* %27
%169 = load i32, i32* %27
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %169)
%171 = load i32, i32* %9
switch i32 %171, label %174 [
i32 0, label %172
i32 1, label %173
i32 2, label %173
i32 3, label %173
]
172: ; preds = %165
store i32 0, i32* %25
br label %174
173: ; preds = %165, %165, %165
store i32 1, i32* %25
br label %174
174: ; preds = %165, %173, %172
%175 = load i8*, i8** %13
%176 = call i64 @mkdir(i8* %175, i32 511)
%177 = icmp ne i64 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %174
%179 = load i8*, i8** %13
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* %179)
br label %181
181: ; preds = %178, %174
store i32 0, i32* %22
br label %182
182: ; preds = %181, %199, %241
%183 = load i32, i32* %9
switch i32 %183, label %227 [
i32 3, label %184
i32 2, label %201
i32 1, label %215
i32 0, label %228
]
184: ; preds = %182
%185 = load i32, i32* %25
%186 = load i32, i32* %8
%187 = shl i32 1, %186
%188 = icmp eq i32 %185, %187
br i1 %188, label %189, label %190
189: ; preds = %184
store i32 0, i32* %3
br label %263
190: ; preds = %184
%191 = load i32, i32* %6
%192 = load i32, i32* %25
%193 = or i32 %191, %192
store i32 %193, i32* %26
%194 = load i32, i32* %25
%195 = shl i32 %194, 1
store i32 %195, i32* %25
%196 = load i32, i32* %26
%197 = load i32, i32* %6
%198 = icmp eq i32 %196, %197
br i1 %198, label %199, label %200
199: ; preds = %190
br label %182
200: ; preds = %190
br label %241
201: ; preds = %182
%202 = load i32, i32* %25
%203 = load i32, i32* %27
%204 = shl i32 1, %203
%205 = icmp eq i32 %202, %204
br i1 %205, label %206, label %207
206: ; preds = %201
store i32 0, i32* %3
br label %263
207: ; preds = %201
%208 = load i32, i32* %25
%209 = load i32, i32* %7
%210 = shl i32 %208, %209
%211 = load i32, i32* %26
%212 = or i32 %211, %210
store i32 %212, i32* %26
%213 = load i32, i32* %25
%214 = shl i32 %213, 1
store i32 %214, i32* %25
br label %241
215: ; preds = %182
%216 = load i32, i32* %25
%217 = load i32, i32* %27
%218 = shl i32 1, %217
%219 = icmp eq i32 %216, %218
br i1 %219, label %220, label %221
220: ; preds = %215
store i32 0, i32* %3
br label %263
221: ; preds = %215
%222 = load i32, i32* %25
%223 = load i32, i32* %7
%224 = shl i32 %222, %223
store i32 %224, i32* %26
%225 = load i32, i32* %25
%226 = shl i32 %225, 1
store i32 %226, i32* %25
br label %241
227: ; preds = %182
br label %228
228: ; preds = %182, %227
%229 = load i32, i32* %25
%230 = load i32, i32* %27
%231 = add nsw i32 %230, 1
%232 = shl i32 1, %231
%233 = icmp eq i32 %229, %232
br i1 %233, label %234, label %235
234: ; preds = %228
store i32 0, i32* %3
br label %263
235: ; preds = %228
%236 = load i32, i32* %25
%237 = load i32, i32* %7
%238 = shl i32 %236, %237
store i32 %238, i32* %26
%239 = load i32, i32* %25
%240 = add nsw i32 %239, 1
store i32 %240, i32* %25
br label %241
241: ; preds = %235, %221, %207, %200
%242 = load i32, i32* %6
%243 = load i32, i32* %26
%244 = or i32 %242, %243
store i32 %244, i32* %28
%245 = load i32, i32* %26
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i32 %245)
%247 = load i32, i32* %28
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i32 %247)
%249 = bitcast [1024 x i8]* %29 to i8*
%250 = getelementptr inbounds [1024 x i8], [1024 x i8]* %29, i64 0, i64 0
%251 = load i8*, i8** %13
%252 = load i32, i32* %28
%253 = call i32 @sprintf(i8* %250, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i8* %251, i32 %252)
%254 = load i32, i32* %28
%255 = load i8*, i8** %18
%256 = bitcast i8* %255 to i32*
store i32 %254, i32* %256
%257 = getelementptr inbounds [1024 x i8], [1024 x i8]* %29, i64 0, i64 0
%258 = load i8*, i8** %17
%259 = load i32, i32* %15
%260 = call i32 @WriteFile(i8* %257, i8* %258, i32 %259)
%261 = load i32, i32* %22
%262 = add nsw i32 %261, 1
store i32 %262, i32* %22
br label %182
263: ; preds = %234, %220, %206, %189, %163, %96, %91, %86
%264 = load i32, i32* %3
ret i32 %264
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i64, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [12 x i8] c".text.bench\00"
@.str.1 = [18 x i8] c"./data/cubin/fuz/\00"
@.str.2 = [17 x i8] c"b:s:e:m:o:i:n:d:\00"
@optarg = global i8* null
@.str.3 = [4 x i8] c"%lx\00"
@.str.4 = [17 x i8] c"base: 0x%016lx\0A\00"
@.str.5 = [11 x i8] c"start: %d\0A\00"
@.str.6 = [11 x i8] c"end: %d\0A\00"
@.str.7 = [8 x i8] c"mode: \00"
@.str.16 = [7 x i8] c"l=%ld\0A\00"
@.str.17 = [17 x i8] c"Can't create %s\0A\00"
@.str.18 = [14 x i8] c"f = 0x%016lx\0A\00"
@.str.19 = [14 x i8] c"y = 0x%016lx\0A\00"
@.str.20 = [15 x i8] c"%s%016lx.cubin\00"
@str = [10 x i8] c"f = 1<<i;\00"
@str.21 = [15 x i8] c"No input file\00"
@str.22 = [15 x i8] c"No output file\00"
@str.23 = [11 x i8] c"No section\00"
@str.24 = [13 x i8] c"End <= Start\00"
@str.25 = [10 x i8] c"f|= 1<<i;\00"
@str.26 = [30 x i8] c"shift-fill up to e zeros in b\00"
@str.27 = [10 x i8] c"f = i++; \00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @str to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @str.25 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @str.26 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1024 x i8]
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %16, %2
%8 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %17, %16 ]
%9 = phi i8* [ null, %2 ], [ %18, %16 ]
%10 = phi i8* [ null, %2 ], [ %19, %16 ]
%11 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %2 ], [ %20, %16 ]
%12 = phi i32 [ 0, %2 ], [ %21, %16 ]
%13 = phi i32 [ 0, %2 ], [ %22, %16 ]
%14 = phi i32 [ 0, %2 ], [ %23, %16 ]
%15 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
switch i32 %15, label %16 [
i32 -1, label %44
i32 98, label %24
i32 115, label %27
i32 101, label %30
i32 109, label %33
i32 111, label %36
i32 105, label %38
i32 110, label %40
i32 100, label %42
]
16: ; preds = %7, %42, %40, %38, %36, %33, %30, %27, %24
%17 = phi i8* [ %43, %42 ], [ %8, %40 ], [ %8, %38 ], [ %8, %36 ], [ %8, %33 ], [ %8, %30 ], [ %8, %27 ], [ %8, %24 ], [ %8, %7 ]
%18 = phi i8* [ %9, %42 ], [ %9, %40 ], [ %39, %38 ], [ %9, %36 ], [ %9, %33 ], [ %9, %30 ], [ %9, %27 ], [ %9, %24 ], [ %9, %7 ]
%19 = phi i8* [ %10, %42 ], [ %10, %40 ], [ %10, %38 ], [ %37, %36 ], [ %10, %33 ], [ %10, %30 ], [ %10, %27 ], [ %10, %24 ], [ %10, %7 ]
%20 = phi i8* [ %11, %42 ], [ %41, %40 ], [ %11, %38 ], [ %11, %36 ], [ %11, %33 ], [ %11, %30 ], [ %11, %27 ], [ %11, %24 ], [ %11, %7 ]
%21 = phi i32 [ %12, %42 ], [ %12, %40 ], [ %12, %38 ], [ %12, %36 ], [ %35, %33 ], [ %12, %30 ], [ %12, %27 ], [ %12, %24 ], [ %12, %7 ]
%22 = phi i32 [ %13, %42 ], [ %13, %40 ], [ %13, %38 ], [ %13, %36 ], [ %13, %33 ], [ %32, %30 ], [ %13, %27 ], [ %13, %24 ], [ %13, %7 ]
%23 = phi i32 [ %14, %42 ], [ %14, %40 ], [ %14, %38 ], [ %14, %36 ], [ %14, %33 ], [ %14, %30 ], [ %29, %27 ], [ %14, %24 ], [ %14, %7 ]
br label %7
24: ; preds = %7
%25 = load i8*, i8** @optarg
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %3)
br label %16
27: ; preds = %7
%28 = load i8*, i8** @optarg
%29 = call i32 @atoi(i8* %28)
br label %16
30: ; preds = %7
%31 = load i8*, i8** @optarg
%32 = call i32 @atoi(i8* %31)
br label %16
33: ; preds = %7
%34 = load i8*, i8** @optarg
%35 = call i32 @atoi(i8* %34)
br label %16
36: ; preds = %7
%37 = load i8*, i8** @optarg
br label %16
38: ; preds = %7
%39 = load i8*, i8** @optarg
br label %16
40: ; preds = %7
%41 = load i8*, i8** @optarg
br label %16
42: ; preds = %7
%43 = load i8*, i8** @optarg
br label %16
44: ; preds = %7
%45 = load i32, i32* %3
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%50 = add i32 %12, -1
%51 = icmp ult i32 %50, 3
br i1 %51, label %52, label %56
52: ; preds = %44
%53 = sext i32 %50 to i64
%54 = shl i64 %53, 2
%55 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %54)
br label %56
56: ; preds = %44, %52
%57 = phi i8* [ %55, %52 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.27, i64 0, i64 0), %44 ]
%58 = call i32 @puts(i8* dereferenceable(1) %57)
%59 = icmp sle i32 %13, %14
%60 = icmp ne i32 %14, 0
%61 = and i1 %59, %60
%62 = icmp ne i32 %13, 0
%63 = and i1 %62, %61
br i1 %63, label %64, label %66
64: ; preds = %56
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.24, i64 0, i64 0))
br label %171
66: ; preds = %56
%67 = icmp eq i8* %9, null
br i1 %67, label %68, label %70
68: ; preds = %66
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.21, i64 0, i64 0))
br label %171
70: ; preds = %66
%71 = icmp eq i8* %10, null
br i1 %71, label %72, label %74
72: ; preds = %70
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.22, i64 0, i64 0))
br label %171
74: ; preds = %70
%75 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%76 = call i8* @ReadFile(i8* %9, i32* %4)
%77 = load i32, i32* %4
%78 = call i8* @malloc(i32 %77)
%79 = call i32 @memcpy(i8* %78, i8* %76, i32 %77)
%80 = bitcast i8* %78 to %struct.TYPE_4__*
%81 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %80, i64 0, i32 0
%82 = load i32, i32* %81
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %78, i64 %83
%85 = bitcast i8* %84 to %struct.TYPE_3__*
%86 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %80, i64 0, i32 1
%87 = load i64, i64* %86
%88 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %85, i64 %87, i32 0
%89 = load i32, i32* %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %78, i64 %90
%92 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %80, i64 0, i32 2
%93 = load i32, i32* %92
%94 = icmp sgt i32 %93, 0
br i1 %94, label %95, label %108
95: ; preds = %74, %103
%96 = phi i64 [ %104, %103 ], [ 0, %74 ]
%97 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %85, i64 %96, i32 1
%98 = load i32, i32* %97
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %91, i64 %99
%101 = call i64 @strcmp(i8* %100, i8* %11)
%102 = icmp eq i64 %101, 0
br i1 %102, label %110, label %103
103: ; preds = %95
%104 = add nuw nsw i64 %96, 1
%105 = load i32, i32* %92
%106 = sext i32 %105 to i64
%107 = icmp slt i64 %104, %106
br i1 %107, label %95, label %108
108: ; preds = %103, %74
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.23, i64 0, i64 0))
br label %169
110: ; preds = %95
%111 = and i64 %96, 4294967295
%112 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %85, i64 %111, i32 0
%113 = load i32, i32* %112
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %78, i64 %114
%116 = sub nsw i32 %13, %14
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %116)
%118 = add i32 %12, -1
%119 = icmp ult i32 %118, 3
%120 = zext i1 %119 to i32
%121 = call i64 @mkdir(i8* %8, i32 511)
%122 = icmp eq i64 %121, 0
br i1 %122, label %125, label %123
123: ; preds = %110
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* %8)
br label %125
125: ; preds = %123, %110
%126 = shl nuw i32 1, %13
%127 = shl nuw i32 1, %116
%128 = add nsw i32 %116, 1
%129 = shl nuw i32 1, %128
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%131 = bitcast i8* %115 to i32*
br label %132
132: ; preds = %160, %125
%133 = phi i32 [ %161, %160 ], [ %120, %125 ]
%134 = phi i32 [ %162, %160 ], [ 0, %125 ]
%135 = load i32, i32* %3
br label %136
136: ; preds = %132, %140
%137 = phi i32 [ %142, %140 ], [ %133, %132 ]
switch i32 %12, label %155 [
i32 3, label %138
i32 2, label %144
i32 1, label %150
]
138: ; preds = %136
%139 = icmp eq i32 %137, %126
br i1 %139, label %169, label %140
140: ; preds = %138
%141 = or i32 %135, %137
%142 = shl i32 %137, 1
%143 = icmp eq i32 %141, %135
br i1 %143, label %136, label %160
144: ; preds = %136
%145 = icmp eq i32 %133, %127
br i1 %145, label %169, label %146
146: ; preds = %144
%147 = shl i32 %133, %14
%148 = or i32 %134, %147
%149 = shl i32 %133, 1
br label %160
150: ; preds = %136
%151 = icmp eq i32 %133, %127
br i1 %151, label %169, label %152
152: ; preds = %150
%153 = shl i32 %133, %14
%154 = shl i32 %133, 1
br label %160
155: ; preds = %136
%156 = icmp eq i32 %133, %129
br i1 %156, label %169, label %157
157: ; preds = %155
%158 = shl i32 %133, %14
%159 = add nsw i32 %133, 1
br label %160
160: ; preds = %140, %157, %152, %146
%161 = phi i32 [ %159, %157 ], [ %154, %152 ], [ %149, %146 ], [ %142, %140 ]
%162 = phi i32 [ %158, %157 ], [ %153, %152 ], [ %148, %146 ], [ %141, %140 ]
%163 = or i32 %135, %162
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i32 %162)
%165 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.19, i64 0, i64 0), i32 %163)
%166 = call i32 @sprintf(i8* %130, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i8* %8, i32 %163)
store i32 %163, i32* %131
%167 = load i32, i32* %4
%168 = call i32 @WriteFile(i8* %130, i8* %78, i32 %167)
br label %132
169: ; preds = %144, %150, %155, %138, %108
%170 = phi i32 [ 1, %108 ], [ 0, %138 ], [ 0, %155 ], [ 0, %150 ], [ 0, %144 ]
br label %171
171: ; preds = %169, %72, %68, %64
%172 = phi i32 [ 1, %64 ], [ %170, %169 ], [ 1, %72 ], [ 1, %68 ]
ret i32 %172
}