#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(int argc, char *argv[]) {
  const char number[] = "73167176531330624919225119674426574742355349194934"
                        "96983520312774506326239578318016984801869478851843"
                        "85861560789112949495459501737958331952853208805511"
                        "12540698747158523863050715693290963295227443043557"
                        "66896648950445244523161731856403098711121722383113"
                        "62229893423380308135336276614282806444486645238749"
                        "30358907296290491560440772390713810515859307960866"
                        "70172427121883998797908792274921901699720888093776"
                        "65727333001053367881220235421809751254540594752243"
                        "52584907711670556013604839586446706324415722155397"
                        "53697817977846174064955149290862569321978468622482"
                        "83972241375657056057490261407972968652414535100474"
                        "82166370484403199890008895243450658541227588666881"
                        "16427171479924442928230863465674813919123162824586"
                        "17866458359124566529476545682848912883142607690042"
                        "24219022671055626321111109370544217506941658960408"
                        "07198403850962455444362981230987879927244284909188"
                        "84580156166097919133875499200524063689912560717606"
                        "05886116467109405077541002256983155200055935729725"
                        "71636269561882670428252483600823257530420752963450";
  int largest = 0, mult, i;
  for (i = 0; i < 996; i++) {
    mult = (number[i] - '0') * (number[i + 1] - '0') * (number[i + 2] - '0') *
           (number[i + 3] - '0') * (number[i + 4] - '0');
    if (mult > largest)
      largest = mult;
  }
  printf("Largest: %d\n", largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x3e9,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x404(%rbp)
movl   $0x0,-0x40c(%rbp)
cmpl   $0x3e4,-0x40c(%rbp)
jge    122c <main+0x10c>
movslq -0x40c(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
mov    -0x40c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x400(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x40c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl -0x400(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x40c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl -0x400(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x40c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl -0x400(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    %eax,-0x408(%rbp)
mov    -0x408(%rbp),%eax
cmp    -0x404(%rbp),%eax
jle    1213 <main+0xf3>
mov    -0x408(%rbp),%eax
mov    %eax,-0x404(%rbp)
jmp    1218 <main+0xf8>
mov    -0x40c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40c(%rbp)
jmp    1165 <main+0x45>
mov    -0x404(%rbp),%esi
lea    0x11b0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %esi,%esi
mov    $0x37,%r10b
mov    $0x33,%al
mov    $0x31,%r11b
mov    $0x36,%dil
mov    $0x4,%ecx
lea    0xed6(%rip),%r8
nopw   0x0(%rax,%rax,1)
mov    %esi,%r9d
movsbl %r10b,%esi
mov    %eax,%r10d
movsbl %al,%edx
mov    %r11d,%eax
mov    %edi,%r11d
add    $0xffffffd0,%esi
add    $0xffffffd0,%edx
imul   %esi,%edx
movsbl %al,%esi
add    $0xffffffd0,%esi
movsbl %dil,%ebx
add    $0xffffffd0,%ebx
imul   %esi,%ebx
imul   %edx,%ebx
movsbl (%rcx,%r8,1),%edi
mov    %edi,%esi
add    $0xffffffd0,%esi
imul   %ebx,%esi
cmp    %r9d,%esi
cmovle %r9d,%esi
add    $0x1,%rcx
cmp    $0x3e8,%rcx
jne    1130 <main+0x20>
lea    0x1262(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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