#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fread(void *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void create_numbers_file(FILE *stream, char *outfile) {
  int err;
  short height, depth, totalwidth;
  int numbers = 17;
  int width[17] = {9, 7, 8, 6, 9, 7, 8, 7, 8, 7, 10, 7, 9, 10, 7, 6, 4};
  int numPos[17] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  int **pixmap;
  int row, col, item, line = 0, currWidth;
  int nextP, currP;
  int count, currNum;
  FILE *out_stream;
  printf("\nReading numbers file...\n");
  fread((void *)&totalwidth, sizeof(short), 1, stream);
  printf("got width: %d\n", totalwidth);
  fread((void *)&height, sizeof(short), 1, stream);
  printf("got height: %d\n", height);
  fread((void *)&depth, sizeof(short), 1, stream);
  printf("got depth: %d\n", depth);
  if (!(width && height && depth)) {
    printf("Invalid numbers file header (width, height, or depth is 0)\n");
    return;
  }
  pixmap = (int **)malloc(17 * sizeof(int *));
  for (item = 0; item < 17; item++)
    pixmap[item] = (int *)malloc(2 * width[item] * height * sizeof(int));
  currP = -1;
  count = 0;
  currWidth = 0;
  currNum = 0;
  for (row = 0; row < height; row++) {
    for (item = 0; item < numbers; item++) {
      count = 0;
      currP = -1;
      for (col = 0; col < width[item]; col++) {
        nextP = fgetc(stream);
        if (nextP == currP) {
          if (count == 127) {
            pixmap[item][numPos[item]] = count;
            pixmap[item][numPos[item] + 1] = currP;
            numPos[item] += 2;
            count = 0;
            currP = -1;
          } else
            count++;
        } else {
          if (currP != -1) {
            pixmap[item][numPos[item]] = count;
            pixmap[item][numPos[item] + 1] = currP;
            numPos[item] += 2;
          }
          currP = nextP;
          count = 1;
        }
      }
      if (count > 0) {
        pixmap[item][numPos[item]] = count;
        pixmap[item][numPos[item] + 1] = currP;
        numPos[item] += 2;
      }
    }
  }
  if (outfile == NULL)
    outfile = "rendered_numbers.c";
  out_stream = fopen(outfile, "w");
  if (out_stream == NULL) {
    printf("couldn't open numbers outfile.. bailing\n");
    exit(1);
  }
  fprintf(out_stream, " /* generated c file */\n\n");
  for (item = 0; item < numbers; item++) {
    fprintf(out_stream, "static const struct {\n");
    fprintf(out_stream, "  unsigned int 	 num_w;\n");
    fprintf(out_stream, "  unsigned int 	 num_h;\n");
    fprintf(out_stream, "  unsigned char	 num_pixel_data[%#4.2x];\n",
            numPos[item]);
    item == 16 ? fprintf(out_stream, "} num_colon = {\n")
               : fprintf(out_stream, "} num_%x = {\n", item);
    fprintf(out_stream, "/* w */ %d,\n", width[item]);
    fprintf(out_stream, "/* h */ %d,\n", height);
    fprintf(out_stream, "/* pixel_data */ \n");
    for (col = 0; col < numPos[item];) {
      fprintf(out_stream, "0x%.2x,0x%.2x", pixmap[item][col],
              pixmap[item][col + 1]);
      if (col == (numPos[item] - 2))
        fprintf(out_stream, "\n};\n\n");
      else
        fprintf(out_stream, ", ");
      line += pixmap[item][col];
      if (line >= width[item]) {
        fprintf(out_stream, "\n");
        line = 0;
      }
      col += 2;
    }
  }
  fclose(out_stream);
}


