int main() {
  int i, max = 0, a = 0, b = 0, c = 0, d = 0, e = 0, x;
  char str[1000] = {"73167176531330624919225119674426574742355349194934"
                    "96983520312774506326239578318016984801869478851843"
                    "85861560789112949495459501737958331952853208805511"
                    "12540698747158523863050715693290963295227443043557"
                    "66896648950445244523161731856403098711121722383113"
                    "62229893423380308135336276614282806444486645238749"
                    "30358907296290491560440772390713810515859307960866"
                    "70172427121883998797908792274921901699720888093776"
                    "65727333001053367881220235421809751254540594752243"
                    "52584907711670556013604839586446706324415722155397"
                    "53697817977846174064955149290862569321978468622482"
                    "83972241375657056057490261407972968652414535100474"
                    "82166370484403199890008895243450658541227588666881"
                    "16427171479924442928230863465674813919123162824586"
                    "17866458359124566529476545682848912883142607690042"
                    "24219022671055626321111109370544217506941658960408"
                    "07198403850962455444362981230987879927244284909188"
                    "84580156166097919133875499200524063689912560717606"
                    "05886116467109405077541002256983155200055935729725"
                    "71636269561882670428252483600823257530420752963450"};
  for (i = 0; i < 996; i++) {
    x = (str[i] - 48) * (str[i + 1] - 48) * (str[i + 2] - 48) *
        (str[i + 3] - 48) * (str[i + 4] - 48);
    printf("%c * %c * %c * %c * %c = %i\n", str[i], str[i + 1], str[i + 2],
           str[i + 3], str[i + 4], x);
    if (x > max)
      max = x;
  }
  printf("Max: %i", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x3e8,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e4,-0x8(%rbp)
jge    127d <main+0x15d>
movslq -0x8(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
imul   %ecx,%eax
mov    %eax,-0x24(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%esi
ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x410(%rbp,%rax,1),%edx
ff
mov    -0x8(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x410(%rbp,%rax,1),%ecx
ff
mov    -0x8(%rbp),%eax
add    $0x3,%eax
cltq
movsbl -0x410(%rbp,%rax,1),%r8d
ff ff
mov    -0x8(%rbp),%eax
add    $0x4,%eax
cltq
movsbl -0x410(%rbp,%rax,1),%r9d
ff ff
mov    -0x24(%rbp),%eax
lea    0x119a(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    126a <main+0x14a>
mov    -0x24(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    126f <main+0x14f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x5b>
mov    -0xc(%rbp),%esi
lea    0x117e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x37,%al
mov    $0x33,%r13b
mov    $0x31,%r15b
mov    $0x36,%r12b
mov    $0x4,%ebx
xor    %ebp,%ebp
mov    %ebp,%r14d
mov    %r13d,%ecx
mov    %r13b,0x17(%rsp)
mov    %r15d,%r13d
mov    %r12d,%r15d
movsbl %al,%esi
lea    -0x30(%rsi),%eax
movsbl %cl,%edx
lea    -0x30(%rdx),%edi
imul   %eax,%edi
movsbl %r13b,%ecx
lea    -0x30(%rcx),%ebp
movsbl %r12b,%r8d
lea    -0x30(%r8),%eax
imul   %ebp,%eax
imul   %edi,%eax
lea    0xe94(%rip),%rdi
movzbl (%rbx,%rdi,1),%r12d
movsbl %r12b,%r9d
lea    -0x30(%r9),%ebp
imul   %eax,%ebp
mov    %ebp,(%rsp)
lea    0x1262(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    %r14d,%ebp
cmovle %r14d,%ebp
add    $0x1,%rbx
movzbl 0x17(%rsp),%eax
cmp    $0x3e8,%rbx
jne    1130 <main+0x20>
lea    0x1258(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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