#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 *, int);
int strlen(char *);
int main(int argc, char **argv) {
  char *str = "73167176531330624919225119674426574742355349194934"
              "96983520312774506326239578318016984801869478851843"
              "85861560789112949495459501737958331952853208805511"
              "12540698747158523863050715693290963295227443043557"
              "66896648950445244523161731856403098711121722383113"
              "62229893423380308135336276614282806444486645238749"
              "30358907296290491560440772390713810515859307960866"
              "70172427121883998797908792274921901699720888093776"
              "65727333001053367881220235421809751254540594752243"
              "52584907711670556013604839586446706324415722155397"
              "53697817977846174064955149290862569321978468622482"
              "83972241375657056057490261407972968652414535100474"
              "82166370484403199890008895243450658541227588666881"
              "16427171479924442928230863465674813919123162824586"
              "17866458359124566529476545682848912883142607690042"
              "24219022671055626321111109370544217506941658960408"
              "07198403850962455444362981230987879927244284909188"
              "84580156166097919133875499200524063689912560717606"
              "05886116467109405077541002256983155200055935729725"
              "71636269561882670428252483600823257530420752963450";
  int i, j;
  int s, m = 0;
  for (i = 0; i < strlen(str) - 4; i++) {
    s = 1;
    for (j = 0; j < 5; j++)
      s *= str[i + j] - '0';
    if (s > m)
      m = s;
  }
  printf("%d\n", m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
sub    $0x4,%ecx
cmp    %ecx,%eax
jge    11d4 <main+0xb4>
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    11af <main+0x8f>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
imul   -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117c <main+0x5c>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    11c1 <main+0xa1>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <main+0x2f>
mov    -0x28(%rbp),%esi
lea    0x120b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
xor    %ebp,%ebp
cmp    $0x5,%eax
jl     11a7 <main+0x87>
xor    %eax,%eax
mov    $0x37,%bl
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %bl,%ecx
add    $0xffffffd0,%ecx
lea    0x1(%rax),%r15
movsbl 0x1(%rax,%r14,1),%ebx
mov    %ebx,%edx
add    $0xffffffd0,%edx
imul   %ecx,%edx
movsbl 0x2(%rax,%r14,1),%ecx
add    $0xffffffd0,%ecx
movsbl 0x3(%rax,%r14,1),%esi
add    $0xffffffd0,%esi
imul   %ecx,%esi
imul   %edx,%esi
movsbl 0x4(%rax,%r14,1),%eax
add    $0xffffffd0,%eax
imul   %esi,%eax
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xfffffffc,%eax
movslq %eax,%rcx
mov    %r15,%rax
cmp    %rcx,%r15
jl     1150 <main+0x30>
lea    0x123b(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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