#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 */
int col(unsigned long, int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  long unsigned n;
  int counter = 0;
  int arr[2000000];
  int currnum = 0;
  int currind;
  unsigned long int i;
  for (i = 0; i < 2000000; i++) {
    arr[i] = -1;
  }
  arr[1] = 0;
  for (i = 1; i < 1000000; i++) {
    arr[i] = col(i, arr);
    if (arr[i] > currnum) {
      currnum = arr[i];
      currind = i;
    }
  }
  printf("%d\n", currind);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7a1230,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x7a1224(%rbp)
movq   $0x0,-0x7a1230(%rbp)
cmpq   $0x1e8480,-0x7a1230(%rbp)
jae    1188 <main+0x68>
mov    -0x7a1230(%rbp),%rax
movl   $0xffffffff,-0x7a1220(%rbp,%rax,4)
ff ff ff ff
mov    -0x7a1230(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x7a1230(%rbp)
jmp    114e <main+0x2e>
movl   $0x0,-0x7a121c(%rbp)
movq   $0x1,-0x7a1230(%rbp)
cmpq   $0xf4240,-0x7a1230(%rbp)
jae    1228 <main+0x108>
mov    -0x7a1230(%rbp),%rdi
lea    -0x7a1220(%rbp),%rsi
call   1030 <col@plt>
mov    %eax,%ecx
mov    -0x7a1230(%rbp),%rax
mov    %ecx,-0x7a1220(%rbp,%rax,4)
mov    -0x7a1230(%rbp),%rax
mov    -0x7a1220(%rbp,%rax,4),%eax
cmp    -0x7a1224(%rbp),%eax
jle    120c <main+0xec>
mov    -0x7a1230(%rbp),%rax
mov    -0x7a1220(%rbp,%rax,4),%eax
mov    %eax,-0x7a1224(%rbp)
mov    -0x7a1230(%rbp),%rax
mov    %eax,-0x7a1228(%rbp)
jmp    1211 <main+0xf1>
mov    -0x7a1230(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x7a1230(%rbp)
jmp    119d <main+0x7d>
mov    -0x7a1228(%rbp),%esi
lea    0xdcb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7a1230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x7a1208,%rsp
mov    %rsp,%r14
mov    $0x7a1200,%edx
mov    %r14,%rdi
mov    $0xff,%esi
call   1050 <memset@plt>
movl   $0x0,0x4(%rsp)
xor    %ebp,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <col@plt>
mov    %eax,(%rsp,%rbx,4)
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmovg  %ebx,%r15d
add    $0x1,%rbx
cmp    $0xf4240,%rbx
jne    1170 <main+0x40>
lea    0xe65(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7a1208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca [2000000 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %5
store i64 0, i64* %7
br label %8
8: ; preds = %14, %0
%9 = load i64, i64* %7
%10 = icmp ult i64 %9, 2000000
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i64, i64* %7
%13 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 %12
store i32 -1, i32* %13
br label %14
14: ; preds = %11
%15 = load i64, i64* %7
%16 = add i64 %15, 1
store i64 %16, i64* %7
br label %8
17: ; preds = %8
%18 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 1
store i32 0, i32* %18
store i64 1, i64* %7
br label %19
19: ; preds = %40, %17
%20 = load i64, i64* %7
%21 = icmp ult i64 %20, 1000000
br i1 %21, label %22, label %43
22: ; preds = %19
%23 = load i64, i64* %7
%24 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 0
%25 = call i32 @col(i64 %23, i32* %24)
%26 = load i64, i64* %7
%27 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 %26
store i32 %25, i32* %27
%28 = load i64, i64* %7
%29 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %5
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %39
33: ; preds = %22
%34 = load i64, i64* %7
%35 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %5
%37 = load i64, i64* %7
%38 = trunc i64 %37 to i32
store i32 %38, i32* %6
br label %39
39: ; preds = %33, %22
br label %40
40: ; preds = %39
%41 = load i64, i64* %7
%42 = add i64 %41, 1
store i64 %42, i64* %7
br label %19
43: ; preds = %19
%44 = load i32, i32* %6
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [2000000 x i32]
%2 = bitcast [2000000 x i32]* %1 to i8*
%3 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %1, i64 0, i64 1
store i32 0, i32* %3
%4 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 1, %0 ], [ %15, %5 ]
%7 = phi i32 [ undef, %0 ], [ %14, %5 ]
%8 = phi i32 [ 0, %0 ], [ %13, %5 ]
%9 = call i32 @col(i64 %6, i32* %4)
%10 = getelementptr inbounds [2000000 x i32], [2000000 x i32]* %1, i64 0, i64 %6
store i32 %9, i32* %10
%11 = icmp sgt i32 %9, %8
%12 = trunc i64 %6 to i32
%13 = select i1 %11, i32 %9, i32 %8
%14 = select i1 %11, i32 %12, i32 %7
%15 = add nuw nsw i64 %6, 1
%16 = icmp eq i64 %15, 1000000
br i1 %16, label %17, label %5
17: ; preds = %5
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}