int main(void) {
  int loops = 0;
  int a[20][20] = {
      {8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8},
      {49, 49, 99, 40, 17, 81, 18, 57, 60, 87,
       17, 40, 98, 43, 69, 48, 4,  56, 62, 0},
      {81, 49, 31, 73, 55, 79, 14, 29, 93, 71,
       40, 67, 53, 88, 30, 3,  49, 13, 36, 65},
      {52, 70, 95, 23, 4,  60, 11, 42, 69, 24,
       68, 56, 1,  32, 56, 71, 37, 2,  36, 91},
      {22, 31, 16, 71, 51, 67, 63, 89, 41, 92,
       36, 54, 22, 40, 40, 28, 66, 33, 13, 80},
      {24, 47, 32, 60, 99, 3,  45, 2,  44, 75,
       33, 53, 78, 36, 84, 20, 35, 17, 12, 50},
      {32, 98, 81, 28, 64, 23, 67, 10, 26, 38,
       40, 67, 59, 54, 70, 66, 18, 38, 64, 70},
      {67, 26, 20, 68, 2,  62, 12, 20, 95, 63,
       94, 39, 63, 8,  40, 91, 66, 49, 94, 21},
      {24, 55, 58, 5,  66, 73, 99, 26, 97, 17,
       78, 78, 96, 83, 14, 88, 34, 89, 63, 72},
      {21, 36, 23, 9,  75, 0,  76, 44, 20, 45,
       35, 14, 0,  61, 33, 97, 34, 31, 33, 95},
      {78, 17, 53, 28, 22, 75, 31, 67, 15, 94,
       3,  80, 4,  62, 16, 14, 9,  53, 56, 92},
      {16, 39, 5, 42, 96, 35, 31, 47, 55, 58,
       88, 24, 0, 17, 54, 24, 36, 29, 85, 57},
      {86, 56, 0,  48, 35, 71, 89, 7,  5,  44,
       44, 37, 44, 60, 21, 58, 51, 54, 17, 58},
      {19, 80, 81, 68, 5,  94, 47, 69, 28, 73,
       92, 13, 86, 52, 17, 77, 4,  89, 55, 40},
      {4,  52, 8,  83, 97, 35, 99, 16, 7,  97,
       57, 32, 16, 26, 26, 79, 33, 27, 98, 66},
      {88, 36, 68, 87, 57, 62, 20, 72, 3,  46,
       33, 67, 46, 55, 12, 32, 63, 93, 53, 69},
      {4,  42, 16, 73, 38, 25, 39, 11, 24, 94,
       72, 18, 8,  46, 29, 32, 40, 62, 76, 36},
      {20, 69, 36, 41, 72, 30, 23, 88, 34, 62,
       99, 69, 82, 67, 59, 85, 74, 4,  36, 16},
      {20, 73, 35, 29, 78, 31, 90, 1,  74, 31,
       49, 71, 48, 86, 81, 16, 23, 57, 5,  54},
      {1,  70, 54, 71, 83, 51, 54, 69, 16, 92,
       33, 48, 61, 43, 52, 1,  89, 19, 67, 48}};
  const int width = 20;
  const int height = 20;
  int p = 0;
  int i, j, q1, q2, d;
  for (i = 3; i < width - 4; i++) {
    for (j = 3; j < height - 4; j++) {
      loops++;
      const int p1 =
          a[i][j] * a[i - 1][j - 1] * a[i - 2][j - 2] * a[i - 3][j - 3];
      if (p < p1) {
        p = p1;
        q1 = i;
        q2 = j;
        d = 1;
      }
      const int p2 = a[i][j] * a[i - 1][j] * a[i - 2][j] * a[i - 3][j];
      if (p < p2) {
        p = p2;
        q1 = i;
        q2 = j;
        d = 2;
      }
      const int p3 =
          a[i][j] * a[i + 1][j - 1] * a[i + 2][j - 2] * a[i + 3][j - 3];
      if (p < p3) {
        p = p3;
        q1 = i;
        q2 = j;
        d = 3;
      }
      const int p4 = a[i][j] * a[i][j + 1] * a[i][j + 2] * a[i][j + 3];
      if (p < p4) {
        p = p4;
        q1 = i;
        q2 = j;
        d = 4;
      }
      const int p5 =
          a[i][j] * a[i + 1][j + 1] * a[i + 2][j + 2] * a[i + 3][j + 3];
      if (p < p5) {
        p = p5;
        q1 = i;
        q2 = j;
        d = 5;
      }
      const int p6 = a[i][j] * a[i + 1][j] * a[i + 2][j] * a[i + 3][j];
      if (p < p6) {
        p = p6;
        q1 = i;
        q2 = j;
        d = 6;
      }
      const int p7 =
          a[i][j] * a[i - 1][j + 1] * a[i - 2][j + 2] * a[i - 3][j + 3];
      if (p < p7) {
        p = p7;
        q1 = i;
        q2 = j;
        d = 7;
      }
      const int p8 = a[i][j] * a[i][j - 1] * a[i][j - 2] * a[i][j - 3];
      if (p < p8) {
        p = p8;
        q1 = i;
        q2 = j;
        d = 8;
      }
    }
  }
  printf(
      "greatest product is %d at (%d,%d)=%d with direction %d, with %d loops\n",
      p, q1, q2, a[q1][q2], d, loops);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x650(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x640,%edx
call   1040 <memcpy@plt>
movl   $0x14,-0x654(%rbp)
movl   $0x14,-0x658(%rbp)
movl   $0x0,-0x65c(%rbp)
movl   $0x3,-0x660(%rbp)
cmpl   $0x10,-0x660(%rbp)
jge    18b4 <main+0x794>
movl   $0x3,-0x664(%rbp)
cmpl   $0x10,-0x664(%rbp)
jge    189b <main+0x77b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x674(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x674(%rbp),%eax
jge    1289 <main+0x169>
mov    -0x674(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x1,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x678(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x678(%rbp),%eax
jge    135d <main+0x23d>
mov    -0x678(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x2,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x67c(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x67c(%rbp),%eax
jge    1440 <main+0x320>
mov    -0x67c(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x3,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x680(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x680(%rbp),%eax
jge    1514 <main+0x3f4>
mov    -0x680(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x4,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x684(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x684(%rbp),%eax
jge    15f7 <main+0x4d7>
mov    -0x684(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x5,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
movslq -0x664(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x688(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x688(%rbp),%eax
jge    16cb <main+0x5ab>
mov    -0x688(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x6,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    -0x660(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x68c(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x68c(%rbp),%eax
jge    17ae <main+0x68e>
mov    -0x68c(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x7,-0x670(%rbp)
movslq -0x660(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x664(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x2,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
movslq -0x660(%rbp),%rdx
lea    -0x650(%rbp),%rcx
imul   $0x50,%rdx,%rdx
add    %rdx,%rcx
mov    -0x664(%rbp),%edx
sub    $0x3,%edx
movslq %edx,%rdx
imul   (%rcx,%rdx,4),%eax
mov    %eax,-0x690(%rbp)
mov    -0x65c(%rbp),%eax
cmp    -0x690(%rbp),%eax
jge    1882 <main+0x762>
mov    -0x690(%rbp),%eax
mov    %eax,-0x65c(%rbp)
mov    -0x660(%rbp),%eax
mov    %eax,-0x668(%rbp)
mov    -0x664(%rbp),%eax
mov    %eax,-0x66c(%rbp)
movl   $0x8,-0x670(%rbp)
jmp    1887 <main+0x767>
mov    -0x664(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x664(%rbp)
jmp    1190 <main+0x70>
jmp    18a0 <main+0x780>
mov    -0x660(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x660(%rbp)
jmp    1179 <main+0x59>
mov    -0x65c(%rbp),%esi
mov    -0x668(%rbp),%edx
mov    -0x66c(%rbp),%ecx
movslq -0x668(%rbp),%rdi
lea    -0x650(%rbp),%rax
imul   $0x50,%rdi,%rdi
add    %rdi,%rax
movslq -0x66c(%rbp),%rdi
mov    (%rax,%rdi,4),%r8d
mov    -0x670(%rbp),%r9d
mov    -0x8(%rbp),%eax
lea    0xd49(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x6a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %esi,%esi
mov    $0x3,%r10d
lea    0x10d2(%rip),%rcx
lea    0xed3(%rip),%r8
jmp    113e <main+0x2e>
nop
add    $0x50,%rcx
cmp    $0x10,%r10
je     12b8 <main+0x1a8>
mov    %r10,%r14
add    $0x1,%r10
lea    (%r14,%r14,4),%rdx
shl    $0x4,%rdx
mov    -0x48(%rdx,%r8,1),%eax
mov    0xc(%rdx,%r8,1),%ebx
mov    $0xfffffffffffffff3,%rdx
jmp    1167 <main+0x57>
mov    %edi,%ebx
inc    %rdx
je     1130 <main+0x20>
imul   %ebx,%eax
imul   -0x170(%rcx,%rdx,4),%eax
ff
imul   -0x1c4(%rcx,%rdx,4),%eax
ff
cmp    %eax,%esi
jge    118d <main+0x7d>
lea    0x10(%rdx),%r11d
mov    $0x1,%r9d
mov    %r14d,%r15d
mov    %eax,%esi
mov    -0x118(%rcx,%rdx,4),%eax
mov    %eax,%edi
imul   %ebx,%edi
imul   -0x168(%rcx,%rdx,4),%edi
ff
imul   -0x1b8(%rcx,%rdx,4),%edi
ff
cmp    %edi,%esi
jge    11bc <main+0xac>
lea    0x10(%rdx),%r11d
mov    $0x2,%r9d
mov    %r14d,%r15d
mov    %edi,%esi
mov    -0x7c(%rcx,%rdx,4),%edi
imul   %ebx,%edi
imul   -0x30(%rcx,%rdx,4),%edi
imul   0x1c(%rcx,%rdx,4),%edi
cmp    %edi,%esi
jge    11e0 <main+0xd0>
lea    0x10(%rdx),%r11d
mov    $0x3,%r9d
mov    %r14d,%r15d
mov    %edi,%esi
mov    -0xc4(%rcx,%rdx,4),%edi
mov    %edi,%ebp
imul   %ebx,%ebp
imul   -0xc0(%rcx,%rdx,4),%ebp
ff
imul   -0xbc(%rcx,%rdx,4),%ebp
ff
cmp    %ebp,%esi
jge    120f <main+0xff>
lea    0x10(%rdx),%r11d
mov    $0x4,%r9d
mov    %r14d,%r15d
mov    %ebp,%esi
mov    -0x74(%rcx,%rdx,4),%ebp
imul   %ebx,%ebp
imul   -0x20(%rcx,%rdx,4),%ebp
imul   0x34(%rcx,%rdx,4),%ebp
cmp    %ebp,%esi
jge    1233 <main+0x123>
lea    0x10(%rdx),%r11d
mov    $0x5,%r9d
mov    %r14d,%r15d
mov    %ebp,%esi
mov    -0x78(%rcx,%rdx,4),%ebp
imul   %ebx,%ebp
imul   -0x28(%rcx,%rdx,4),%ebp
imul   0x28(%rcx,%rdx,4),%ebp
cmp    %ebp,%esi
jge    1257 <main+0x147>
lea    0x10(%rdx),%r11d
mov    $0x6,%r9d
mov    %r14d,%r15d
mov    %ebp,%esi
mov    -0x114(%rcx,%rdx,4),%ebp
imul   %ebx,%ebp
imul   -0x160(%rcx,%rdx,4),%ebp
ff
imul   -0x1ac(%rcx,%rdx,4),%ebp
ff
cmp    %ebp,%esi
jge    1284 <main+0x174>
lea    0x10(%rdx),%r11d
mov    $0x7,%r9d
mov    %r14d,%r15d
mov    %ebp,%esi
imul   -0xcc(%rcx,%rdx,4),%ebx
ff
imul   -0xd0(%rcx,%rdx,4),%ebx
ff
imul   -0xd4(%rcx,%rdx,4),%ebx
ff
cmp    %ebx,%esi
jge    1160 <main+0x50>
lea    0x10(%rdx),%r11d
mov    $0x8,%r9d
mov    %r14d,%r15d
mov    %ebx,%esi
jmp    1160 <main+0x50>
movslq %r15d,%rdx
movslq %r11d,%rcx
lea    (%rdx,%rdx,4),%rax
shl    $0x4,%rax
add    %rax,%r8
mov    (%r8,%rcx,4),%r8d
movl   $0xa9,(%rsp)
lea    0x1365(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.a = [20 x [20 x i32]] [[20 x i32] [i32 8, i32 2, i32 22, i32 97, i32 38, i32 15, i32 0, i32 40, i32 0, i32 75, i32 4, i32 5, i32 7, i32 78, i32 52, i32 12, i32 50, i32 77, i32 91, i32 8], [20 x i32] [i32 49, i32 49, i32 99, i32 40, i32 17, i32 81, i32 18, i32 57, i32 60, i32 87, i32 17, i32 40, i32 98, i32 43, i32 69, i32 48, i32 4, i32 56, i32 62, i32 0], [20 x i32] [i32 81, i32 49, i32 31, i32 73, i32 55, i32 79, i32 14, i32 29, i32 93, i32 71, i32 40, i32 67, i32 53, i32 88, i32 30, i32 3, i32 49, i32 13, i32 36, i32 65], [20 x i32] [i32 52, i32 70, i32 95, i32 23, i32 4, i32 60, i32 11, i32 42, i32 69, i32 24, i32 68, i32 56, i32 1, i32 32, i32 56, i32 71, i32 37, i32 2, i32 36, i32 91], [20 x i32] [i32 22, i32 31, i32 16, i32 71, i32 51, i32 67, i32 63, i32 89, i32 41, i32 92, i32 36, i32 54, i32 22, i32 40, i32 40, i32 28, i32 66, i32 33, i32 13, i32 80], [20 x i32] [i32 24, i32 47, i32 32, i32 60, i32 99, i32 3, i32 45, i32 2, i32 44, i32 75, i32 33, i32 53, i32 78, i32 36, i32 84, i32 20, i32 35, i32 17, i32 12, i32 50], [20 x i32] [i32 32, i32 98, i32 81, i32 28, i32 64, i32 23, i32 67, i32 10, i32 26, i32 38, i32 40, i32 67, i32 59, i32 54, i32 70, i32 66, i32 18, i32 38, i32 64, i32 70], [20 x i32] [i32 67, i32 26, i32 20, i32 68, i32 2, i32 62, i32 12, i32 20, i32 95, i32 63, i32 94, i32 39, i32 63, i32 8, i32 40, i32 91, i32 66, i32 49, i32 94, i32 21], [20 x i32] [i32 24, i32 55, i32 58, i32 5, i32 66, i32 73, i32 99, i32 26, i32 97, i32 17, i32 78, i32 78, i32 96, i32 83, i32 14, i32 88, i32 34, i32 89, i32 63, i32 72], [20 x i32] [i32 21, i32 36, i32 23, i32 9, i32 75, i32 0, i32 76, i32 44, i32 20, i32 45, i32 35, i32 14, i32 0, i32 61, i32 33, i32 97, i32 34, i32 31, i32 33, i32 95], [20 x i32] [i32 78, i32 17, i32 53, i32 28, i32 22, i32 75, i32 31, i32 67, i32 15, i32 94, i32 3, i32 80, i32 4, i32 62, i32 16, i32 14, i32 9, i32 53, i32 56, i32 92], [20 x i32] [i32 16, i32 39, i32 5, i32 42, i32 96, i32 35, i32 31, i32 47, i32 55, i32 58, i32 88, i32 24, i32 0, i32 17, i32 54, i32 24, i32 36, i32 29, i32 85, i32 57], [20 x i32] [i32 86, i32 56, i32 0, i32 48, i32 35, i32 71, i32 89, i32 7, i32 5, i32 44, i32 44, i32 37, i32 44, i32 60, i32 21, i32 58, i32 51, i32 54, i32 17, i32 58], [20 x i32] [i32 19, i32 80, i32 81, i32 68, i32 5, i32 94, i32 47, i32 69, i32 28, i32 73, i32 92, i32 13, i32 86, i32 52, i32 17, i32 77, i32 4, i32 89, i32 55, i32 40], [20 x i32] [i32 4, i32 52, i32 8, i32 83, i32 97, i32 35, i32 99, i32 16, i32 7, i32 97, i32 57, i32 32, i32 16, i32 26, i32 26, i32 79, i32 33, i32 27, i32 98, i32 66], [20 x i32] [i32 88, i32 36, i32 68, i32 87, i32 57, i32 62, i32 20, i32 72, i32 3, i32 46, i32 33, i32 67, i32 46, i32 55, i32 12, i32 32, i32 63, i32 93, i32 53, i32 69], [20 x i32] [i32 4, i32 42, i32 16, i32 73, i32 38, i32 25, i32 39, i32 11, i32 24, i32 94, i32 72, i32 18, i32 8, i32 46, i32 29, i32 32, i32 40, i32 62, i32 76, i32 36], [20 x i32] [i32 20, i32 69, i32 36, i32 41, i32 72, i32 30, i32 23, i32 88, i32 34, i32 62, i32 99, i32 69, i32 82, i32 67, i32 59, i32 85, i32 74, i32 4, i32 36, i32 16], [20 x i32] [i32 20, i32 73, i32 35, i32 29, i32 78, i32 31, i32 90, i32 1, i32 74, i32 31, i32 49, i32 71, i32 48, i32 86, i32 81, i32 16, i32 23, i32 57, i32 5, i32 54], [20 x i32] [i32 1, i32 70, i32 54, i32 71, i32 83, i32 51, i32 54, i32 69, i32 16, i32 92, i32 33, i32 48, i32 61, i32 43, i32 52, i32 1, i32 89, i32 19, i32 67, i32 48]]
@.str = [71 x i8] c"greatest product is %d at (%d,%d)=%d with direction %d, with %d loops\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %167
%2 = phi i64 [ 3, %0 ], [ %10, %167 ]
%3 = phi i32 [ 0, %0 ], [ %165, %167 ]
%4 = phi i32 [ undef, %0 ], [ %164, %167 ]
%5 = phi i32 [ undef, %0 ], [ %163, %167 ]
%6 = phi i32 [ undef, %0 ], [ %162, %167 ]
%7 = add nsw i64 %2, -1
%8 = add nsw i64 %2, -2
%9 = add nsw i64 %2, -3
%10 = add nuw nsw i64 %2, 1
%11 = add nuw nsw i64 %2, 2
%12 = add nuw nsw i64 %2, 3
%13 = trunc i64 %2 to i32
%14 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 3
%15 = load i32, i32* %14
%16 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %7, i64 2
%17 = load i32, i32* %16
br label %18
18: ; preds = %1, %161
%19 = phi i32 [ %17, %1 ], [ %45, %161 ]
%20 = phi i32 [ %15, %1 ], [ %80, %161 ]
%21 = phi i64 [ 3, %1 ], [ %78, %161 ]
%22 = phi i32 [ %3, %1 ], [ %165, %161 ]
%23 = phi i32 [ %4, %1 ], [ %164, %161 ]
%24 = phi i32 [ %5, %1 ], [ %163, %161 ]
%25 = phi i32 [ %6, %1 ], [ %162, %161 ]
%26 = add nsw i64 %21, -1
%27 = mul nsw i32 %19, %20
%28 = add nsw i64 %21, -2
%29 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %8, i64 %28
%30 = load i32, i32* %29
%31 = mul nsw i32 %27, %30
%32 = add nsw i64 %21, -3
%33 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %9, i64 %32
%34 = load i32, i32* %33
%35 = mul nsw i32 %31, %34
%36 = icmp slt i32 %22, %35
br i1 %36, label %37, label %39
37: ; preds = %18
%38 = trunc i64 %21 to i32
br label %39
39: ; preds = %37, %18
%40 = phi i32 [ 1, %37 ], [ %25, %18 ]
%41 = phi i32 [ %38, %37 ], [ %24, %18 ]
%42 = phi i32 [ %13, %37 ], [ %23, %18 ]
%43 = phi i32 [ %35, %37 ], [ %22, %18 ]
%44 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %7, i64 %21
%45 = load i32, i32* %44
%46 = mul nsw i32 %45, %20
%47 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %8, i64 %21
%48 = load i32, i32* %47
%49 = mul nsw i32 %46, %48
%50 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %9, i64 %21
%51 = load i32, i32* %50
%52 = mul nsw i32 %49, %51
%53 = icmp slt i32 %43, %52
br i1 %53, label %54, label %56
54: ; preds = %39
%55 = trunc i64 %21 to i32
br label %56
56: ; preds = %54, %39
%57 = phi i32 [ 2, %54 ], [ %40, %39 ]
%58 = phi i32 [ %55, %54 ], [ %41, %39 ]
%59 = phi i32 [ %13, %54 ], [ %42, %39 ]
%60 = phi i32 [ %52, %54 ], [ %43, %39 ]
%61 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %10, i64 %26
%62 = load i32, i32* %61
%63 = mul nsw i32 %62, %20
%64 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %11, i64 %28
%65 = load i32, i32* %64
%66 = mul nsw i32 %63, %65
%67 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %12, i64 %32
%68 = load i32, i32* %67
%69 = mul nsw i32 %66, %68
%70 = icmp slt i32 %60, %69
br i1 %70, label %71, label %73
71: ; preds = %56
%72 = trunc i64 %21 to i32
br label %73
73: ; preds = %71, %56
%74 = phi i32 [ 3, %71 ], [ %57, %56 ]
%75 = phi i32 [ %72, %71 ], [ %58, %56 ]
%76 = phi i32 [ %13, %71 ], [ %59, %56 ]
%77 = phi i32 [ %69, %71 ], [ %60, %56 ]
%78 = add nuw nsw i64 %21, 1
%79 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %78
%80 = load i32, i32* %79
%81 = mul nsw i32 %80, %20
%82 = add nuw nsw i64 %21, 2
%83 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %82
%84 = load i32, i32* %83
%85 = mul nsw i32 %81, %84
%86 = add nuw nsw i64 %21, 3
%87 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %86
%88 = load i32, i32* %87
%89 = mul nsw i32 %85, %88
%90 = icmp slt i32 %77, %89
br i1 %90, label %91, label %93
91: ; preds = %73
%92 = trunc i64 %21 to i32
br label %93
93: ; preds = %91, %73
%94 = phi i32 [ 4, %91 ], [ %74, %73 ]
%95 = phi i32 [ %92, %91 ], [ %75, %73 ]
%96 = phi i32 [ %13, %91 ], [ %76, %73 ]
%97 = phi i32 [ %89, %91 ], [ %77, %73 ]
%98 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %10, i64 %78
%99 = load i32, i32* %98
%100 = mul nsw i32 %99, %20
%101 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %11, i64 %82
%102 = load i32, i32* %101
%103 = mul nsw i32 %100, %102
%104 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %12, i64 %86
%105 = load i32, i32* %104
%106 = mul nsw i32 %103, %105
%107 = icmp slt i32 %97, %106
br i1 %107, label %108, label %110
108: ; preds = %93
%109 = trunc i64 %21 to i32
br label %110
110: ; preds = %108, %93
%111 = phi i32 [ 5, %108 ], [ %94, %93 ]
%112 = phi i32 [ %109, %108 ], [ %95, %93 ]
%113 = phi i32 [ %13, %108 ], [ %96, %93 ]
%114 = phi i32 [ %106, %108 ], [ %97, %93 ]
%115 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %10, i64 %21
%116 = load i32, i32* %115
%117 = mul nsw i32 %116, %20
%118 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %11, i64 %21
%119 = load i32, i32* %118
%120 = mul nsw i32 %117, %119
%121 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %12, i64 %21
%122 = load i32, i32* %121
%123 = mul nsw i32 %120, %122
%124 = icmp slt i32 %114, %123
br i1 %124, label %125, label %127
125: ; preds = %110
%126 = trunc i64 %21 to i32
br label %127
127: ; preds = %125, %110
%128 = phi i32 [ 6, %125 ], [ %111, %110 ]
%129 = phi i32 [ %126, %125 ], [ %112, %110 ]
%130 = phi i32 [ %13, %125 ], [ %113, %110 ]
%131 = phi i32 [ %123, %125 ], [ %114, %110 ]
%132 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %7, i64 %78
%133 = load i32, i32* %132
%134 = mul nsw i32 %133, %20
%135 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %8, i64 %82
%136 = load i32, i32* %135
%137 = mul nsw i32 %134, %136
%138 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %9, i64 %86
%139 = load i32, i32* %138
%140 = mul nsw i32 %137, %139
%141 = icmp slt i32 %131, %140
br i1 %141, label %142, label %144
142: ; preds = %127
%143 = trunc i64 %21 to i32
br label %144
144: ; preds = %142, %127
%145 = phi i32 [ 7, %142 ], [ %128, %127 ]
%146 = phi i32 [ %143, %142 ], [ %129, %127 ]
%147 = phi i32 [ %13, %142 ], [ %130, %127 ]
%148 = phi i32 [ %140, %142 ], [ %131, %127 ]
%149 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %26
%150 = load i32, i32* %149
%151 = mul nsw i32 %150, %20
%152 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %28
%153 = load i32, i32* %152
%154 = mul nsw i32 %151, %153
%155 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %2, i64 %32
%156 = load i32, i32* %155
%157 = mul nsw i32 %154, %156
%158 = icmp slt i32 %148, %157
br i1 %158, label %159, label %161
159: ; preds = %144
%160 = trunc i64 %21 to i32
br label %161
161: ; preds = %159, %144
%162 = phi i32 [ 8, %159 ], [ %145, %144 ]
%163 = phi i32 [ %160, %159 ], [ %146, %144 ]
%164 = phi i32 [ %13, %159 ], [ %147, %144 ]
%165 = phi i32 [ %157, %159 ], [ %148, %144 ]
%166 = icmp eq i64 %78, 16
br i1 %166, label %167, label %18
167: ; preds = %161
%168 = icmp eq i64 %10, 16
br i1 %168, label %169, label %1
169: ; preds = %167
%170 = sext i32 %164 to i64
%171 = sext i32 %163 to i64
%172 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* @__const.main.a, i64 0, i64 %170, i64 %171
%173 = load i32, i32* %172
%174 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %165, i32 %164, i32 %163, i32 %173, i32 %162, i32 169)
ret i32 0
}