x86 assembly (clang, -O0):
<create_numbers_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x11,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x44,%edx
call   1090 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x44,%edx
call   1060 <memset@plt>
movl   $0x0,-0xd8(%rbp)
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1a(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movswl -0x1a(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x16(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movswl -0x16(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movswl -0x18(%rbp),%esi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rax
cmp    $0x0,%rax
je     129d <create_numbers_file+0xfd>
movswl -0x16(%rbp),%eax
cmp    $0x0,%eax
je     129d <create_numbers_file+0xfd>
movswl -0x18(%rbp),%eax
cmp    $0x0,%eax
jne    12b0 <create_numbers_file+0x110>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18ac <create_numbers_file+0x70c>
mov    $0x88,%edi
call   10a0 <malloc@plt>
mov    %rax,-0xc8(%rbp)
movl   $0x0,-0xd4(%rbp)
cmpl   $0x11,-0xd4(%rbp)
jge    1323 <create_numbers_file+0x183>
movslq -0xd4(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
shl    $0x1,%eax
movswl -0x16(%rbp),%ecx
imul   %ecx,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,%rdx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    12cb <create_numbers_file+0x12b>
movl   $0xffffffff,-0xe4(%rbp)
ff ff ff
movl   $0x0,-0xe8(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xec(%rbp)
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
movswl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jge    15de <create_numbers_file+0x43e>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    15c5 <create_numbers_file+0x425>
movl   $0x0,-0xe8(%rbp)
movl   $0xffffffff,-0xe4(%rbp)
ff ff ff
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
movslq -0xd4(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    152e <create_numbers_file+0x38e>
mov    -0x8(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0xe0(%rbp)
mov    -0xe0(%rbp),%eax
cmp    -0xe4(%rbp),%eax
jne    1481 <create_numbers_file+0x2e1>
cmpl   $0x7f,-0xe8(%rbp)
jne    146d <create_numbers_file+0x2cd>
mov    -0xe8(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
movslq -0xc0(%rbp,%rcx,4),%rcx
ff
mov    %edx,(%rax,%rcx,4)
mov    -0xe4(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
mov    -0xc0(%rbp,%rcx,4),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0xd4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%ecx
add    $0x2,%ecx
mov    %ecx,-0xc0(%rbp,%rax,4)
movl   $0x0,-0xe8(%rbp)
movl   $0xffffffff,-0xe4(%rbp)
ff ff ff
jmp    147c <create_numbers_file+0x2dc>
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    1515 <create_numbers_file+0x375>
cmpl   $0xffffffff,-0xe4(%rbp)
je     14ff <create_numbers_file+0x35f>
mov    -0xe8(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
movslq -0xc0(%rbp,%rcx,4),%rcx
ff
mov    %edx,(%rax,%rcx,4)
mov    -0xe4(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
mov    -0xc0(%rbp,%rcx,4),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0xd4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%ecx
add    $0x2,%ecx
mov    %ecx,-0xc0(%rbp,%rax,4)
mov    -0xe0(%rbp),%eax
mov    %eax,-0xe4(%rbp)
movl   $0x1,-0xe8(%rbp)
jmp    151a <create_numbers_file+0x37a>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    139e <create_numbers_file+0x1fe>
cmpl   $0x0,-0xe8(%rbp)
jle    15ac <create_numbers_file+0x40c>
mov    -0xe8(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
movslq -0xc0(%rbp,%rcx,4),%rcx
ff
mov    %edx,(%rax,%rcx,4)
mov    -0xe4(%rbp),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd4(%rbp),%rcx
mov    -0xc0(%rbp,%rcx,4),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0xd4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%ecx
add    $0x2,%ecx
mov    %ecx,-0xc0(%rbp,%rax,4)
jmp    15b1 <create_numbers_file+0x411>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1371 <create_numbers_file+0x1d1>
jmp    15ca <create_numbers_file+0x42a>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1355 <create_numbers_file+0x1b5>
cmpq   $0x0,-0x10(%rbp)
jne    15f4 <create_numbers_file+0x454>
lea    0xad8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xadc(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xf8(%rbp)
cmpq   $0x0,-0xf8(%rbp)
jne    1631 <create_numbers_file+0x491>
lea    0xabd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0xf8(%rbp),%rdi
lea    0xac7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    18a0 <create_numbers_file+0x700>
mov    -0xf8(%rbp),%rdi
lea    0xab3(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
lea    0xab5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
lea    0xab9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
movslq -0xd4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%edx
lea    0xaaf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
cmpl   $0x10,-0xd4(%rbp)
jne    16e8 <create_numbers_file+0x548>
mov    -0xf8(%rbp),%rdi
lea    0xab7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1703 <create_numbers_file+0x563>
mov    -0xf8(%rbp),%rdi
mov    -0xd4(%rbp),%edx
lea    0xaa8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
movslq -0xd4(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%edx
lea    0xa96(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
movswl -0x16(%rbp),%edx
lea    0xa8a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xf8(%rbp),%rdi
lea    0xa82(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
movslq -0xd4(%rbp),%rcx
cmp    -0xc0(%rbp,%rcx,4),%eax
jge    1887 <create_numbers_file+0x6e7>
mov    -0xf8(%rbp),%rdi
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xd0(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xa1f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xd0(%rbp),%eax
movslq -0xd4(%rbp),%rcx
mov    -0xc0(%rbp,%rcx,4),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jne    1800 <create_numbers_file+0x660>
mov    -0xf8(%rbp),%rdi
lea    0x9f9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1815 <create_numbers_file+0x675>
mov    -0xf8(%rbp),%rdi
lea    0x9e5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xd8(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
movslq -0xd4(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jl     1873 <create_numbers_file+0x6d3>
mov    -0xf8(%rbp),%rdi
lea    0x8bc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0xd8(%rbp)
mov    -0xd0(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xd0(%rbp)
jmp    175b <create_numbers_file+0x5bb>
jmp    188c <create_numbers_file+0x6ec>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1650 <create_numbers_file+0x4b0>
mov    -0xf8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_numbers_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x0,0x70(%rsp)
lea    0xf8d(%rip),%rdi
call   1030 <puts@plt>
lea    0x12(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movswl 0x12(%rsp),%esi
lea    0xe32(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x16(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movswl 0x16(%rsp),%r12d
lea    0xe16(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x14(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movzwl 0x14(%rsp),%ebp
movswl %bp,%esi
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r12d,%r12d
je     14cc <create_numbers_file+0x31c>
test   %bp,%bp
je     14cc <create_numbers_file+0x31c>
mov    %r14,0x28(%rsp)
mov    $0x88,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
lea    0x0(,%r12,8),%eax
lea    (%rax,%rax,8),%edi
mov    %edi,0x8(%rsp)
call   10a0 <malloc@plt>
mov    %rax,(%r14)
imul   $0x38,%r12d,%r13d
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x8(%r14)
mov    %r12d,%r15d
shl    $0x6,%r15d
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x10(%r14)
mov    %r12d,%ebp
shl    $0x4,%ebp
lea    0x0(%rbp,%rbp,2),%edi
mov    %edi,0x18(%rsp)
call   10a0 <malloc@plt>
mov    %rax,0x18(%r14)
mov    0x8(%rsp),%edi
call   10a0 <malloc@plt>
mov    %rax,0x20(%r14)
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x28(%r14)
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x30(%r14)
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x38(%r14)
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x40(%r14)
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x48(%r14)
lea    0x0(%rbp,%rbp,4),%ebp
mov    %ebp,%edi
call   10a0 <malloc@plt>
mov    %rax,0x50(%r14)
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x58(%r14)
mov    0x8(%rsp),%edi
call   10a0 <malloc@plt>
mov    %rax,0x60(%r14)
mov    %ebp,%edi
call   10a0 <malloc@plt>
mov    %rax,0x68(%r14)
mov    %r13d,%edi
call   10a0 <malloc@plt>
mov    %rax,0x70(%r14)
mov    0x18(%rsp),%edi
call   10a0 <malloc@plt>
mov    %rax,0x78(%r14)
mov    %r12d,%edi
shl    $0x5,%edi
call   10a0 <malloc@plt>
mov    %r14,0x8(%rsp)
mov    %rax,0x80(%r14)
test   %r12w,%r12w
mov    %r12,0x20(%rsp)
jle    14e6 <create_numbers_file+0x336>
xor    %eax,%eax
jmp    13c6 <create_numbers_file+0x216>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rax
add    $0x1,%eax
mov    0x20(%rsp),%r12
cmp    %r12d,%eax
je     14e6 <create_numbers_file+0x336>
mov    %rax,0x18(%rsp)
xor    %ebp,%ebp
jmp    13da <create_numbers_file+0x22a>
nop
add    $0x1,%rbp
cmp    $0x11,%rbp
je     13b0 <create_numbers_file+0x200>
lea    0xc1f(%rip),%rax
mov    (%rax,%rbp,4),%r14d
cmp    $0x2,%r14d
mov    $0x1,%eax
cmovl  %eax,%r14d
mov    $0xffffffff,%r15d
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1416 <create_numbers_file+0x266>
mov    %eax,%r15d
mov    $0x1,%r12d
add    $0x1,%r13d
cmp    %r14d,%r13d
je     14a0 <create_numbers_file+0x2f0>
mov    %rbx,%rdi
call   1070 <fgetc@plt>
cmp    %r15d,%eax
jne    1430 <create_numbers_file+0x280>
cmp    $0x7f,%r12d
je     1456 <create_numbers_file+0x2a6>
add    $0x1,%r12d
jmp    1409 <create_numbers_file+0x259>
nop
cmp    $0xffffffff,%r15d
je     1400 <create_numbers_file+0x250>
mov    0x8(%rsp),%rcx
mov    (%rcx,%rbp,8),%rcx
movslq 0x30(%rsp,%rbp,4),%rdx
mov    %r12d,(%rcx,%rdx,4)
mov    %r15d,0x4(%rcx,%rdx,4)
lea    0x2(%rdx),%ecx
mov    %ecx,0x30(%rsp,%rbp,4)
jmp    1400 <create_numbers_file+0x250>
mov    0x8(%rsp),%rax
mov    (%rax,%rbp,8),%rax
movslq 0x30(%rsp,%rbp,4),%rcx
movl   $0x7f,(%rax,%rcx,4)
mov    %r15d,0x4(%rax,%rcx,4)
lea    0x2(%rcx),%eax
mov    %eax,0x30(%rsp,%rbp,4)
add    $0x1,%r13d
mov    $0x0,%r12d
mov    $0xffffffff,%r15d
cmp    %r14d,%r13d
jne    1416 <create_numbers_file+0x266>
jmp    13d0 <create_numbers_file+0x220>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %r12d,%r12d
jle    13d0 <create_numbers_file+0x220>
mov    0x8(%rsp),%rax
mov    (%rax,%rbp,8),%rax
movslq 0x30(%rsp,%rbp,4),%rcx
mov    %r12d,(%rax,%rcx,4)
mov    %r15d,0x4(%rax,%rcx,4)
lea    0x2(%rcx),%eax
mov    %eax,0x30(%rsp,%rbp,4)
jmp    13d0 <create_numbers_file+0x220>
lea    0xcbd(%rip),%rdi
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
mov    0x28(%rsp),%rax
test   %rax,%rax
lea    0xb7d(%rip),%rdi
cmovne %rax,%rdi
lea    0xb85(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1708 <create_numbers_file+0x558>
mov    %rax,%rbx
lea    0xb6f(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10d0 <fwrite@plt>
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1553 <create_numbers_file+0x3a3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
cmp    $0x11,%r14
mov    0x20(%rsp),%r12
je     16f2 <create_numbers_file+0x542>
mov    $0x16,%esi
mov    $0x1,%edx
lea    0xb3d(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    $0x18,%esi
mov    $0x1,%edx
lea    0xb3b(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    $0x18,%esi
mov    $0x1,%edx
lea    0xb3b(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    0x30(%rsp,%r14,4),%ebp
mov    %rbx,%rdi
lea    0xb3d(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    $0x10,%r14
jne    15e0 <create_numbers_file+0x430>
mov    $0x10,%esi
mov    $0x1,%edx
lea    0xb47(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
jmp    15f4 <create_numbers_file+0x444>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xb3b(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xa05(%rip),%rax
mov    (%rax,%r14,4),%edx
mov    %rbx,%rdi
lea    0xb2a(%rip),%rsi
mov    %edx,0x18(%rsp)
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
lea    0xb22(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x12,%esi
mov    $0x1,%edx
lea    0xb14(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
test   %ebp,%ebp
jle    1540 <create_numbers_file+0x390>
mov    %rbp,%r12
add    $0xfffffffe,%ebp
xor    %r15d,%r15d
jmp    166d <create_numbers_file+0x4bd>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%r15
cmp    %r15d,%r12d
jle    1540 <create_numbers_file+0x390>
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%rax
mov    (%rax,%r15,4),%edx
mov    0x4(%rax,%r15,4),%ecx
mov    %rbx,%rdi
lea    0xad7(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    %r15,%rbp
jne    16b0 <create_numbers_file+0x500>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xac8(%rip),%rdi
jmp    16c1 <create_numbers_file+0x511>
nopl   0x0(%rax,%rax,1)
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xab3(%rip),%rdi
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%rax
add    (%rax,%r15,4),%r13d
cmp    0x18(%rsp),%r13d
jl     1660 <create_numbers_file+0x4b0>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1080 <fputc@plt>
xor    %r13d,%r13d
jmp    1660 <create_numbers_file+0x4b0>
mov    %rbx,%rdi
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fclose@plt>
lea    0xabc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@__const.create_numbers_file.width = [17 x i32] [i32 9, i32 7, i32 8, i32 6, i32 9, i32 7, i32 8, i32 7, i32 8, i32 7, i32 10, i32 7, i32 9, i32 10, i32 7, i32 6, i32 4]
@.str = [26 x i8] c"\0AReading numbers file...\0A\00"
@.str.1 = [15 x i8] c"got width: %d\0A\00"
@.str.2 = [16 x i8] c"got height: %d\0A\00"
@.str.3 = [15 x i8] c"got depth: %d\0A\00"
@.str.4 = [60 x i8] c"Invalid numbers file header (width, height, or depth is 0)\0A\00"
@.str.5 = [19 x i8] c"rendered_numbers.c\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [41 x i8] c"couldn't open numbers outfile.. bailing\0A\00"
@.str.8 = [26 x i8] c" /* generated c file */\0A\0A\00"
@.str.9 = [23 x i8] c"static const struct {\0A\00"
@.str.10 = [25 x i8] c" unsigned int \09 num_w;\0A\00"
@.str.11 = [25 x i8] c" unsigned int \09 num_h;\0A\00"
@.str.12 = [42 x i8] c" unsigned char\09 num_pixel_data[%.2x];\0A\00"
@.str.13 = [17 x i8] c"} num_colon = {\0A\00"
@.str.14 = [14 x i8] c"} num_%x = {\0A\00"
@.str.15 = [13 x i8] c"/* w */ %d,\0A\00"
@.str.16 = [13 x i8] c"/* h */ %d,\0A\00"
@.str.17 = [19 x i8] c"/* pixel_data */ \0A\00"
@.str.18 = [14 x i8] c"0x%.2x,0x%.2x\00"
@.str.19 = [6 x i8] c"\0A};\0A\0A\00"
@.str.20 = [3 x i8] c", \00"
@.str.21 = [2 x i8] c"\0A\00"
define void @create_numbers_file(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i32
%10 = alloca [17 x i32]
%11 = alloca [17 x i32]
%12 = alloca i32**
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 17, i32* %9
%23 = bitcast [17 x i32]* %10 to i8*
%24 = bitcast [17 x i32]* %11 to i8*
store i32 0, i32* %16
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%26 = bitcast i16* %8 to i8*
%27 = load i32*, i32** %3
%28 = call i32 @fread(i8* %26, i32 2, i32 1, i32* %27)
%29 = load i16, i16* %8
%30 = sext i16 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = bitcast i16* %6 to i8*
%33 = load i32*, i32** %3
%34 = call i32 @fread(i8* %32, i32 2, i32 1, i32* %33)
%35 = load i16, i16* %6
%36 = sext i16 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = bitcast i16* %7 to i8*
%39 = load i32*, i32** %3
%40 = call i32 @fread(i8* %38, i32 2, i32 1, i32* %39)
%41 = load i16, i16* %7
%42 = sext i16 %41 to i32
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [17 x i32], [17 x i32]* %10, i64 0, i64 0
%45 = icmp ne i32* %44, null
br i1 %45, label %46, label %54
46: ; preds = %2
%47 = load i16, i16* %6
%48 = sext i16 %47 to i32
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = load i16, i16* %7
%52 = sext i16 %51 to i32
%53 = icmp ne i32 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %50, %46, %2
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
br label %356
56: ; preds = %50
%57 = call i64 @malloc(i32 136)
%58 = inttoptr i64 %57 to i32**
store i32** %58, i32*** %12
store i32 0, i32* %15
br label %59
59: ; preds = %80, %56
%60 = load i32, i32* %15
%61 = icmp slt i32 %60, 17
br i1 %61, label %62, label %83
62: ; preds = %59
%63 = load i32, i32* %15
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [17 x i32], [17 x i32]* %10, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = mul nsw i32 2, %66
%68 = load i16, i16* %6
%69 = sext i16 %68 to i32
%70 = mul nsw i32 %67, %69
%71 = sext i32 %70 to i64
%72 = mul i64 %71, 4
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to i32*
%76 = load i32**, i32*** %12
%77 = load i32, i32* %15
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32*, i32** %76, i64 %78
store i32* %75, i32** %79
br label %80
80: ; preds = %62
%81 = load i32, i32* %15
%82 = add nsw i32 %81, 1
store i32 %82, i32* %15
br label %59
83: ; preds = %59
store i32 -1, i32* %19
store i32 0, i32* %20
store i32 0, i32* %17
store i32 0, i32* %21
store i32 0, i32* %13
br label %84
84: ; preds = %225, %83
%85 = load i32, i32* %13
%86 = load i16, i16* %6
%87 = sext i16 %86 to i32
%88 = icmp slt i32 %85, %87
br i1 %88, label %89, label %228
89: ; preds = %84
store i32 0, i32* %15
br label %90
90: ; preds = %221, %89
%91 = load i32, i32* %15
%92 = load i32, i32* %9
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %224
94: ; preds = %90
store i32 0, i32* %20
store i32 -1, i32* %19
store i32 0, i32* %14
br label %95
95: ; preds = %183, %94
%96 = load i32, i32* %14
%97 = load i32, i32* %15
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [17 x i32], [17 x i32]* %10, i64 0, i64 %98
%100 = load i32, i32* %99
%101 = icmp slt i32 %96, %100
br i1 %101, label %102, label %186
102: ; preds = %95
%103 = load i32*, i32** %3
%104 = call i32 @fgetc(i32* %103)
store i32 %104, i32* %18
%105 = load i32, i32* %18
%106 = load i32, i32* %19
%107 = icmp eq i32 %105, %106
br i1 %107, label %108, label %146
108: ; preds = %102
%109 = load i32, i32* %20
%110 = icmp eq i32 %109, 127
br i1 %110, label %111, label %142
111: ; preds = %108
%112 = load i32, i32* %20
%113 = load i32**, i32*** %12
%114 = load i32, i32* %15
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i32*, i32** %113, i64 %115
%117 = load i32*, i32** %116
%118 = load i32, i32* %15
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %119
%121 = load i32, i32* %120
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i32, i32* %117, i64 %122
store i32 %112, i32* %123
%124 = load i32, i32* %19
%125 = load i32**, i32*** %12
%126 = load i32, i32* %15
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32*, i32** %125, i64 %127
%129 = load i32*, i32** %128
%130 = load i32, i32* %15
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %131
%133 = load i32, i32* %132
%134 = add nsw i32 %133, 1
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32, i32* %129, i64 %135
store i32 %124, i32* %136
%137 = load i32, i32* %15
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = add nsw i32 %140, 2
store i32 %141, i32* %139
store i32 0, i32* %20
store i32 -1, i32* %19
br label %145
142: ; preds = %108
%143 = load i32, i32* %20
%144 = add nsw i32 %143, 1
store i32 %144, i32* %20
br label %145
145: ; preds = %142, %111
br label %182
146: ; preds = %102
%147 = load i32, i32* %19
%148 = icmp ne i32 %147, -1
br i1 %148, label %149, label %180
149: ; preds = %146
%150 = load i32, i32* %20
%151 = load i32**, i32*** %12
%152 = load i32, i32* %15
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i32*, i32** %151, i64 %153
%155 = load i32*, i32** %154
%156 = load i32, i32* %15
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %157
%159 = load i32, i32* %158
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i32, i32* %155, i64 %160
store i32 %150, i32* %161
%162 = load i32, i32* %19
%163 = load i32**, i32*** %12
%164 = load i32, i32* %15
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i32*, i32** %163, i64 %165
%167 = load i32*, i32** %166
%168 = load i32, i32* %15
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %169
%171 = load i32, i32* %170
%172 = add nsw i32 %171, 1
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i32, i32* %167, i64 %173
store i32 %162, i32* %174
%175 = load i32, i32* %15
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %176
%178 = load i32, i32* %177
%179 = add nsw i32 %178, 2
store i32 %179, i32* %177
br label %180
180: ; preds = %149, %146
%181 = load i32, i32* %18
store i32 %181, i32* %19
store i32 1, i32* %20
br label %182
182: ; preds = %180, %145
br label %183
183: ; preds = %182
%184 = load i32, i32* %14
%185 = add nsw i32 %184, 1
store i32 %185, i32* %14
br label %95
186: ; preds = %95
%187 = load i32, i32* %20
%188 = icmp sgt i32 %187, 0
br i1 %188, label %189, label %220
189: ; preds = %186
%190 = load i32, i32* %20
%191 = load i32**, i32*** %12
%192 = load i32, i32* %15
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i32*, i32** %191, i64 %193
%195 = load i32*, i32** %194
%196 = load i32, i32* %15
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %197
%199 = load i32, i32* %198
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i32, i32* %195, i64 %200
store i32 %190, i32* %201
%202 = load i32, i32* %19
%203 = load i32**, i32*** %12
%204 = load i32, i32* %15
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds i32*, i32** %203, i64 %205
%207 = load i32*, i32** %206
%208 = load i32, i32* %15
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %209
%211 = load i32, i32* %210
%212 = add nsw i32 %211, 1
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i32, i32* %207, i64 %213
store i32 %202, i32* %214
%215 = load i32, i32* %15
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %216
%218 = load i32, i32* %217
%219 = add nsw i32 %218, 2
store i32 %219, i32* %217
br label %220
220: ; preds = %189, %186
br label %221
221: ; preds = %220
%222 = load i32, i32* %15
%223 = add nsw i32 %222, 1
store i32 %223, i32* %15
br label %90
224: ; preds = %90
br label %225
225: ; preds = %224
%226 = load i32, i32* %13
%227 = add nsw i32 %226, 1
store i32 %227, i32* %13
br label %84
228: ; preds = %84
%229 = load i8*, i8** %4
%230 = icmp eq i8* %229, null
br i1 %230, label %231, label %232
231: ; preds = %228
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8** %4
br label %232
232: ; preds = %231, %228
%233 = load i8*, i8** %4
%234 = call i32* @fopen(i8* %233, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %234, i32** %22
%235 = load i32*, i32** %22
%236 = icmp eq i32* %235, null
br i1 %236, label %237, label %240
237: ; preds = %232
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%239 = call i32 @exit(i32 1)
unreachable
240: ; preds = %232
%241 = load i32*, i32** %22
%242 = call i32 (i32*, i8*, ...) @fprintf(i32* %241, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %15
br label %243
243: ; preds = %350, %240
%244 = load i32, i32* %15
%245 = load i32, i32* %9
%246 = icmp slt i32 %244, %245
br i1 %246, label %247, label %353
247: ; preds = %243
%248 = load i32*, i32** %22
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %248, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%250 = load i32*, i32** %22
%251 = call i32 (i32*, i8*, ...) @fprintf(i32* %250, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%252 = load i32*, i32** %22
%253 = call i32 (i32*, i8*, ...) @fprintf(i32* %252, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%254 = load i32*, i32** %22
%255 = load i32, i32* %15
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %256
%258 = load i32, i32* %257
%259 = call i32 (i32*, i8*, ...) @fprintf(i32* %254, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i32 %258)
%260 = load i32, i32* %15
%261 = icmp eq i32 %260, 16
br i1 %261, label %262, label %265
262: ; preds = %247
%263 = load i32*, i32** %22
%264 = call i32 (i32*, i8*, ...) @fprintf(i32* %263, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
br label %269
265: ; preds = %247
%266 = load i32*, i32** %22
%267 = load i32, i32* %15
%268 = call i32 (i32*, i8*, ...) @fprintf(i32* %266, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %267)
br label %269
269: ; preds = %265, %262
%270 = phi i32 [ %264, %262 ], [ %268, %265 ]
%271 = load i32*, i32** %22
%272 = load i32, i32* %15
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds [17 x i32], [17 x i32]* %10, i64 0, i64 %273
%275 = load i32, i32* %274
%276 = call i32 (i32*, i8*, ...) @fprintf(i32* %271, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i32 %275)
%277 = load i32*, i32** %22
%278 = load i16, i16* %6
%279 = sext i16 %278 to i32
%280 = call i32 (i32*, i8*, ...) @fprintf(i32* %277, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i32 %279)
%281 = load i32*, i32** %22
%282 = call i32 (i32*, i8*, ...) @fprintf(i32* %281, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %14
br label %283
283: ; preds = %346, %269
%284 = load i32, i32* %14
%285 = load i32, i32* %15
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %286
%288 = load i32, i32* %287
%289 = icmp slt i32 %284, %288
br i1 %289, label %290, label %349
290: ; preds = %283
%291 = load i32*, i32** %22
%292 = load i32**, i32*** %12
%293 = load i32, i32* %15
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds i32*, i32** %292, i64 %294
%296 = load i32*, i32** %295
%297 = load i32, i32* %14
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds i32, i32* %296, i64 %298
%300 = load i32, i32* %299
%301 = load i32**, i32*** %12
%302 = load i32, i32* %15
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds i32*, i32** %301, i64 %303
%305 = load i32*, i32** %304
%306 = load i32, i32* %14
%307 = add nsw i32 %306, 1
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds i32, i32* %305, i64 %308
%310 = load i32, i32* %309
%311 = call i32 (i32*, i8*, ...) @fprintf(i32* %291, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i32 %300, i32 %310)
%312 = load i32, i32* %14
%313 = load i32, i32* %15
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds [17 x i32], [17 x i32]* %11, i64 0, i64 %314
%316 = load i32, i32* %315
%317 = sub nsw i32 %316, 2
%318 = icmp eq i32 %312, %317
br i1 %318, label %319, label %322
319: ; preds = %290
%320 = load i32*, i32** %22
%321 = call i32 (i32*, i8*, ...) @fprintf(i32* %320, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
br label %325
322: ; preds = %290
%323 = load i32*, i32** %22
%324 = call i32 (i32*, i8*, ...) @fprintf(i32* %323, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
br label %325
325: ; preds = %322, %319
%326 = load i32**, i32*** %12
%327 = load i32, i32* %15
%328 = sext i32 %327 to i64
%329 = getelementptr inbounds i32*, i32** %326, i64 %328
%330 = load i32*, i32** %329
%331 = load i32, i32* %14
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i32, i32* %330, i64 %332
%334 = load i32, i32* %333
%335 = load i32, i32* %16
%336 = add nsw i32 %335, %334
store i32 %336, i32* %16
%337 = load i32, i32* %16
%338 = load i32, i32* %15
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds [17 x i32], [17 x i32]* %10, i64 0, i64 %339
%341 = load i32, i32* %340
%342 = icmp sge i32 %337, %341
br i1 %342, label %343, label %346
343: ; preds = %325
%344 = load i32*, i32** %22
%345 = call i32 (i32*, i8*, ...) @fprintf(i32* %344, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
store i32 0, i32* %16
br label %346
346: ; preds = %343, %325
%347 = load i32, i32* %14
%348 = add nsw i32 %347, 2
store i32 %348, i32* %14
br label %283
349: ; preds = %283
br label %350
350: ; preds = %349
%351 = load i32, i32* %15
%352 = add nsw i32 %351, 1
store i32 %352, i32* %15
br label %243
353: ; preds = %243
%354 = load i32*, i32** %22
%355 = call i32 @fclose(i32* %354)
br label %356
356: ; preds = %353, %54
ret void
}

LLVM IR (-O2):
@__const.create_numbers_file.width = [17 x i32] [i32 9, i32 7, i32 8, i32 6, i32 9, i32 7, i32 8, i32 7, i32 8, i32 7, i32 10, i32 7, i32 9, i32 10, i32 7, i32 6, i32 4]
@.str.1 = [15 x i8] c"got width: %d\0A\00"
@.str.2 = [16 x i8] c"got height: %d\0A\00"
@.str.3 = [15 x i8] c"got depth: %d\0A\00"
@.str.5 = [19 x i8] c"rendered_numbers.c\00"
@.str.6 = [2 x i8] c"w\00"
@.str.8 = [26 x i8] c" /* generated c file */\0A\0A\00"
@.str.9 = [23 x i8] c"static const struct {\0A\00"
@.str.10 = [25 x i8] c" unsigned int \09 num_w;\0A\00"
@.str.11 = [25 x i8] c" unsigned int \09 num_h;\0A\00"
@.str.12 = [42 x i8] c" unsigned char\09 num_pixel_data[%.2x];\0A\00"
@.str.13 = [17 x i8] c"} num_colon = {\0A\00"
@.str.14 = [14 x i8] c"} num_%x = {\0A\00"
@.str.15 = [13 x i8] c"/* w */ %d,\0A\00"
@.str.16 = [13 x i8] c"/* h */ %d,\0A\00"
@.str.17 = [19 x i8] c"/* pixel_data */ \0A\00"
@.str.18 = [14 x i8] c"0x%.2x,0x%.2x\00"
@.str.19 = [6 x i8] c"\0A};\0A\0A\00"
@.str.20 = [3 x i8] c", \00"
@str = [25 x i8] c"\0AReading numbers file...\00"
@str.22 = [59 x i8] c"Invalid numbers file header (width, height, or depth is 0)\00"
@str.23 = [40 x i8] c"couldn't open numbers outfile.. bailing\00"
define void @create_numbers_file(i32* nocapture %0, i8* %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = alloca [17 x i32]
%7 = bitcast i16* %3 to i8*
%8 = bitcast i16* %4 to i8*
%9 = bitcast i16* %5 to i8*
%10 = bitcast [17 x i32]* %6 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%12 = call i32 @fread(i8* %9, i32 2, i32 1, i32* %0)
%13 = load i16, i16* %5
%14 = sext i16 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 @fread(i8* %7, i32 2, i32 1, i32* %0)
%17 = load i16, i16* %3
%18 = sext i16 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 @fread(i8* %8, i32 2, i32 1, i32* %0)
%21 = load i16, i16* %4
%22 = sext i16 %21 to i32
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = icmp ne i16 %17, 0
%25 = icmp ne i16 %21, 0
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %29, label %27
27: ; preds = %2
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.22, i64 0, i64 0))
br label %228
29: ; preds = %2
%30 = tail call i64 @malloc(i32 136)
%31 = inttoptr i64 %30 to i32**
%32 = mul nsw i32 %18, 72
%33 = tail call i64 @malloc(i32 %32)
%34 = inttoptr i64 %33 to i32*
store i32* %34, i32** %31
%35 = mul nsw i32 %18, 56
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i32*
%38 = getelementptr inbounds i32*, i32** %31, i64 1
store i32* %37, i32** %38
%39 = shl nsw i32 %18, 6
%40 = tail call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i32*
%42 = getelementptr inbounds i32*, i32** %31, i64 2
store i32* %41, i32** %42
%43 = mul nsw i32 %18, 48
%44 = tail call i64 @malloc(i32 %43)
%45 = inttoptr i64 %44 to i32*
%46 = getelementptr inbounds i32*, i32** %31, i64 3
store i32* %45, i32** %46
%47 = tail call i64 @malloc(i32 %32)
%48 = inttoptr i64 %47 to i32*
%49 = getelementptr inbounds i32*, i32** %31, i64 4
store i32* %48, i32** %49
%50 = tail call i64 @malloc(i32 %35)
%51 = inttoptr i64 %50 to i32*
%52 = getelementptr inbounds i32*, i32** %31, i64 5
store i32* %51, i32** %52
%53 = tail call i64 @malloc(i32 %39)
%54 = inttoptr i64 %53 to i32*
%55 = getelementptr inbounds i32*, i32** %31, i64 6
store i32* %54, i32** %55
%56 = tail call i64 @malloc(i32 %35)
%57 = inttoptr i64 %56 to i32*
%58 = getelementptr inbounds i32*, i32** %31, i64 7
store i32* %57, i32** %58
%59 = tail call i64 @malloc(i32 %39)
%60 = inttoptr i64 %59 to i32*
%61 = getelementptr inbounds i32*, i32** %31, i64 8
store i32* %60, i32** %61
%62 = tail call i64 @malloc(i32 %35)
%63 = inttoptr i64 %62 to i32*
%64 = getelementptr inbounds i32*, i32** %31, i64 9
store i32* %63, i32** %64
%65 = mul nsw i32 %18, 80
%66 = tail call i64 @malloc(i32 %65)
%67 = inttoptr i64 %66 to i32*
%68 = getelementptr inbounds i32*, i32** %31, i64 10
store i32* %67, i32** %68
%69 = tail call i64 @malloc(i32 %35)
%70 = inttoptr i64 %69 to i32*
%71 = getelementptr inbounds i32*, i32** %31, i64 11
store i32* %70, i32** %71
%72 = tail call i64 @malloc(i32 %32)
%73 = inttoptr i64 %72 to i32*
%74 = getelementptr inbounds i32*, i32** %31, i64 12
store i32* %73, i32** %74
%75 = tail call i64 @malloc(i32 %65)
%76 = inttoptr i64 %75 to i32*
%77 = getelementptr inbounds i32*, i32** %31, i64 13
store i32* %76, i32** %77
%78 = tail call i64 @malloc(i32 %35)
%79 = inttoptr i64 %78 to i32*
%80 = getelementptr inbounds i32*, i32** %31, i64 14
store i32* %79, i32** %80
%81 = tail call i64 @malloc(i32 %43)
%82 = inttoptr i64 %81 to i32*
%83 = getelementptr inbounds i32*, i32** %31, i64 15
store i32* %82, i32** %83
%84 = shl nsw i32 %18, 5
%85 = tail call i64 @malloc(i32 %84)
%86 = inttoptr i64 %85 to i32*
%87 = getelementptr inbounds i32*, i32** %31, i64 16
store i32* %86, i32** %87
%88 = icmp sgt i16 %17, 0
br i1 %88, label %89, label %158
89: ; preds = %29, %155
%90 = phi i32 [ %156, %155 ], [ 0, %29 ]
br label %91
91: ; preds = %152, %89
%92 = phi i64 [ 0, %89 ], [ %153, %152 ]
%93 = getelementptr inbounds [17 x i32], [17 x i32]* @__const.create_numbers_file.width, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = getelementptr inbounds i32*, i32** %31, i64 %92
%96 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %92
%97 = call i32 @llvm.smax.i32(i32 %94, i32 1)
br label %98
98: ; preds = %124, %91
%99 = phi i32 [ 0, %91 ], [ %125, %124 ]
%100 = phi i32 [ -1, %91 ], [ %126, %124 ]
%101 = phi i32 [ 0, %91 ], [ %127, %124 ]
%102 = tail call i32 @fgetc(i32* %0)
%103 = icmp eq i32 %102, %100
br i1 %103, label %104, label %108
104: ; preds = %98
%105 = icmp eq i32 %99, 127
br i1 %105, label %128, label %106
106: ; preds = %104
%107 = add nsw i32 %99, 1
br label %119
108: ; preds = %98
%109 = icmp eq i32 %100, -1
br i1 %109, label %119, label %110
110: ; preds = %108
%111 = load i32*, i32** %95
%112 = load i32, i32* %96
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i32, i32* %111, i64 %113
store i32 %99, i32* %114
%115 = add nsw i32 %112, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i32, i32* %111, i64 %116
store i32 %100, i32* %117
%118 = add nsw i32 %112, 2
store i32 %118, i32* %96
br label %119
119: ; preds = %108, %110, %106
%120 = phi i32 [ %100, %106 ], [ %102, %110 ], [ %102, %108 ]
%121 = phi i32 [ %107, %106 ], [ 1, %110 ], [ 1, %108 ]
%122 = add nuw nsw i32 %101, 1
%123 = icmp eq i32 %122, %97
br i1 %123, label %139, label %124
124: ; preds = %119, %128
%125 = phi i32 [ %121, %119 ], [ 0, %128 ]
%126 = phi i32 [ %120, %119 ], [ -1, %128 ]
%127 = phi i32 [ %122, %119 ], [ %137, %128 ]
br label %98
128: ; preds = %104
%129 = load i32*, i32** %95
%130 = load i32, i32* %96
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i32, i32* %129, i64 %131
store i32 127, i32* %132
%133 = add nsw i32 %130, 1
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i32, i32* %129, i64 %134
store i32 %100, i32* %135
%136 = add nsw i32 %130, 2
store i32 %136, i32* %96
%137 = add nuw nsw i32 %101, 1
%138 = icmp eq i32 %137, %97
br i1 %138, label %152, label %124
139: ; preds = %119
%140 = icmp sgt i32 %121, 0
br i1 %140, label %141, label %152
141: ; preds = %139
%142 = getelementptr inbounds i32*, i32** %31, i64 %92
%143 = load i32*, i32** %142
%144 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %92
%145 = load i32, i32* %144
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i32, i32* %143, i64 %146
store i32 %121, i32* %147
%148 = add nsw i32 %145, 1
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %143, i64 %149
store i32 %120, i32* %150
%151 = add nsw i32 %145, 2
store i32 %151, i32* %144
br label %152
152: ; preds = %128, %139, %141
%153 = add nuw nsw i64 %92, 1
%154 = icmp eq i64 %153, 17
br i1 %154, label %155, label %91
155: ; preds = %152
%156 = add nuw nsw i32 %90, 1
%157 = icmp eq i32 %156, %18
br i1 %157, label %158, label %89
158: ; preds = %155, %29
%159 = icmp eq i8* %1, null
%160 = select i1 %159, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %1
%161 = tail call i32* @fopen(i8* %160, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%162 = icmp eq i32* %161, null
br i1 %162, label %163, label %166
163: ; preds = %158
%164 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.23, i64 0, i64 0))
%165 = tail call i32 @exit(i32 1)
unreachable
166: ; preds = %158
%167 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 25, i64 1, i32* %161)
br label %168
168: ; preds = %166, %222
%169 = phi i64 [ 0, %166 ], [ %224, %222 ]
%170 = phi i32 [ 0, %166 ], [ %223, %222 ]
%171 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i64 22, i64 1, i32* %161)
%172 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i64 24, i64 1, i32* %161)
%173 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i64 24, i64 1, i32* %161)
%174 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %169
%175 = load i32, i32* %174
%176 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0), i32 %175)
%177 = icmp eq i64 %169, 16
br i1 %177, label %178, label %180
178: ; preds = %168
%179 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i64 16, i64 1, i32* %161)
br label %183
180: ; preds = %168
%181 = trunc i64 %169 to i32
%182 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %181)
br label %183
183: ; preds = %180, %178
%184 = getelementptr inbounds [17 x i32], [17 x i32]* @__const.create_numbers_file.width, i64 0, i64 %169
%185 = load i32, i32* %184
%186 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i32 %185)
%187 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i32 %18)
%188 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i64 18, i64 1, i32* %161)
%189 = icmp sgt i32 %175, 0
br i1 %189, label %190, label %222
190: ; preds = %183
%191 = getelementptr inbounds i32*, i32** %31, i64 %169
%192 = add nsw i32 %175, -2
%193 = zext i32 %192 to i64
br label %194
194: ; preds = %190, %217
%195 = phi i64 [ 0, %190 ], [ %219, %217 ]
%196 = phi i32 [ %170, %190 ], [ %218, %217 ]
%197 = load i32*, i32** %191
%198 = getelementptr inbounds i32, i32* %197, i64 %195
%199 = load i32, i32* %198
%200 = or i64 %195, 1
%201 = getelementptr inbounds i32, i32* %197, i64 %200
%202 = load i32, i32* %201
%203 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %161, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i32 %199, i32 %202)
%204 = icmp eq i64 %195, %193
br i1 %204, label %205, label %207
205: ; preds = %194
%206 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i64 5, i64 1, i32* %161)
br label %209
207: ; preds = %194
%208 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i64 2, i64 1, i32* %161)
br label %209
209: ; preds = %207, %205
%210 = load i32*, i32** %191
%211 = getelementptr inbounds i32, i32* %210, i64 %195
%212 = load i32, i32* %211
%213 = add nsw i32 %212, %196
%214 = icmp slt i32 %213, %185
br i1 %214, label %217, label %215
215: ; preds = %209
%216 = tail call i32 @fputc(i32 10, i32* %161)
br label %217
217: ; preds = %215, %209
%218 = phi i32 [ 0, %215 ], [ %213, %209 ]
%219 = add nuw i64 %195, 2
%220 = trunc i64 %219 to i32
%221 = icmp sgt i32 %175, %220
br i1 %221, label %194, label %222
222: ; preds = %217, %183
%223 = phi i32 [ %170, %183 ], [ %218, %217 ]
%224 = add nuw nsw i64 %169, 1
%225 = icmp eq i64 %224, 17
br i1 %225, label %226, label %168
226: ; preds = %222
%227 = tail call i32 @fclose(i32* %161)
br label %228
228: ; preds = %226, %27
ret void
}