#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 /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ make_mask(int **, int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_dir(char *, int **, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
void main(int argc, char **argv) {
  FILE *fp;
  char dir1[400];
  char acc1[400];
  char junk[50];
  int DIR1[500][500];
  int ACC1[500][500];
  int NEW[500][500];
  int rows;
  int cols;
  int i, j;
  int AI, BI, CI, DI;
  int AJ, BJ, CJ, DJ;
  int max_acc;
  int new_dir;
  float xllcorner, yllcorner, resolution;
  int void_nr;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <direction file> <accumulation file>\n",
            argv[0]);
    fprintf(stderr, "\tThis program builds a new routing direction file at "
                    "twice the resolution (e.g. 1/8 to 1/4) of the provided "
                    "direction file.  The accumulation file for the current "
                    "direction file must also be provided.\n");
    fprintf(stderr, "\tThe new direction file is output to stdout.\n");
    exit(0);
  }
  strcpy(dir1, argv[1]);
  strcpy(acc1, argv[2]);
  if ((fp = fopen(dir1, "r")) == NULL) {
    printf("Cannot open file %s \n", dir1);
    exit(0);
  }
  fscanf(fp, "%s %d", junk, &cols);
  printf("%-15s %d\n", junk, cols / 2);
  fscanf(fp, "%s %d", junk, &rows);
  printf("%-15s %d\n", junk, rows / 2);
  fscanf(fp, "%s %f", junk, &xllcorner);
  printf("%-15s %.4f\n", junk, xllcorner);
  fscanf(fp, "%s %f", junk, &yllcorner);
  printf("%-15s %.4f\n", junk, yllcorner);
  fscanf(fp, "%s %f", junk, &resolution);
  printf("%-15s %.4f\n", junk, resolution * 2.0);
  fscanf(fp, "%s %d", junk, &void_nr);
  printf("%-15s %d\n", junk, void_nr);
  fclose(fp);
  read_dir(dir1, DIR1, rows, cols);
  read_dir(acc1, ACC1, rows, cols);
  make_mask(DIR1, NEW, rows, cols);
  for (i = 0; i < (rows / 2); i++) {
    for (j = 0; j < (cols / 2); j++) {
      AJ = j * 2;
      AI = i * 2;
      BJ = j * 2 + 1;
      BI = i * 2;
      CJ = j * 2;
      CI = i * 2 + 1;
      DJ = j * 2 + 1;
      DI = i * 2 + 1;
      max_acc = new_dir = 0;
      if (NEW[i][j] > 0) {
        if (DIR1[AI][AJ] == 2)
          DIR1[AI][AJ] = 1;
        if (DIR1[AI][AJ] == 6)
          DIR1[AI][AJ] = 7;
        if (DIR1[BI][BJ] == 4)
          DIR1[BI][BJ] = 3;
        if (DIR1[BI][BJ] == 8)
          DIR1[BI][BJ] = 1;
        if (DIR1[CI][CJ] == 4)
          DIR1[CI][CJ] = 5;
        if (DIR1[CI][CJ] == 8)
          DIR1[CI][CJ] = 7;
        if (DIR1[DI][DJ] == 2)
          DIR1[DI][DJ] = 3;
        if (DIR1[DI][DJ] == 6)
          DIR1[DI][DJ] = 5;
        if (ACC1[AI][AJ] > max_acc) {
          max_acc = ACC1[AI][AJ];
          new_dir = DIR1[AI][AJ];
        }
        if (ACC1[BI][BJ] > max_acc) {
          max_acc = ACC1[BI][BJ];
          new_dir = DIR1[BI][BJ];
        }
        if (ACC1[CI][CJ] > max_acc) {
          max_acc = ACC1[CI][CJ];
          new_dir = DIR1[CI][CJ];
        }
        if (ACC1[DI][DJ] > max_acc) {
          max_acc = ACC1[DI][DJ];
          new_dir = DIR1[DI][DJ];
        }
        NEW[i][j] = new_dir;
      }
    }
  }
  for (i = 0; i < (rows / 2); i++) {
    for (j = 0; j < (cols / 2); j++)
      printf("%d ", NEW[i][j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2dcaa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     11ff <main+0x6f>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xf11(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0x1b0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x340(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xefb(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1264 <main+0xd4>
lea    -0x1b0(%rbp),%rsi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xed2(%rip),%rsi
lea    -0x2dca48(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
mov    -0x2dca48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xe8d(%rip),%rsi
lea    -0x2dca44(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
mov    -0x2dca44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xe58(%rip),%rsi
lea    -0x2dca7c(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
movss  -0x2dca7c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xe36(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xe17(%rip),%rsi
lea    -0x2dca80(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
movss  -0x2dca80(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xdd6(%rip),%rsi
lea    -0x2dca84(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
movss  -0x2dca84(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xc55(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xda8(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x380(%rbp),%rdx
lea    0xd79(%rip),%rsi
lea    -0x2dca88(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x380(%rbp),%rsi
mov    -0x2dca88(%rbp),%edx
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x1b0(%rbp),%rdi
lea    -0xf45c0(%rbp),%rsi
mov    -0x2dca44(%rbp),%edx
mov    -0x2dca48(%rbp),%ecx
call   1030 <read_dir@plt>
lea    -0x340(%rbp),%rdi
lea    -0x1e8800(%rbp),%rsi
mov    -0x2dca44(%rbp),%edx
mov    -0x2dca48(%rbp),%ecx
call   1030 <read_dir@plt>
lea    -0xf45c0(%rbp),%rdi
lea    -0x2dca40(%rbp),%rsi
mov    -0x2dca44(%rbp),%edx
mov    -0x2dca48(%rbp),%ecx
call   1070 <make_mask@plt>
movl   $0x0,-0x2dca4c(%rbp)
mov    -0x2dca4c(%rbp),%eax
mov    %eax,-0x2dca8c(%rbp)
mov    -0x2dca44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2dca8c(%rbp),%eax
cmp    %ecx,%eax
jge    1a51 <main+0x8c1>
movl   $0x0,-0x2dca50(%rbp)
mov    -0x2dca50(%rbp),%eax
mov    %eax,-0x2dca90(%rbp)
mov    -0x2dca48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2dca90(%rbp),%eax
cmp    %ecx,%eax
jge    1a38 <main+0x8a8>
mov    -0x2dca50(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2dca64(%rbp)
mov    -0x2dca4c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2dca54(%rbp)
mov    -0x2dca50(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x2dca68(%rbp)
mov    -0x2dca4c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2dca58(%rbp)
mov    -0x2dca50(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2dca6c(%rbp)
mov    -0x2dca4c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x2dca5c(%rbp)
mov    -0x2dca50(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x2dca70(%rbp)
mov    -0x2dca4c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x2dca60(%rbp)
movl   $0x0,-0x2dca78(%rbp)
movl   $0x0,-0x2dca74(%rbp)
movslq -0x2dca4c(%rbp),%rcx
lea    -0x2dca40(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca50(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1a1f <main+0x88f>
movslq -0x2dca54(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
cmpl   $0x2,(%rax,%rcx,4)
jne    15d6 <main+0x446>
movslq -0x2dca54(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movslq -0x2dca54(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
cmpl   $0x6,(%rax,%rcx,4)
jne    1625 <main+0x495>
movslq -0x2dca54(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
movl   $0x7,(%rax,%rcx,4)
movslq -0x2dca58(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
cmpl   $0x4,(%rax,%rcx,4)
jne    1674 <main+0x4e4>
movslq -0x2dca58(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
movl   $0x3,(%rax,%rcx,4)
movslq -0x2dca58(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
cmpl   $0x8,(%rax,%rcx,4)
jne    16c3 <main+0x533>
movslq -0x2dca58(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movslq -0x2dca5c(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
cmpl   $0x4,(%rax,%rcx,4)
jne    1712 <main+0x582>
movslq -0x2dca5c(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
movslq -0x2dca5c(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
cmpl   $0x8,(%rax,%rcx,4)
jne    1761 <main+0x5d1>
movslq -0x2dca5c(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
movl   $0x7,(%rax,%rcx,4)
movslq -0x2dca60(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
cmpl   $0x2,(%rax,%rcx,4)
jne    17b0 <main+0x620>
movslq -0x2dca60(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
movl   $0x3,(%rax,%rcx,4)
movslq -0x2dca60(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
cmpl   $0x6,(%rax,%rcx,4)
jne    17ff <main+0x66f>
movslq -0x2dca60(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
movslq -0x2dca54(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x2dca74(%rbp),%eax
jle    187d <main+0x6ed>
movslq -0x2dca54(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca74(%rbp)
movslq -0x2dca54(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca64(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca78(%rbp)
movslq -0x2dca58(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x2dca74(%rbp),%eax
jle    18fb <main+0x76b>
movslq -0x2dca58(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca74(%rbp)
movslq -0x2dca58(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca68(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca78(%rbp)
movslq -0x2dca5c(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x2dca74(%rbp),%eax
jle    1979 <main+0x7e9>
movslq -0x2dca5c(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca74(%rbp)
movslq -0x2dca5c(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca6c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca78(%rbp)
movslq -0x2dca60(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x2dca74(%rbp),%eax
jle    19f7 <main+0x867>
movslq -0x2dca60(%rbp),%rcx
lea    -0x1e8800(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca74(%rbp)
movslq -0x2dca60(%rbp),%rcx
lea    -0xf45c0(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca70(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2dca78(%rbp)
mov    -0x2dca78(%rbp),%edx
movslq -0x2dca4c(%rbp),%rcx
lea    -0x2dca40(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1a24 <main+0x894>
mov    -0x2dca50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2dca50(%rbp)
jmp    149c <main+0x30c>
jmp    1a3d <main+0x8ad>
mov    -0x2dca4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2dca4c(%rbp)
jmp    1468 <main+0x2d8>
movl   $0x0,-0x2dca4c(%rbp)
mov    -0x2dca4c(%rbp),%eax
mov    %eax,-0x2dca94(%rbp)
mov    -0x2dca44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2dca94(%rbp),%eax
cmp    %ecx,%eax
jge    1b1f <main+0x98f>
movl   $0x0,-0x2dca50(%rbp)
mov    -0x2dca50(%rbp),%eax
mov    %eax,-0x2dca98(%rbp)
mov    -0x2dca48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2dca98(%rbp),%eax
cmp    %ecx,%eax
jge    1afd <main+0x96d>
movslq -0x2dca4c(%rbp),%rcx
lea    -0x2dca40(%rbp),%rax
imul   $0x7d0,%rcx,%rcx
add    %rcx,%rax
movslq -0x2dca50(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0x688(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2dca50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2dca50(%rbp)
jmp    1a8f <main+0x8ff>
lea    0x642(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2dca4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2dca4c(%rbp)
jmp    1a5b <main+0x8cb>
add    $0x2dcaa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2dca48,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    15aa <main+0x40a>
mov    0x8(%rbx),%rsi
lea    0x60(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strcpy@plt>
mov    0x10(%rbx),%rsi
lea    0x1f0(%rsp),%rdi
call   1050 <strcpy@plt>
lea    0xf42(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     15ee <main+0x44e>
mov    %rax,%rbx
lea    0xf3f(%rip),%rbp
xor    %r15d,%r15d
lea    0x20(%rsp),%r14
mov    %rsp,%rcx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
mov    (%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
lea    0xf17(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xede(%rip),%r13
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebe(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
lea    0xe30(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
mov    0x8(%rsp),%edx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
lea    0x60(%rsp),%rdi
lea    0x1e8800(%rsp),%rbp
mov    %rbp,%rsi
call   1040 <read_dir@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
lea    0x1f0(%rsp),%rdi
lea    0xf45c0(%rsp),%rsi
call   1040 <read_dir@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
lea    0x380(%rsp),%r12
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <make_mask@plt>
mov    0x4(%rsp),%r9d
cmp    $0x2,%r9d
jl     1598 <main+0x3f8>
mov    %r9,0x18(%rsp)
shr    %r9
mov    (%rsp),%r10d
mov    %r10d,%r14d
shr    $0x1f,%r14d
add    %r10d,%r14d
sar    %r14d
lea    0x1e8fd4(%rsp),%rdi
lea    0xf4d94(%rsp),%r13
xor    %r11d,%r11d
jmp    13f2 <main+0x252>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r11
add    $0xfa0,%rdi
add    $0xfa0,%r13
add    $0x7d0,%r12
cmp    %r9,%r11
je     1508 <main+0x368>
cmp    $0x2,%r10d
jl     13d0 <main+0x230>
xor    %ecx,%ecx
jmp    144e <main+0x2ae>
nopl   0x0(%rax)
mov    $0x3,%ebp
mov    %ebp,(%rdi,%rax,4)
mov    -0x7d4(%r13,%rcx,8),%eax
ff
test   %eax,%eax
cmovle %r15d,%eax
mov    -0x7d0(%r13,%rcx,8),%r8d
ff
cmovle %r15d,%edx
cmp    %eax,%r8d
cmovg  %r8d,%eax
cmovg  %esi,%edx
mov    -0x4(%r13,%rcx,8),%esi
cmp    %eax,%esi
cmovg  %esi,%eax
cmovg  %ebx,%edx
cmp    %eax,0x0(%r13,%rcx,8)
cmovg  %ebp,%edx
mov    %edx,(%r12,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r14
je     13d0 <main+0x230>
cmpl   $0x0,(%r12,%rcx,4)
jle    1445 <main+0x2a5>
lea    (%rcx,%rcx,1),%rax
mov    -0x7d4(%rdi,%rcx,8),%edx
cmp    $0x2,%edx
je     1480 <main+0x2e0>
cmp    $0x6,%edx
jne    148c <main+0x2ec>
mov    $0x7,%edx
jmp    1485 <main+0x2e5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edx
mov    %edx,-0x7d4(%rdi,%rax,4)
mov    -0x7d0(%rdi,%rcx,8),%esi
cmp    $0x4,%esi
je     14b0 <main+0x310>
cmp    $0x8,%esi
jne    14bc <main+0x31c>
mov    $0x1,%esi
jmp    14b5 <main+0x315>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x3,%esi
mov    %esi,-0x7d0(%rdi,%rax,4)
mov    -0x4(%rdi,%rcx,8),%ebx
cmp    $0x4,%ebx
je     14e0 <main+0x340>
cmp    $0x8,%ebx
jne    14e9 <main+0x349>
mov    $0x7,%ebx
jmp    14e5 <main+0x345>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x5,%ebx
mov    %ebx,-0x4(%rdi,%rax,4)
mov    (%rdi,%rcx,8),%ebp
cmp    $0x2,%ebp
je     1400 <main+0x260>
cmp    $0x6,%ebp
jne    1408 <main+0x268>
mov    $0x5,%ebp
jmp    1405 <main+0x265>
cmpl   $0x2,0x18(%rsp)
jl     1598 <main+0x3f8>
lea    0x380(%rsp),%rbp
lea    0xc40(%rip),%r15
xor    %r14d,%r14d
jmp    155a <main+0x3ba>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
mov    0x4(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
add    $0x7d0,%rbp
cmp    %rax,%r14
jge    1598 <main+0x3f8>
cmpl   $0x2,(%rsp)
jl     1530 <main+0x390>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
mov    (%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
cmp    %rax,%rbx
jl     1570 <main+0x3d0>
jmp    1530 <main+0x390>
add    $0x2dca48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a2f(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xa42(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xa61(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xb1a(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xb35(%rip),%rdi
lea    0x60(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"Usage: %s <direction file> <accumulation file>\0A\00"
@.str.1 = [202 x i8] c"\09This program builds a new routing direction file at twice the resolution (e.g. 1/8 to 1/4) of the provided direction file. The accumulation file for the current direction file must also be provided.\0A\00"
@.str.2 = [46 x i8] c"\09The new direction file is output to stdout.\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.5 = [6 x i8] c"%s %d\00"
@.str.6 = [10 x i8] c"%-15s %d\0A\00"
@.str.7 = [6 x i8] c"%s %f\00"
@.str.8 = [12 x i8] c"%-15s %.4f\0A\00"
@.str.9 = [4 x i8] c"%d \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [400 x i8]
%4 = alloca [400 x i8]
%5 = alloca [50 x i8]
%6 = alloca [500 x [500 x i32]]
%7 = alloca [500 x [500 x i32]]
%8 = alloca [500 x [500 x i32]]
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [400 x i8], [400 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%18 = bitcast [500 x [500 x i32]]* %6 to i8*
%19 = bitcast [500 x [500 x i32]]* %7 to i8*
%20 = bitcast [500 x [500 x i32]]* %8 to i8*
%21 = bitcast i32* %9 to i8*
%22 = bitcast i32* %10 to i8*
%23 = bitcast float* %11 to i8*
%24 = bitcast float* %12 to i8*
%25 = bitcast float* %13 to i8*
%26 = bitcast i32* %14 to i8*
%27 = icmp eq i32 %0, 3
br i1 %27, label %37, label %28
28: ; preds = %2
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %1
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([202 x i8], [202 x i8]* @.str.1, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%36 = tail call i32 @exit(i32 0)
unreachable
37: ; preds = %2
%38 = getelementptr inbounds i8*, i8** %1, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @strcpy(i8* %15, i8* %39)
%41 = getelementptr inbounds i8*, i8** %1, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @strcpy(i8* %16, i8* %42)
%44 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %49
46: ; preds = %37
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%48 = call i32 @exit(i32 0)
unreachable
49: ; preds = %37
%50 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %17, i32* %10)
%51 = load i32, i32* %10
%52 = sdiv i32 %51, 2
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %17, i32 %52)
%54 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %17, i32* %9)
%55 = load i32, i32* %9
%56 = sdiv i32 %55, 2
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %17, i32 %56)
%58 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %17, float* %11)
%59 = load float, float* %11
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %17, double %60)
%62 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %17, float* %12)
%63 = load float, float* %12
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %17, double %64)
%66 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %17, float* %13)
%67 = load float, float* %13
%68 = fpext float %67 to double
%69 = fmul double %68, 2.000000e+00
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %17, double %69)
%71 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %17, i32* %14)
%72 = load i32, i32* %14
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %17, i32 %72)
%74 = call i32 @fclose(i32* %44)
%75 = bitcast [500 x [500 x i32]]* %6 to i32**
%76 = load i32, i32* %9
%77 = load i32, i32* %10
%78 = call i32 @read_dir(i8* %15, i32** %75, i32 %76, i32 %77)
%79 = bitcast [500 x [500 x i32]]* %7 to i32**
%80 = load i32, i32* %9
%81 = load i32, i32* %10
%82 = call i32 @read_dir(i8* %16, i32** %79, i32 %80, i32 %81)
%83 = bitcast [500 x [500 x i32]]* %8 to i32**
%84 = load i32, i32* %9
%85 = load i32, i32* %10
%86 = call i32 @make_mask(i32** %75, i32** %83, i32 %84, i32 %85)
%87 = load i32, i32* %9
%88 = icmp sgt i32 %87, 1
br i1 %88, label %89, label %184
89: ; preds = %49
%90 = lshr i32 %87, 1
%91 = load i32, i32* %10
%92 = sdiv i32 %91, 2
%93 = icmp sgt i32 %91, 1
%94 = zext i32 %90 to i64
%95 = zext i32 %92 to i64
br label %96
96: ; preds = %89, %160
%97 = phi i64 [ 0, %89 ], [ %161, %160 ]
br i1 %93, label %98, label %160
98: ; preds = %96
%99 = shl nuw nsw i64 %97, 1
%100 = or i64 %99, 1
br label %102
101: ; preds = %160
br i1 %88, label %163, label %184
102: ; preds = %98, %157
%103 = phi i64 [ 0, %98 ], [ %158, %157 ]
%104 = shl nuw nsw i64 %103, 1
%105 = or i64 %104, 1
%106 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %8, i64 0, i64 %97, i64 %103
%107 = load i32, i32* %106
%108 = icmp sgt i32 %107, 0
br i1 %108, label %109, label %157
109: ; preds = %102
%110 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %6, i64 0, i64 %99, i64 %104
%111 = load i32, i32* %110
switch i32 %111, label %115 [
i32 2, label %113
i32 6, label %112
]
112: ; preds = %109
br label %113
113: ; preds = %109, %112
%114 = phi i32 [ 7, %112 ], [ 1, %109 ]
store i32 %114, i32* %110
br label %115
115: ; preds = %113, %109
%116 = phi i32 [ %111, %109 ], [ %114, %113 ]
%117 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %6, i64 0, i64 %99, i64 %105
%118 = load i32, i32* %117
switch i32 %118, label %122 [
i32 4, label %120
i32 8, label %119
]
119: ; preds = %115
br label %120
120: ; preds = %115, %119
%121 = phi i32 [ 1, %119 ], [ 3, %115 ]
store i32 %121, i32* %117
br label %122
122: ; preds = %120, %115
%123 = phi i32 [ %118, %115 ], [ %121, %120 ]
%124 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %6, i64 0, i64 %100, i64 %104
%125 = load i32, i32* %124
switch i32 %125, label %129 [
i32 4, label %127
i32 8, label %126
]
126: ; preds = %122
br label %127
127: ; preds = %122, %126
%128 = phi i32 [ 7, %126 ], [ 5, %122 ]
store i32 %128, i32* %124
br label %129
129: ; preds = %127, %122
%130 = phi i32 [ %125, %122 ], [ %128, %127 ]
%131 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %6, i64 0, i64 %100, i64 %105
%132 = load i32, i32* %131
switch i32 %132, label %136 [
i32 2, label %134
i32 6, label %133
]
133: ; preds = %129
br label %134
134: ; preds = %129, %133
%135 = phi i32 [ 5, %133 ], [ 3, %129 ]
store i32 %135, i32* %131
br label %136
136: ; preds = %134, %129
%137 = phi i32 [ %132, %129 ], [ %135, %134 ]
%138 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %7, i64 0, i64 %99, i64 %104
%139 = load i32, i32* %138
%140 = icmp sgt i32 %139, 0
%141 = select i1 %140, i32 %139, i32 0
%142 = select i1 %140, i32 %116, i32 0
%143 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %7, i64 0, i64 %99, i64 %105
%144 = load i32, i32* %143
%145 = icmp sgt i32 %144, %141
%146 = select i1 %145, i32 %144, i32 %141
%147 = select i1 %145, i32 %123, i32 %142
%148 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %7, i64 0, i64 %100, i64 %104
%149 = load i32, i32* %148
%150 = icmp sgt i32 %149, %146
%151 = select i1 %150, i32 %149, i32 %146
%152 = select i1 %150, i32 %130, i32 %147
%153 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %7, i64 0, i64 %100, i64 %105
%154 = load i32, i32* %153
%155 = icmp sgt i32 %154, %151
%156 = select i1 %155, i32 %137, i32 %152
store i32 %156, i32* %106
br label %157
157: ; preds = %102, %136
%158 = add nuw nsw i64 %103, 1
%159 = icmp eq i64 %158, %95
br i1 %159, label %160, label %102
160: ; preds = %157, %96
%161 = add nuw nsw i64 %97, 1
%162 = icmp eq i64 %161, %94
br i1 %162, label %101, label %96
163: ; preds = %101, %177
%164 = phi i64 [ %179, %177 ], [ 0, %101 ]
%165 = load i32, i32* %10
%166 = icmp sgt i32 %165, 1
br i1 %166, label %167, label %177
167: ; preds = %163, %167
%168 = phi i64 [ %172, %167 ], [ 0, %163 ]
%169 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* %8, i64 0, i64 %164, i64 %168
%170 = load i32, i32* %169
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %170)
%172 = add nuw nsw i64 %168, 1
%173 = load i32, i32* %10
%174 = sdiv i32 %173, 2
%175 = sext i32 %174 to i64
%176 = icmp slt i64 %172, %175
br i1 %176, label %167, label %177
177: ; preds = %167, %163
%178 = call i32 @putchar(i32 10)
%179 = add nuw nsw i64 %164, 1
%180 = load i32, i32* %9
%181 = sdiv i32 %180, 2
%182 = sext i32 %181 to i64
%183 = icmp slt i64 %179, %182
br i1 %183, label %163, label %184
184: ; preds = %177, %49, %101
ret void
}