#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 */

/* Variables and functions */
long largestProductDiagonalLeft(int, int, int);
long largestProductDiagonalRight(int, int, int);
long largestProductDown(int, int, int);
long largestProductRight(int, int, int);
int /*<<< orphan*/ printf(char *, long);
long findLargestProductInGrid(int sectionSize) {
  long largestProduct = 1;
  long currentProduct = 1;
  int sectionOffset = sectionSize - 1;
  for (int ROW = 0; ROW < 20; ++ROW) {
    for (int COL = 0; COL < 20; ++COL) {
      if (COL < sectionOffset && ROW <= 20 - sectionSize) {
        currentProduct = largestProductRight(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDiagonalRight(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDown(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
      } else if (COL >= sectionOffset && COL <= 20 - sectionSize &&
                 ROW <= 20 - sectionSize) {
        currentProduct = largestProductRight(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDiagonalRight(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDown(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDiagonalLeft(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
      } else if (COL > 20 - sectionSize && ROW <= 20 - sectionSize) {
        currentProduct = largestProductDown(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
        currentProduct = largestProductDiagonalLeft(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
      } else if (ROW > 20 - sectionSize && COL <= 20 - sectionSize) {
        currentProduct = largestProductRight(sectionSize, ROW, COL);
        largestProduct =
            currentProduct > largestProduct ? currentProduct : largestProduct;
      }
    }
  }
  printf("Largest Product Found %ld\n", largestProduct);
  return largestProduct;
}


x86 assembly (clang, -O0):
<findLargestProductInGrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x14,-0x20(%rbp)
jge    14dc <findLargestProductInGrid+0x38c>
movl   $0x0,-0x24(%rbp)
cmpl   $0x14,-0x24(%rbp)
jge    14c9 <findLargestProductInGrid+0x379>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1274 <findLargestProductInGrid+0x124>
mov    -0x20(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     1274 <findLargestProductInGrid+0x124>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1070 <largestProductRight@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    11e5 <findLargestProductInGrid+0x95>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11ed <findLargestProductInGrid+0x9d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <largestProductDiagonalRight@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1222 <findLargestProductInGrid+0xd2>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    122a <findLargestProductInGrid+0xda>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <largestProductDown@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    125f <findLargestProductInGrid+0x10f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1267 <findLargestProductInGrid+0x117>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    14b6 <findLargestProductInGrid+0x366>
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     139f <findLargestProductInGrid+0x24f>
mov    -0x24(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     139f <findLargestProductInGrid+0x24f>
mov    -0x20(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     139f <findLargestProductInGrid+0x24f>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1070 <largestProductRight@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    12d3 <findLargestProductInGrid+0x183>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    12db <findLargestProductInGrid+0x18b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <largestProductDiagonalRight@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1310 <findLargestProductInGrid+0x1c0>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1318 <findLargestProductInGrid+0x1c8>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <largestProductDown@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    134d <findLargestProductInGrid+0x1fd>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    1355 <findLargestProductInGrid+0x205>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1050 <largestProductDiagonalLeft@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    138a <findLargestProductInGrid+0x23a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1392 <findLargestProductInGrid+0x242>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    14b1 <findLargestProductInGrid+0x361>
mov    -0x24(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    1444 <findLargestProductInGrid+0x2f4>
mov    -0x20(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     1444 <findLargestProductInGrid+0x2f4>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <largestProductDown@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    13f2 <findLargestProductInGrid+0x2a2>
mov    -0x18(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    13fa <findLargestProductInGrid+0x2aa>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1050 <largestProductDiagonalLeft@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    142f <findLargestProductInGrid+0x2df>
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    1437 <findLargestProductInGrid+0x2e7>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    14ac <findLargestProductInGrid+0x35c>
mov    -0x20(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    14a7 <findLargestProductInGrid+0x357>
mov    -0x24(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jg     14a7 <findLargestProductInGrid+0x357>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1070 <largestProductRight@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1497 <findLargestProductInGrid+0x347>
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    149f <findLargestProductInGrid+0x34f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    14ac <findLargestProductInGrid+0x35c>
jmp    14b1 <findLargestProductInGrid+0x361>
jmp    14b6 <findLargestProductInGrid+0x366>
jmp    14bb <findLargestProductInGrid+0x36b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118f <findLargestProductInGrid+0x3f>
jmp    14ce <findLargestProductInGrid+0x37e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <findLargestProductInGrid+0x2e>
mov    -0x10(%rbp),%rsi
lea    0xb19(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLargestProductInGrid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
lea    -0x1(%r14),%r13d
mov    $0x14,%ebp
sub    %edi,%ebp
mov    $0x1,%r12d
xor    %r15d,%r15d
mov    %r14,0x8(%rsp)
mov    %ebp,0x4(%rsp)
mov    %r13d,0x14(%rsp)
jmp    119e <findLargestProductInGrid+0x4e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    $0x14,%r15d
je     1312 <findLargestProductInGrid+0x1c2>
xor    %ebx,%ebx
jmp    11b8 <findLargestProductInGrid+0x68>
mov    0x8(%rsp),%r14
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x14,%ebx
je     1190 <findLargestProductInGrid+0x40>
cmp    %r13d,%ebx
jge    1220 <findLargestProductInGrid+0xd0>
cmp    %ebp,%r15d
jg     1220 <findLargestProductInGrid+0xd0>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1070 <largestProductRight@plt>
mov    %rax,%rbp
cmp    %r12,%rax
jg     11da <findLargestProductInGrid+0x8a>
mov    %r12,%rbp
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1030 <largestProductDiagonalRight@plt>
mov    %rax,%r13
cmp    %rbp,%rax
jg     11f2 <findLargestProductInGrid+0xa2>
mov    %rbp,%r13
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1040 <largestProductDown@plt>
mov    %rax,%r12
cmp    %r13,%rax
jg     120a <findLargestProductInGrid+0xba>
mov    %r13,%r12
mov    0x14(%rsp),%r13d
mov    0x4(%rsp),%ebp
jmp    11b0 <findLargestProductInGrid+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r13d,%ebx
jl     12a0 <findLargestProductInGrid+0x150>
cmp    %ebp,%ebx
jg     12a0 <findLargestProductInGrid+0x150>
cmp    %ebp,%r15d
jg     12a0 <findLargestProductInGrid+0x150>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1070 <largestProductRight@plt>
mov    %rax,%rbp
cmp    %r12,%rax
jg     1246 <findLargestProductInGrid+0xf6>
mov    %r12,%rbp
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1030 <largestProductDiagonalRight@plt>
mov    %rax,%r12
cmp    %rbp,%rax
jg     125e <findLargestProductInGrid+0x10e>
mov    %rbp,%r12
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1040 <largestProductDown@plt>
mov    %rax,%rbp
cmp    %r12,%rax
jg     1276 <findLargestProductInGrid+0x126>
mov    %r12,%rbp
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1050 <largestProductDiagonalLeft@plt>
mov    %rax,%r12
cmp    %rbp,%rax
jg     128e <findLargestProductInGrid+0x13e>
mov    %rbp,%r12
mov    0x8(%rsp),%r14
jmp    120f <findLargestProductInGrid+0xbf>
nopl   0x0(%rax,%rax,1)
cmp    %ebp,%ebx
jle    12e4 <findLargestProductInGrid+0x194>
cmp    %ebp,%r15d
jg     12e4 <findLargestProductInGrid+0x194>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1040 <largestProductDown@plt>
mov    %rax,%r14
cmp    %r12,%rax
jg     12c1 <findLargestProductInGrid+0x171>
mov    %r12,%r14
mov    0x8(%rsp),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
call   1050 <largestProductDiagonalLeft@plt>
mov    %rax,%r12
cmp    %r14,%rax
jg     11a2 <findLargestProductInGrid+0x52>
mov    %r14,%r12
jmp    11a2 <findLargestProductInGrid+0x52>
cmp    %ebp,%r15d
jle    11b0 <findLargestProductInGrid+0x60>
cmp    %ebp,%ebx
jg     11b0 <findLargestProductInGrid+0x60>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1070 <largestProductRight@plt>
cmp    %r12,%rax
jg     130a <findLargestProductInGrid+0x1ba>
mov    %r12,%rax
mov    %rax,%r12
jmp    11b0 <findLargestProductInGrid+0x60>
lea    0xce7(%rip),%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Largest Product Found %ld\0A\00"
define i64 @findLargestProductInGrid(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i64 1, i64* %3
store i64 1, i64* %4
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %202, %1
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 20
br i1 %12, label %13, label %205
13: ; preds = %10
store i32 0, i32* %7
br label %14
14: ; preds = %198, %13
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 20
br i1 %16, label %17, label %201
17: ; preds = %14
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %66
21: ; preds = %17
%22 = load i32, i32* %6
%23 = load i32, i32* %2
%24 = sub nsw i32 20, %23
%25 = icmp sle i32 %22, %24
br i1 %25, label %26, label %66
26: ; preds = %21
%27 = load i32, i32* %2
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i64 @largestProductRight(i32 %27, i32 %28, i32 %29)
store i64 %30, i64* %4
%31 = load i64, i64* %4
%32 = load i64, i64* %3
%33 = icmp sgt i64 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %26
%35 = load i64, i64* %4
br label %38
36: ; preds = %26
%37 = load i64, i64* %3
br label %38
38: ; preds = %36, %34
%39 = phi i64 [ %35, %34 ], [ %37, %36 ]
store i64 %39, i64* %3
%40 = load i32, i32* %2
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = call i64 @largestProductDiagonalRight(i32 %40, i32 %41, i32 %42)
store i64 %43, i64* %4
%44 = load i64, i64* %4
%45 = load i64, i64* %3
%46 = icmp sgt i64 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %38
%48 = load i64, i64* %4
br label %51
49: ; preds = %38
%50 = load i64, i64* %3
br label %51
51: ; preds = %49, %47
%52 = phi i64 [ %48, %47 ], [ %50, %49 ]
store i64 %52, i64* %3
%53 = load i32, i32* %2
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = call i64 @largestProductDown(i32 %53, i32 %54, i32 %55)
store i64 %56, i64* %4
%57 = load i64, i64* %4
%58 = load i64, i64* %3
%59 = icmp sgt i64 %57, %58
br i1 %59, label %60, label %62
60: ; preds = %51
%61 = load i64, i64* %4
br label %64
62: ; preds = %51
%63 = load i64, i64* %3
br label %64
64: ; preds = %62, %60
%65 = phi i64 [ %61, %60 ], [ %63, %62 ]
store i64 %65, i64* %3
br label %197
66: ; preds = %21, %17
%67 = load i32, i32* %7
%68 = load i32, i32* %5
%69 = icmp sge i32 %67, %68
br i1 %69, label %70, label %133
70: ; preds = %66
%71 = load i32, i32* %7
%72 = load i32, i32* %2
%73 = sub nsw i32 20, %72
%74 = icmp sle i32 %71, %73
br i1 %74, label %75, label %133
75: ; preds = %70
%76 = load i32, i32* %6
%77 = load i32, i32* %2
%78 = sub nsw i32 20, %77
%79 = icmp sle i32 %76, %78
br i1 %79, label %80, label %133
80: ; preds = %75
%81 = load i32, i32* %2
%82 = load i32, i32* %6
%83 = load i32, i32* %7
%84 = call i64 @largestProductRight(i32 %81, i32 %82, i32 %83)
store i64 %84, i64* %4
%85 = load i64, i64* %4
%86 = load i64, i64* %3
%87 = icmp sgt i64 %85, %86
br i1 %87, label %88, label %90
88: ; preds = %80
%89 = load i64, i64* %4
br label %92
90: ; preds = %80
%91 = load i64, i64* %3
br label %92
92: ; preds = %90, %88
%93 = phi i64 [ %89, %88 ], [ %91, %90 ]
store i64 %93, i64* %3
%94 = load i32, i32* %2
%95 = load i32, i32* %6
%96 = load i32, i32* %7
%97 = call i64 @largestProductDiagonalRight(i32 %94, i32 %95, i32 %96)
store i64 %97, i64* %4
%98 = load i64, i64* %4
%99 = load i64, i64* %3
%100 = icmp sgt i64 %98, %99
br i1 %100, label %101, label %103
101: ; preds = %92
%102 = load i64, i64* %4
br label %105
103: ; preds = %92
%104 = load i64, i64* %3
br label %105
105: ; preds = %103, %101
%106 = phi i64 [ %102, %101 ], [ %104, %103 ]
store i64 %106, i64* %3
%107 = load i32, i32* %2
%108 = load i32, i32* %6
%109 = load i32, i32* %7
%110 = call i64 @largestProductDown(i32 %107, i32 %108, i32 %109)
store i64 %110, i64* %4
%111 = load i64, i64* %4
%112 = load i64, i64* %3
%113 = icmp sgt i64 %111, %112
br i1 %113, label %114, label %116
114: ; preds = %105
%115 = load i64, i64* %4
br label %118
116: ; preds = %105
%117 = load i64, i64* %3
br label %118
118: ; preds = %116, %114
%119 = phi i64 [ %115, %114 ], [ %117, %116 ]
store i64 %119, i64* %3
%120 = load i32, i32* %2
%121 = load i32, i32* %6
%122 = load i32, i32* %7
%123 = call i64 @largestProductDiagonalLeft(i32 %120, i32 %121, i32 %122)
store i64 %123, i64* %4
%124 = load i64, i64* %4
%125 = load i64, i64* %3
%126 = icmp sgt i64 %124, %125
br i1 %126, label %127, label %129
127: ; preds = %118
%128 = load i64, i64* %4
br label %131
129: ; preds = %118
%130 = load i64, i64* %3
br label %131
131: ; preds = %129, %127
%132 = phi i64 [ %128, %127 ], [ %130, %129 ]
store i64 %132, i64* %3
br label %196
133: ; preds = %75, %70, %66
%134 = load i32, i32* %7
%135 = load i32, i32* %2
%136 = sub nsw i32 20, %135
%137 = icmp sgt i32 %134, %136
br i1 %137, label %138, label %170
138: ; preds = %133
%139 = load i32, i32* %6
%140 = load i32, i32* %2
%141 = sub nsw i32 20, %140
%142 = icmp sle i32 %139, %141
br i1 %142, label %143, label %170
143: ; preds = %138
%144 = load i32, i32* %2
%145 = load i32, i32* %6
%146 = load i32, i32* %7
%147 = call i64 @largestProductDown(i32 %144, i32 %145, i32 %146)
store i64 %147, i64* %4
%148 = load i64, i64* %4
%149 = load i64, i64* %3
%150 = icmp sgt i64 %148, %149
br i1 %150, label %151, label %153
151: ; preds = %143
%152 = load i64, i64* %4
br label %155
153: ; preds = %143
%154 = load i64, i64* %3
br label %155
155: ; preds = %153, %151
%156 = phi i64 [ %152, %151 ], [ %154, %153 ]
store i64 %156, i64* %3
%157 = load i32, i32* %2
%158 = load i32, i32* %6
%159 = load i32, i32* %7
%160 = call i64 @largestProductDiagonalLeft(i32 %157, i32 %158, i32 %159)
store i64 %160, i64* %4
%161 = load i64, i64* %4
%162 = load i64, i64* %3
%163 = icmp sgt i64 %161, %162
br i1 %163, label %164, label %166
164: ; preds = %155
%165 = load i64, i64* %4
br label %168
166: ; preds = %155
%167 = load i64, i64* %3
br label %168
168: ; preds = %166, %164
%169 = phi i64 [ %165, %164 ], [ %167, %166 ]
store i64 %169, i64* %3
br label %195
170: ; preds = %138, %133
%171 = load i32, i32* %6
%172 = load i32, i32* %2
%173 = sub nsw i32 20, %172
%174 = icmp sgt i32 %171, %173
br i1 %174, label %175, label %194
175: ; preds = %170
%176 = load i32, i32* %7
%177 = load i32, i32* %2
%178 = sub nsw i32 20, %177
%179 = icmp sle i32 %176, %178
br i1 %179, label %180, label %194
180: ; preds = %175
%181 = load i32, i32* %2
%182 = load i32, i32* %6
%183 = load i32, i32* %7
%184 = call i64 @largestProductRight(i32 %181, i32 %182, i32 %183)
store i64 %184, i64* %4
%185 = load i64, i64* %4
%186 = load i64, i64* %3
%187 = icmp sgt i64 %185, %186
br i1 %187, label %188, label %190
188: ; preds = %180
%189 = load i64, i64* %4
br label %192
190: ; preds = %180
%191 = load i64, i64* %3
br label %192
192: ; preds = %190, %188
%193 = phi i64 [ %189, %188 ], [ %191, %190 ]
store i64 %193, i64* %3
br label %194
194: ; preds = %192, %175, %170
br label %195
195: ; preds = %194, %168
br label %196
196: ; preds = %195, %131
br label %197
197: ; preds = %196, %64
br label %198
198: ; preds = %197
%199 = load i32, i32* %7
%200 = add nsw i32 %199, 1
store i32 %200, i32* %7
br label %14
201: ; preds = %14
br label %202
202: ; preds = %201
%203 = load i32, i32* %6
%204 = add nsw i32 %203, 1
store i32 %204, i32* %6
br label %10
205: ; preds = %10
%206 = load i64, i64* %3
%207 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %206)
%208 = load i64, i64* %3
ret i64 %208
}

LLVM IR (-O2):
@.str = [27 x i8] c"Largest Product Found %ld\0A\00"
define i64 @findLargestProductInGrid(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sub nsw i32 20, %0
br label %4
4: ; preds = %1, %11
%5 = phi i32 [ 0, %1 ], [ %12, %11 ]
%6 = phi i64 [ 1, %1 ], [ %65, %11 ]
%7 = icmp sgt i32 %5, %3
%8 = icmp sle i32 %5, %3
br label %14
9: ; preds = %11
%10 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %65)
ret i64 %65
11: ; preds = %64
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, 20
br i1 %13, label %9, label %4
14: ; preds = %4, %64
%15 = phi i32 [ 0, %4 ], [ %66, %64 ]
%16 = phi i64 [ %6, %4 ], [ %65, %64 ]
%17 = icmp sge i32 %15, %2
%18 = select i1 %17, i1 true, i1 %7
br i1 %18, label %29, label %19
19: ; preds = %14
%20 = tail call i64 @largestProductRight(i32 %0, i32 %5, i32 %15)
%21 = icmp sgt i64 %20, %16
%22 = select i1 %21, i64 %20, i64 %16
%23 = tail call i64 @largestProductDiagonalRight(i32 %0, i32 %5, i32 %15)
%24 = icmp sgt i64 %23, %22
%25 = select i1 %24, i64 %23, i64 %22
%26 = tail call i64 @largestProductDown(i32 %0, i32 %5, i32 %15)
%27 = icmp sgt i64 %26, %25
%28 = select i1 %27, i64 %26, i64 %25
br label %64
29: ; preds = %14
%30 = icmp slt i32 %15, %2
br i1 %30, label %47, label %31
31: ; preds = %29
%32 = icmp sgt i32 %15, %3
%33 = select i1 %32, i1 true, i1 %7
br i1 %33, label %47, label %34
34: ; preds = %31
%35 = tail call i64 @largestProductRight(i32 %0, i32 %5, i32 %15)
%36 = icmp sgt i64 %35, %16
%37 = select i1 %36, i64 %35, i64 %16
%38 = tail call i64 @largestProductDiagonalRight(i32 %0, i32 %5, i32 %15)
%39 = icmp sgt i64 %38, %37
%40 = select i1 %39, i64 %38, i64 %37
%41 = tail call i64 @largestProductDown(i32 %0, i32 %5, i32 %15)
%42 = icmp sgt i64 %41, %40
%43 = select i1 %42, i64 %41, i64 %40
%44 = tail call i64 @largestProductDiagonalLeft(i32 %0, i32 %5, i32 %15)
%45 = icmp sgt i64 %44, %43
%46 = select i1 %45, i64 %44, i64 %43
br label %64
47: ; preds = %31, %29
%48 = icmp sle i32 %15, %3
%49 = select i1 %48, i1 true, i1 %7
br i1 %49, label %57, label %50
50: ; preds = %47
%51 = tail call i64 @largestProductDown(i32 %0, i32 %5, i32 %15)
%52 = icmp sgt i64 %51, %16
%53 = select i1 %52, i64 %51, i64 %16
%54 = tail call i64 @largestProductDiagonalLeft(i32 %0, i32 %5, i32 %15)
%55 = icmp sgt i64 %54, %53
%56 = select i1 %55, i64 %54, i64 %53
br label %64
57: ; preds = %47
%58 = icmp sgt i32 %15, %3
%59 = select i1 %8, i1 true, i1 %58
br i1 %59, label %64, label %60
60: ; preds = %57
%61 = tail call i64 @largestProductRight(i32 %0, i32 %5, i32 %15)
%62 = icmp sgt i64 %61, %16
%63 = select i1 %62, i64 %61, i64 %16
br label %64
64: ; preds = %19, %50, %60, %57, %34
%65 = phi i64 [ %28, %19 ], [ %46, %34 ], [ %56, %50 ], [ %63, %60 ], [ %16, %57 ]
%66 = add nuw nsw i32 %15, 1
%67 = icmp eq i32 %66, 20
br i1 %67, label %11, label %14
}