#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 ctoi(char);
int /*<<< orphan*/ printf(char *, unsigned long long);
size_t strlen(char *);
int main(int argc, char const *argv[]) {
  char num[] =
      "731671765313306249192251196744265747423553491949349698352031277450632623"
      "957831801698480186947885184385861560789112949495459501737958331952853208"
      "805511125406987471585238630507156932909632952274430435576689664895044524"
      "452316173185640309871112172238311362229893423380308135336276614282806444"
      "486645238749303589072962904915604407723907138105158593079608667017242712"
      "188399879790879227492190169972088809377665727333001053367881220235421809"
      "751254540594752243525849077116705560136048395864467063244157221553975369"
      "781797784617406495514929086256932197846862248283972241375657056057490261"
      "407972968652414535100474821663704844031998900088952434506585412275886668"
      "811642717147992444292823086346567481391912316282458617866458359124566529"
      "476545682848912883142607690042242190226710556263211111093705442175069416"
      "589604080719840385096245544436298123098787992724428490918884580156166097"
      "919133875499200524063689912560717606058861164671094050775410022569831552"
      "0005593572972571636269561882670428252483600823257530420752963450";
  unsigned long long int survivor = 0;
  unsigned long long int tmp = 0;
  for (size_t i = 0; i < strlen(num); i += 13) {
    for (size_t x = 0; x <= 13; x++) {
      int y = ctoi(num[i + x]);
      tmp *= y;
    }
    if (tmp > survivor) {
      survivor = tmp;
    }
    tmp = 1;
  }
  printf("%d\n", survivor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x3e9,%edx
call   1060 <memcpy@plt>
movq   $0x0,-0x408(%rbp)
movq   $0x0,-0x410(%rbp)
movq   $0x0,-0x418(%rbp)
mov    -0x418(%rbp),%rax
mov    %rax,-0x430(%rbp)
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x430(%rbp),%rax
cmp    %rcx,%rax
jae    126a <main+0x12a>
movq   $0x0,-0x420(%rbp)
cmpq   $0xd,-0x420(%rbp)
0d
ja     1226 <main+0xe6>
mov    -0x418(%rbp),%rax
add    -0x420(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1030 <ctoi@plt>
mov    %eax,-0x424(%rbp)
movslq -0x424(%rbp),%rax
imul   -0x410(%rbp),%rax
ff
mov    %rax,-0x410(%rbp)
mov    -0x420(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x420(%rbp)
jmp    11ca <main+0x8a>
mov    -0x410(%rbp),%rax
cmp    -0x408(%rbp),%rax
jbe    1248 <main+0x108>
mov    -0x410(%rbp),%rax
mov    %rax,-0x408(%rbp)
movq   $0x1,-0x410(%rbp)
mov    -0x418(%rbp),%rax
add    $0xd,%rax
mov    %rax,-0x418(%rbp)
jmp    1192 <main+0x52>
mov    -0x408(%rbp),%rsi
lea    0x1171(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x37,%r12b
mov    $0xfffffffffffffff3,%rbx
xor    %r13d,%r13d
lea    0xec1(%rip),%r14
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rsi,(%rsp)
movsbl %r12b,%edi
call   1030 <ctoi@plt>
movslq %eax,%rbp
imul   %r13,%rbp
movsbl 0xe(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r12
imul   %rbp,%r12
movsbl 0xf(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r13
movsbl 0x10(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r15
imul   %r13,%r15
imul   %r12,%r15
movsbl 0x11(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r12
movsbl 0x12(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%rbp
imul   %r12,%rbp
movsbl 0x13(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r12
imul   %rbp,%r12
imul   %r15,%r12
movsbl 0x14(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r15
movsbl 0x15(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%rbp
imul   %r15,%rbp
movsbl 0x16(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r15
imul   %rbp,%r15
movsbl 0x17(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r13
imul   %r15,%r13
imul   %r12,%r13
movsbl 0x18(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%r15
movsbl 0x19(%rbx,%r14,1),%edi
call   1030 <ctoi@plt>
movslq %eax,%rbp
imul   %r15,%rbp
movzbl 0x1a(%rbx,%r14,1),%r12d
movsbl %r12b,%edi
call   1030 <ctoi@plt>
movslq %eax,%rsi
imul   %rbp,%rsi
imul   %r13,%rsi
mov    (%rsp),%rax
cmp    %rax,%rsi
cmovbe %rax,%rsi
add    $0xd,%rbx
mov    $0x1,%r13d
cmp    $0x3db,%rbx
jb     1150 <main+0x30>
lea    0x116e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.num = [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 i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [1001 x i8]* %6 to i8*
store i64 0, i64* %7
store i64 0, i64* %8
store i64 0, i64* %9
br label %13
13: ; preds = %43, %2
%14 = load i64, i64* %9
%15 = getelementptr inbounds [1001 x i8], [1001 x i8]* %6, i64 0, i64 0
%16 = call i64 @strlen(i8* %15)
%17 = icmp ult i64 %14, %16
br i1 %17, label %18, label %46
18: ; preds = %13
store i64 0, i64* %10
br label %19
19: ; preds = %33, %18
%20 = load i64, i64* %10
%21 = icmp ule i64 %20, 13
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i64, i64* %9
%24 = load i64, i64* %10
%25 = add i64 %23, %24
%26 = getelementptr inbounds [1001 x i8], [1001 x i8]* %6, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @ctoi(i8 signext %27)
store i32 %28, i32* %11
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = load i64, i64* %8
%32 = mul i64 %31, %30
store i64 %32, i64* %8
br label %33
33: ; preds = %22
%34 = load i64, i64* %10
%35 = add i64 %34, 1
store i64 %35, i64* %10
br label %19
36: ; preds = %19
%37 = load i64, i64* %8
%38 = load i64, i64* %7
%39 = icmp ugt i64 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i64, i64* %8
store i64 %41, i64* %7
br label %42
42: ; preds = %40, %36
store i64 1, i64* %8
br label %43
43: ; preds = %42
%44 = load i64, i64* %9
%45 = add i64 %44, 13
store i64 %45, i64* %9
br label %13
46: ; preds = %13
%47 = load i64, i64* %7
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %47)
ret i32 0
}

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