#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 main() {
  char str[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  int numbers[1000];
  int maximum = 0;
  int product = 0;
  for (int i = 0; i < 1000; i++)
    numbers[i] = str[i] - '0';
  for (int i = 0; i < 995; i++) {
    product = numbers[i];
    product *= numbers[i + 1];
    product *= numbers[i + 2];
    product *= numbers[i + 3];
    product *= numbers[i + 4];
    if (product > maximum)
      maximum = product;
  }
  printf("%d", maximum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x3e9,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x1394(%rbp)
movl   $0x0,-0x1398(%rbp)
movl   $0x0,-0x139c(%rbp)
cmpl   $0x3e8,-0x139c(%rbp)
jge    11ac <main+0x8c>
movslq -0x139c(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%ecx
ff
sub    $0x30,%ecx
movslq -0x139c(%rbp),%rax
mov    %ecx,-0x1390(%rbp,%rax,4)
mov    -0x139c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x139c(%rbp)
jmp    1168 <main+0x48>
movl   $0x0,-0x13a0(%rbp)
cmpl   $0x3e3,-0x13a0(%rbp)
jge    128d <main+0x16d>
movslq -0x13a0(%rbp),%rax
mov    -0x1390(%rbp,%rax,4),%eax
mov    %eax,-0x1398(%rbp)
mov    -0x13a0(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1390(%rbp,%rax,4),%eax
imul   -0x1398(%rbp),%eax
mov    %eax,-0x1398(%rbp)
mov    -0x13a0(%rbp),%eax
add    $0x2,%eax
cltq
mov    -0x1390(%rbp,%rax,4),%eax
imul   -0x1398(%rbp),%eax
mov    %eax,-0x1398(%rbp)
mov    -0x13a0(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1390(%rbp,%rax,4),%eax
imul   -0x1398(%rbp),%eax
mov    %eax,-0x1398(%rbp)
mov    -0x13a0(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x1390(%rbp,%rax,4),%eax
imul   -0x1398(%rbp),%eax
mov    %eax,-0x1398(%rbp)
mov    -0x1398(%rbp),%eax
cmp    -0x1394(%rbp),%eax
jle    1274 <main+0x154>
mov    -0x1398(%rbp),%eax
mov    %eax,-0x1394(%rbp)
jmp    1279 <main+0x159>
mov    -0x13a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13a0(%rbp)
jmp    11b6 <main+0x96>
mov    -0x1394(%rbp),%esi
lea    0x114f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x13a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xfa8,%rsp
mov    $0xc,%eax
lea    0xeed(%rip),%rcx
movdqa 0xed5(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movd   -0x8(%rax,%rcx,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
punpcklbw -0xc(%rax,%rcx,1),%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm2
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm2
paddd  %xmm0,%xmm1
movdqa %xmm2,-0x30(%rsp,%rax,4)
movdqa %xmm1,-0x20(%rsp,%rax,4)
cmp    $0x3ec,%rax
je     11ac <main+0x9c>
movq   -0x4(%rax,%rcx,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
movd   (%rax,%rcx,1),%xmm2
punpcklbw %xmm2,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm1
psrad  $0x18,%xmm2
paddd  %xmm0,%xmm1
paddd  %xmm0,%xmm2
movdqa %xmm1,-0x10(%rsp,%rax,4)
movdqa %xmm2,(%rsp,%rax,4)
add    $0x10,%rax
jmp    1130 <main+0x20>
mov    (%rsp),%r9d
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%edi
xor    %r11d,%r11d
mov    $0x5,%r8d
mov    0xc(%rsp),%r10d
cs nopw 0x0(%rax,%rax,1)
mov    %r9d,%ecx
mov    %edi,%r9d
imul   %edx,%ecx
mov    %edi,%esi
imul   %r10d,%esi
imul   %ecx,%esi
mov    -0x4(%rsp,%r8,4),%edi
imul   %edi,%esi
cmp    %r11d,%esi
cmovle %r11d,%esi
cmp    $0x3e7,%r8
je     1221 <main+0x111>
mov    %r10d,%eax
imul   %r9d,%edx
imul   %r10d,%edx
imul   %edi,%edx
mov    (%rsp,%r8,4),%r10d
imul   %r10d,%edx
cmp    %esi,%edx
mov    %edx,%r11d
cmovle %esi,%r11d
add    $0x2,%r8
mov    %eax,%edx
jmp    11d0 <main+0xc0>
lea    0x11d1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfa8,%rsp
ret

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

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