#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
int main(int argc, char *argv[]) {
  char str[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  char buffer[5];
  int prod, large;
  int i, j;
  int len = strlen(str);
  prod = 0;
  for (i = 0; i <= len - 5; i++) {
    memcpy(buffer, &str[i], 5);
    for (j = 0; j < 5; j++) {
      buffer[j] -= '0';
    }
    prod = buffer[0] * buffer[1] * buffer[2] * buffer[3] * buffer[4];
    if (prod > large) {
      large = prod;
    }
  }
  printf("%d\n", large);
}


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)
lea    -0x400(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x3e9,%edx
call   1050 <memcpy@plt>
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x41c(%rbp)
movl   $0x0,-0x40c(%rbp)
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
mov    -0x41c(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
jg     1270 <main+0x140>
lea    -0x405(%rbp),%rdi
movslq -0x414(%rbp),%rax
lea    -0x400(%rbp),%rsi
add    %rax,%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x418(%rbp)
cmpl   $0x5,-0x418(%rbp)
jge    1204 <main+0xd4>
movslq -0x418(%rbp),%rax
movsbl -0x405(%rbp,%rax,1),%ecx
ff
sub    $0x30,%ecx
mov    %cl,-0x405(%rbp,%rax,1)
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    11ca <main+0x9a>
movsbl -0x405(%rbp),%eax
movsbl -0x404(%rbp),%ecx
imul   %ecx,%eax
movsbl -0x403(%rbp),%ecx
imul   %ecx,%eax
movsbl -0x402(%rbp),%ecx
imul   %ecx,%eax
movsbl -0x401(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x40c(%rbp)
mov    -0x40c(%rbp),%eax
cmp    -0x410(%rbp),%eax
jle    1257 <main+0x127>
mov    -0x40c(%rbp),%eax
mov    %eax,-0x410(%rbp)
jmp    125c <main+0x12c>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1187 <main+0x57>
mov    -0x410(%rbp),%esi
lea    0x116c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
lea    0xeba(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    $0x3e9,%edx
mov    %rbp,%rdi
call   1050 <memcpy@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
add    $0xfffffffc,%r14d
lea    0xb(%rsp),%r15
nopl   0x0(%rax)
mov    %esi,%r12d
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x5,%edx
call   1050 <memcpy@plt>
movzbl 0xb(%rsp),%esi
movzbl 0xc(%rsp),%ecx
add    $0xd0,%sil
mov    %sil,0xb(%rsp)
add    $0xd0,%cl
mov    %cl,0xc(%rsp)
movzbl 0xd(%rsp),%edx
add    $0xd0,%dl
mov    %dl,0xd(%rsp)
movzbl 0xe(%rsp),%ebx
add    $0xd0,%bl
mov    %bl,0xe(%rsp)
movzbl 0xf(%rsp),%eax
add    $0xd0,%al
mov    %al,0xf(%rsp)
movsbl %sil,%esi
movsbl %cl,%ecx
imul   %esi,%ecx
movsbl %dl,%edx
movsbl %bl,%edi
imul   %edx,%edi
imul   %ecx,%edi
movsbl %al,%esi
imul   %edi,%esi
cmp    %r12d,%esi
cmovle %r12d,%esi
add    $0x1,%rbp
add    $0xffffffffffffffff,%r14
jne    1170 <main+0x40>
lea    0x11f5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.str = [1001 x i8] c"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\00"
@.str = [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 [1001 x i8]
%7 = alloca [5 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [1001 x i8]* %6 to i8*
%14 = getelementptr inbounds [1001 x i8], [1001 x i8]* %6, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %12
store i32 0, i32* %8
store i32 0, i32* %10
br label %16
16: ; preds = %67, %2
%17 = load i32, i32* %10
%18 = load i32, i32* %12
%19 = sub nsw i32 %18, 5
%20 = icmp sle i32 %17, %19
br i1 %20, label %21, label %70
21: ; preds = %16
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [1001 x i8], [1001 x i8]* %6, i64 0, i64 %24
%26 = call i32 @memcpy(i8* %22, i8* %25, i32 5)
store i32 0, i32* %11
br label %27
27: ; preds = %38, %21
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 5
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i8], [5 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 = trunc i32 %36 to i8
store i8 %37, i8* %33
br label %38
38: ; preds = %30
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %27
41: ; preds = %27
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 1
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = mul nsw i32 %44, %47
%49 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 2
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = mul nsw i32 %48, %51
%53 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 3
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = mul nsw i32 %52, %55
%57 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 4
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = mul nsw i32 %56, %59
store i32 %60, i32* %8
%61 = load i32, i32* %8
%62 = load i32, i32* %9
%63 = icmp sgt i32 %61, %62
br i1 %63, label %64, label %66
64: ; preds = %41
%65 = load i32, i32* %8
store i32 %65, i32* %9
br label %66
66: ; preds = %64, %41
br label %67
67: ; preds = %66
%68 = load i32, i32* %10
%69 = add nsw i32 %68, 1
store i32 %69, i32* %10
br label %16
70: ; preds = %16
%71 = load i32, i32* %9
%72 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %3
ret i32 %73
}

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