#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 *, long);
int main(void) {
  int digits, count, count2;
  digits = 1000;
  char number[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  long product, currentBig;
  currentBig = 0;
  for (count = 0; count < digits - 13; count++) {
    product = 1;
    for (count2 = 0; count2 < 13; count2++) {
      int curNumber = number[count + count2] - 48;
      product *= curNumber;
    }
    if (product > currentBig)
      currentBig = product;
  }
  printf("Biggest product: %li\n", currentBig);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
lea    -0x400(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x3e9,%edx
call   1040 <memcpy@plt>
movq   $0x0,-0x410(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0xd,%ecx
cmp    %ecx,%eax
jge    1202 <main+0xe2>
movq   $0x1,-0x408(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xd,-0x10(%rbp)
jge    11cd <main+0xad>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
mov    %eax,-0x414(%rbp)
movslq -0x414(%rbp),%rax
imul   -0x408(%rbp),%rax
ff
mov    %rax,-0x408(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1186 <main+0x66>
mov    -0x408(%rbp),%rax
cmp    -0x410(%rbp),%rax
jle    11ef <main+0xcf>
mov    -0x408(%rbp),%rax
mov    %rax,-0x410(%rbp)
jmp    11f4 <main+0xd4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <main+0x43>
mov    -0x410(%rbp),%rsi
lea    0x11d9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x37,%r9b
mov    $0xc,%eax
xor    %esi,%esi
lea    0xede(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rsi,%r8
movsbq %r9b,%rsi
add    $0xffffffffffffffd0,%rsi
movsbq -0xb(%rax,%rdx,1),%r9
mov    %r9,%rcx
add    $0xffffffffffffffd0,%rcx
imul   %rsi,%rcx
movsbq -0xa(%rax,%rdx,1),%rsi
add    $0xffffffffffffffd0,%rsi
movsbq -0x9(%rax,%rdx,1),%rdi
add    $0xffffffffffffffd0,%rdi
imul   %rsi,%rdi
imul   %rcx,%rdi
movsbq -0x8(%rax,%rdx,1),%rcx
add    $0xffffffffffffffd0,%rcx
movsbq -0x7(%rax,%rdx,1),%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rcx,%rsi
movsbq -0x6(%rax,%rdx,1),%rcx
add    $0xffffffffffffffd0,%rcx
imul   %rsi,%rcx
imul   %rdi,%rcx
movsbq -0x5(%rax,%rdx,1),%rsi
add    $0xffffffffffffffd0,%rsi
movsbq -0x4(%rax,%rdx,1),%rdi
add    $0xffffffffffffffd0,%rdi
imul   %rsi,%rdi
movsbq -0x3(%rax,%rdx,1),%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rdi,%rsi
movsbq -0x2(%rax,%rdx,1),%rdi
add    $0xffffffffffffffd0,%rdi
imul   %rsi,%rdi
imul   %rcx,%rdi
movsbq -0x1(%rax,%rdx,1),%rcx
add    $0xffffffffffffffd0,%rcx
movsbq (%rax,%rdx,1),%rsi
add    $0xffffffffffffffd0,%rsi
imul   %rcx,%rsi
imul   %rdi,%rsi
cmp    %r8,%rsi
cmovle %r8,%rsi
add    $0x1,%rax
cmp    $0x3e7,%rax
jne    1130 <main+0x20>
lea    0x11e6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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