#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 *, unsigned long long);
int main(int argc, char *argv[]) {
  unsigned long long max_prod = 0;
  unsigned long long prod = 0;
  char str[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  for (int i = 0; i <= 986; i++) {
    prod = (unsigned long long)(str[i] - '0') * (str[i + 1] - '0') *
           (unsigned long long)(str[i + 2] - '0') * (str[i + 3] - '0') *
           (unsigned long long)(str[i + 4] - '0') * (str[i + 5] - '0') *
           (unsigned long long)(str[i + 6] - '0') * (str[i + 7] - '0') *
           (unsigned long long)(str[i + 8] - '0') * (str[i + 9] - '0') *
           (unsigned long long)(str[i + 10] - '0') * (str[i + 11] - '0') *
           (unsigned long long)(str[i + 12] - '0');
    if (prod >= max_prod)
      max_prod = prod;
  }
  printf("Max: %llu\n", max_prod);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x3e9,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x414(%rbp)
cmpl   $0x3da,-0x414(%rbp)
jg     132a <main+0x20a>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
cltq
mov    -0x414(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x7,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0x9,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0xa,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0xb,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    -0x414(%rbp),%ecx
add    $0xc,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jb     1311 <main+0x1f1>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1316 <main+0x1f6>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    116b <main+0x4b>
mov    -0x18(%rbp),%rsi
lea    0x10b4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x37,%r10b
mov    $0x36,%r11b
mov    $0x35,%r14b
mov    $0x31,%r15b
mov    $0x33,%r12b
mov    $0xc,%eax
mov    %rax,0x8(%rsp)
xor    %esi,%esi
mov    $0x33,%r13b
mov    $0x31,%cl
mov    $0x37,%dl
mov    $0x36,%bl
mov    $0x31,%dil
mov    $0x33,%r9b
mov    $0x37,%al
nopw   0x0(%rax,%rax,1)
mov    %rsi,0x10(%rsp)
movsbq %al,%rsi
movsbq %r9b,%rax
mov    %r9b,0x7(%rsp)
mov    %edi,%r9d
mov    %ebx,%edi
mov    %edx,%ebx
mov    %ecx,%edx
mov    %r10d,%ecx
mov    %r11d,%r10d
mov    %r14d,%r11d
mov    %r13d,%r14d
mov    %r15d,%r13d
mov    %r12d,%r15d
add    $0xffffffffffffffd0,%rsi
add    $0xffffffffffffffd0,%rax
imul   %rsi,%rax
movsbq %r9b,%rsi
add    $0xffffffffffffffd0,%rsi
movsbq %dil,%rbp
add    $0xffffffffffffffd0,%rbp
imul   %rsi,%rbp
imul   %rax,%rbp
movsbq %bl,%rax
add    $0xffffffffffffffd0,%rax
movsbq %dl,%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rax,%rsi
movsbq %cl,%rax
add    $0xffffffffffffffd0,%rax
imul   %rsi,%rax
imul   %rbp,%rax
movsbq %r10b,%rsi
add    $0xffffffffffffffd0,%rsi
movsbq %r11b,%rbp
add    $0xffffffffffffffd0,%rbp
imul   %rsi,%rbp
movsbq %r14b,%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rbp,%rsi
movsbq %r13b,%r8
add    $0xffffffffffffffd0,%r8
imul   %rsi,%r8
imul   %rax,%r8
movsbq %r12b,%rax
add    $0xffffffffffffffd0,%rax
lea    0xdfc(%rip),%rsi
mov    0x8(%rsp),%rbp
movsbq 0x0(%rbp,%rsi,1),%r12
mov    %r12,%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rax,%rsi
imul   %r8,%rsi
mov    0x10(%rsp),%rax
cmp    %rax,%rsi
cmovb  %rax,%rsi
movzbl 0x7(%rsp),%eax
add    $0x1,%rbp
mov    %rbp,0x8(%rsp)
cmp    $0x3e7,%rbp
jne    1150 <main+0x40>
lea    0x119d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.str = [1001 x i8] c"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\00"
@.str = [11 x i8] c"Max: %llu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca [1001 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i64 0, i64* %7
%10 = bitcast [1001 x i8]* %8 to i8*
store i32 0, i32* %9
br label %11
11: ; preds = %136, %2
%12 = load i32, i32* %9
%13 = icmp sle i32 %12, 986
br i1 %13, label %14, label %139
14: ; preds = %11
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 48
%21 = sext i32 %20 to i64
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %27, 48
%29 = sext i32 %28 to i64
%30 = mul i64 %21, %29
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %36, 48
%38 = sext i32 %37 to i64
%39 = mul i64 %30, %38
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = sub nsw i32 %45, 48
%47 = sext i32 %46 to i64
%48 = mul i64 %39, %47
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = sub nsw i32 %54, 48
%56 = sext i32 %55 to i64
%57 = mul i64 %48, %56
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = sub nsw i32 %63, 48
%65 = sext i32 %64 to i64
%66 = mul i64 %57, %65
%67 = load i32, i32* %9
%68 = add nsw i32 %67, 6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = sub nsw i32 %72, 48
%74 = sext i32 %73 to i64
%75 = mul i64 %66, %74
%76 = load i32, i32* %9
%77 = add nsw i32 %76, 7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = sub nsw i32 %81, 48
%83 = sext i32 %82 to i64
%84 = mul i64 %75, %83
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = sub nsw i32 %90, 48
%92 = sext i32 %91 to i64
%93 = mul i64 %84, %92
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 9
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = sub nsw i32 %99, 48
%101 = sext i32 %100 to i64
%102 = mul i64 %93, %101
%103 = load i32, i32* %9
%104 = add nsw i32 %103, 10
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %105
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = sub nsw i32 %108, 48
%110 = sext i32 %109 to i64
%111 = mul i64 %102, %110
%112 = load i32, i32* %9
%113 = add nsw i32 %112, 11
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = sub nsw i32 %117, 48
%119 = sext i32 %118 to i64
%120 = mul i64 %111, %119
%121 = load i32, i32* %9
%122 = add nsw i32 %121, 12
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [1001 x i8], [1001 x i8]* %8, i64 0, i64 %123
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = sub nsw i32 %126, 48
%128 = sext i32 %127 to i64
%129 = mul i64 %120, %128
store i64 %129, i64* %7
%130 = load i64, i64* %7
%131 = load i64, i64* %6
%132 = icmp uge i64 %130, %131
br i1 %132, label %133, label %135
133: ; preds = %14
%134 = load i64, i64* %7
store i64 %134, i64* %6
br label %135
135: ; preds = %133, %14
br label %136
136: ; preds = %135
%137 = load i32, i32* %9
%138 = add nsw i32 %137, 1
store i32 %138, i32* %9
br label %11
139: ; preds = %11
%140 = load i64, i64* %6
%141 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %140)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [1001 x i8] c"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\00"
@.str = [11 x i8] c"Max: %llu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %5
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %63)
ret i32 0
5: ; preds = %2, %5
%6 = phi i8 [ 51, %2 ], [ %58, %5 ]
%7 = phi i8 [ 49, %2 ], [ %6, %5 ]
%8 = phi i8 [ 51, %2 ], [ %7, %5 ]
%9 = phi i8 [ 53, %2 ], [ %8, %5 ]
%10 = phi i8 [ 54, %2 ], [ %9, %5 ]
%11 = phi i8 [ 55, %2 ], [ %10, %5 ]
%12 = phi i8 [ 49, %2 ], [ %11, %5 ]
%13 = phi i8 [ 55, %2 ], [ %12, %5 ]
%14 = phi i8 [ 54, %2 ], [ %13, %5 ]
%15 = phi i8 [ 49, %2 ], [ %14, %5 ]
%16 = phi i8 [ 51, %2 ], [ %15, %5 ]
%17 = phi i8 [ 55, %2 ], [ %16, %5 ]
%18 = phi i64 [ 0, %2 ], [ %22, %5 ]
%19 = phi i64 [ 0, %2 ], [ %63, %5 ]
%20 = sext i8 %17 to i64
%21 = add nsw i64 %20, -48
%22 = add nuw nsw i64 %18, 1
%23 = sext i8 %16 to i64
%24 = add nsw i64 %23, -48
%25 = mul nsw i64 %24, %21
%26 = sext i8 %15 to i64
%27 = add nsw i64 %26, -48
%28 = mul nsw i64 %25, %27
%29 = sext i8 %14 to i64
%30 = add nsw i64 %29, -48
%31 = mul nsw i64 %28, %30
%32 = sext i8 %13 to i64
%33 = add nsw i64 %32, -48
%34 = mul nsw i64 %31, %33
%35 = sext i8 %12 to i64
%36 = add nsw i64 %35, -48
%37 = mul nsw i64 %34, %36
%38 = sext i8 %11 to i64
%39 = add nsw i64 %38, -48
%40 = mul nsw i64 %37, %39
%41 = sext i8 %10 to i64
%42 = add nsw i64 %41, -48
%43 = mul nsw i64 %40, %42
%44 = sext i8 %9 to i64
%45 = add nsw i64 %44, -48
%46 = mul i64 %43, %45
%47 = sext i8 %8 to i64
%48 = add nsw i64 %47, -48
%49 = mul i64 %46, %48
%50 = sext i8 %7 to i64
%51 = add nsw i64 %50, -48
%52 = mul i64 %49, %51
%53 = sext i8 %6 to i64
%54 = add nsw i64 %53, -48
%55 = mul i64 %52, %54
%56 = add nuw nsw i64 %18, 12
%57 = getelementptr inbounds [1001 x i8], [1001 x i8]* @__const.main.str, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i64
%60 = add nsw i64 %59, -48
%61 = mul i64 %55, %60
%62 = icmp ult i64 %61, %19
%63 = select i1 %62, i64 %19, i64 %61
%64 = icmp eq i64 %22, 987
br i1 %64, label %3, label %5
}