#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 /*<<< orphan*/ printf(char *, float);
size_t strlen(char *);
float timeit();
int main(int argc, char *argv[]) {
  float start = timeit();
  char big_strnum[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  size_t str_len = strlen(big_strnum);
  long high = 0;
  for (int i = 0; i < str_len - 5; i++) {
    long total = 1;
    for (int j = 0; j < 5; j++)
      total *= (big_strnum[i + j] - '0');
    if (total > high)
      high = total;
  }
  float stop = timeit();
  printf("Answer: %ld\n", high);
  printf("Time: %.8f\n", stop - start);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <timeit@plt>
movss  %xmm0,-0x14(%rbp)
lea    -0x400(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x3e9,%edx
call   1050 <memcpy@plt>
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x408(%rbp)
movq   $0x0,-0x410(%rbp)
movl   $0x0,-0x414(%rbp)
movslq -0x414(%rbp),%rax
mov    -0x408(%rbp),%rcx
sub    $0x5,%rcx
cmp    %rcx,%rax
jae    125b <main+0x11b>
movq   $0x1,-0x420(%rbp)
movl   $0x0,-0x424(%rbp)
cmpl   $0x5,-0x424(%rbp)
jge    1220 <main+0xe0>
mov    -0x414(%rbp),%eax
add    -0x424(%rbp),%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
cltq
imul   -0x420(%rbp),%rax
ff
mov    %rax,-0x420(%rbp)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    11d5 <main+0x95>
mov    -0x420(%rbp),%rax
cmp    -0x410(%rbp),%rax
jle    1242 <main+0x102>
mov    -0x420(%rbp),%rax
mov    %rax,-0x410(%rbp)
jmp    1247 <main+0x107>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    11a5 <main+0x65>
mov    $0x0,%al
call   1060 <timeit@plt>
movss  %xmm0,-0x428(%rbp)
ff
cvtsi2ssq -0x410(%rbp),%xmm0
ff ff
lea    0x116f(%rip),%rdi
call   1040 <printf@plt>
movss  -0x428(%rbp),%xmm0
ff
subss  -0x14(%rbp),%xmm0
lea    0x1163(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <timeit@plt>
movss  %xmm0,0xc(%rsp)
mov    $0x37,%cl
mov    $0x4,%eax
lea    0xebe(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%r9
movsbq %cl,%rdi
add    $0xffffffffffffffd0,%rdi
movsbq -0x3(%rax,%r8,1),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffd0,%rdx
imul   %rdi,%rdx
movsbq -0x2(%rax,%r8,1),%rdi
add    $0xffffffffffffffd0,%rdi
movsbq -0x1(%rax,%r8,1),%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rdi,%rsi
imul   %rdx,%rsi
movsbq (%rax,%r8,1),%rbx
add    $0xffffffffffffffd0,%rbx
imul   %rsi,%rbx
cmp    %r9,%rbx
cmovle %r9,%rbx
add    $0x1,%rax
cmp    $0x3e7,%rax
jne    1150 <main+0x30>
xor    %eax,%eax
call   1040 <timeit@plt>
movss  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
lea    0x1225(%rip),%rdi
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
lea    0x121a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.big_strnum = [1001 x i8] c"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\00"
@.str = [13 x i8] c"Answer: %ld\0A\00"
@.str.1 = [12 x i8] c"Time: %.8f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca [1001 x i8]
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call float (...) @timeit()
store float %14, float* %6
%15 = bitcast [1001 x i8]* %7 to i8*
%16 = getelementptr inbounds [1001 x i8], [1001 x i8]* %7, i64 0, i64 0
%17 = call i64 @strlen(i8* %16)
store i64 %17, i64* %8
store i64 0, i64* %9
store i32 0, i32* %10
br label %18
18: ; preds = %50, %2
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = load i64, i64* %8
%22 = sub i64 %21, 5
%23 = icmp ult i64 %20, %22
br i1 %23, label %24, label %53
24: ; preds = %18
store i64 1, i64* %11
store i32 0, i32* %12
br label %25
25: ; preds = %40, %24
%26 = load i32, i32* %12
%27 = icmp slt i32 %26, 5
br i1 %27, label %28, label %43
28: ; preds = %25
%29 = load i32, i32* %10
%30 = load i32, i32* %12
%31 = add nsw i32 %29, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1001 x i8], [1001 x i8]* %7, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = sub nsw i32 %35, 48
%37 = sext i32 %36 to i64
%38 = load i64, i64* %11
%39 = mul nsw i64 %38, %37
store i64 %39, i64* %11
br label %40
40: ; preds = %28
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %25
43: ; preds = %25
%44 = load i64, i64* %11
%45 = load i64, i64* %9
%46 = icmp sgt i64 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = load i64, i64* %11
store i64 %48, i64* %9
br label %49
49: ; preds = %47, %43
br label %50
50: ; preds = %49
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %18
53: ; preds = %18
%54 = call float (...) @timeit()
store float %54, float* %13
%55 = load i64, i64* %9
%56 = sitofp i64 %55 to float
%57 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %56)
%58 = load float, float* %13
%59 = load float, float* %6
%60 = fsub float %58, %59
%61 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float %60)
ret i32 0
}

LLVM IR (-O2):
@__const.main.big_strnum = [1001 x i8] c"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\00"
@.str = [13 x i8] c"Answer: %ld\0A\00"
@.str.1 = [12 x i8] c"Time: %.8f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call float (...) @timeit()
br label %4
4: ; preds = %2, %4
%5 = phi i8 [ 55, %2 ], [ %12, %4 ]
%6 = phi i64 [ 0, %2 ], [ %10, %4 ]
%7 = phi i64 [ 0, %2 ], [ %35, %4 ]
%8 = sext i8 %5 to i64
%9 = add nsw i64 %8, -48
%10 = add nuw nsw i64 %6, 1
%11 = getelementptr inbounds [1001 x i8], [1001 x i8]* @__const.main.big_strnum, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i64
%14 = add nsw i64 %13, -48
%15 = mul nsw i64 %14, %9
%16 = add nuw nsw i64 %6, 2
%17 = getelementptr inbounds [1001 x i8], [1001 x i8]* @__const.main.big_strnum, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i64
%20 = add nsw i64 %19, -48
%21 = mul nsw i64 %20, %15
%22 = add nuw nsw i64 %6, 3
%23 = getelementptr inbounds [1001 x i8], [1001 x i8]* @__const.main.big_strnum, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i64
%26 = add nsw i64 %25, -48
%27 = mul nsw i64 %26, %21
%28 = add nuw nsw i64 %6, 4
%29 = getelementptr inbounds [1001 x i8], [1001 x i8]* @__const.main.big_strnum, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i64
%32 = add nsw i64 %31, -48
%33 = mul nsw i64 %32, %27
%34 = icmp sgt i64 %33, %7
%35 = select i1 %34, i64 %33, i64 %7
%36 = icmp eq i64 %10, 995
br i1 %36, label %37, label %4
37: ; preds = %4
%38 = tail call float (...) @timeit()
%39 = sitofp i64 %35 to float
%40 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %39)
%41 = fsub float %38, %3
%42 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float %41)
ret i32 0
}