#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main() {
  char number[1000], c;
  FILE *fp = fopen("c8.input", "r");
  int i, k, prod, grt;
  if (fp == NULL) {
    fprintf(stderr, "Couldn't open c8.input\n");
    return 1;
  }
  while ((c = fgetc(fp)) != EOF)
    if (c >= '0' && c <= '9') {
      number[i] = c - '0';
      i++;
    }
  grt = 0;
  for (i = 0; i < 1000; i++) {
    prod = 1;
    for (k = 0; k < 5; k++)
      prod *= number[i + k];
    if (prod > grt)
      grt = prod;
  }
  printf("The solution is: %i\n", grt);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x400(%rbp)
cmpq   $0x0,-0x400(%rbp)
jne    119b <main+0x5b>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12da <main+0x19a>
jmp    11a0 <main+0x60>
mov    -0x400(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x3f1(%rbp)
movsbl %al,%eax
mov    0x2e2c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1215 <main+0xd5>
movsbl -0x3f1(%rbp),%eax
cmp    $0x30,%eax
jl     1210 <main+0xd0>
movsbl -0x3f1(%rbp),%eax
cmp    $0x39,%eax
jg     1210 <main+0xd0>
movsbl -0x3f1(%rbp),%eax
sub    $0x30,%eax
mov    %al,%cl
movslq -0x404(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11a0 <main+0x60>
movl   $0x0,-0x410(%rbp)
movl   $0x0,-0x404(%rbp)
cmpl   $0x3e8,-0x404(%rbp)
jge    12c8 <main+0x188>
movl   $0x1,-0x40c(%rbp)
movl   $0x0,-0x408(%rbp)
cmpl   $0x5,-0x408(%rbp)
jge    1291 <main+0x151>
mov    -0x404(%rbp),%eax
add    -0x408(%rbp),%eax
cltq
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
imul   -0x40c(%rbp),%eax
mov    %eax,-0x40c(%rbp)
mov    -0x408(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x408(%rbp)
jmp    124d <main+0x10d>
mov    -0x40c(%rbp),%eax
cmp    -0x410(%rbp),%eax
jle    12af <main+0x16f>
mov    -0x40c(%rbp),%eax
mov    %eax,-0x410(%rbp)
jmp    12b4 <main+0x174>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    1229 <main+0xe9>
mov    -0x410(%rbp),%esi
lea    0xd4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
lea    0xebd(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     119e <main+0x5e>
mov    %rax,%r15
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e72(%rip),%r14
cmp    (%r14),%al
je     11c0 <main+0x80>
jmp    118d <main+0x4d>
nopl   (%rax)
mov    %r15,%rdi
call   1040 <fgetc@plt>
cmp    (%r14),%al
je     11bd <main+0x7d>
add    $0xd0,%al
cmp    $0x9,%al
ja     1180 <main+0x40>
movslq %ebx,%rbx
mov    %al,(%rsp,%rbx,1)
add    $0x1,%ebx
jmp    1180 <main+0x40>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
jmp    13d1 <main+0x291>
mov    (%rsp),%cl
movzbl %cl,%eax
movd   %eax,%xmm10
pslld  $0x18,%xmm10
pxor   %xmm8,%xmm8
mov    $0x8,%eax
movdqa 0xe1f(%rip),%xmm9
pxor   %xmm1,%xmm1
pxor   %xmm3,%xmm3
nopl   0x0(%rax)
movd   -0x7(%rsp,%rax,1),%xmm7
movd   -0x3(%rsp,%rax,1),%xmm0
movdqa %xmm9,%xmm2
pandn  %xmm10,%xmm2
punpcklbw %xmm7,%xmm5
movdqa %xmm9,%xmm6
pandn  %xmm7,%xmm6
pand   %xmm9,%xmm7
por    %xmm2,%xmm7
punpcklbw %xmm7,%xmm2
pshuflw $0x93,%xmm2,%xmm2
psraw  $0x8,%xmm2
psraw  $0x8,%xmm5
pmullw %xmm2,%xmm5
punpcklwd %xmm5,%xmm5
punpcklbw %xmm0,%xmm7
movdqa %xmm0,%xmm10
pand   %xmm9,%xmm0
por    %xmm6,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x93,%xmm0,%xmm0
psraw  $0x8,%xmm0
psraw  $0x8,%xmm7
pmullw %xmm0,%xmm7
punpcklwd %xmm7,%xmm7
movd   -0x6(%rsp,%rax,1),%xmm0
punpcklbw %xmm0,%xmm0
movd   -0x2(%rsp,%rax,1),%xmm2
punpcklbw %xmm2,%xmm2
psraw  $0x8,%xmm0
punpcklwd %xmm8,%xmm0
pmaddwd %xmm5,%xmm0
psraw  $0x8,%xmm2
punpcklwd %xmm8,%xmm2
pmaddwd %xmm7,%xmm2
movd   -0x5(%rsp,%rax,1),%xmm5
punpcklbw %xmm5,%xmm5
punpcklwd %xmm5,%xmm5
movd   -0x1(%rsp,%rax,1),%xmm6
punpcklbw %xmm6,%xmm6
punpcklwd %xmm6,%xmm6
psrad  $0x18,%xmm5
psrad  $0x18,%xmm6
pshufd $0xf5,%xmm0,%xmm7
pshufd $0xf5,%xmm5,%xmm4
pmuludq %xmm7,%xmm4
pmuludq %xmm0,%xmm5
pshufd $0xf5,%xmm2,%xmm0
pshufd $0xf5,%xmm6,%xmm7
pmuludq %xmm0,%xmm7
pmuludq %xmm2,%xmm6
movd   -0x4(%rsp,%rax,1),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movq   (%rsp,%rax,1),%xmm2
punpcklbw %xmm2,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm0
psrad  $0x18,%xmm2
pmuludq %xmm0,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pshufd $0xf5,%xmm0,%xmm0
pmuludq %xmm4,%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm5
pmuludq %xmm2,%xmm6
pshufd $0xe8,%xmm6,%xmm0
pshufd $0xf5,%xmm2,%xmm2
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm0
movdqa %xmm5,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm5
pandn  %xmm1,%xmm2
movdqa %xmm2,%xmm1
por    %xmm5,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm3,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm3,%xmm2
movdqa %xmm2,%xmm3
por    %xmm0,%xmm3
add    $0x8,%rax
cmp    $0x3f0,%rax
jne    11f0 <main+0xb0>
movdqa %xmm1,%xmm0
pcmpgtd %xmm3,%xmm0
pand   %xmm0,%xmm1
pandn  %xmm3,%xmm0
por    %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
pshufd $0x55,%xmm2,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
movd   %xmm1,%esi
lea    0xc69(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"c8.input\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Couldn't open c8.input\0A\00"
@EOF = global i8 0
@.str.3 = [21 x i8] c"The solution is: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i8
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %4
%10 = load i32*, i32** %4
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %76
15: ; preds = %0
br label %16
16: ; preds = %41, %15
%17 = load i32*, i32** %4
%18 = call signext i8 @fgetc(i32* %17)
store i8 %18, i8* %3
%19 = sext i8 %18 to i32
%20 = load i8, i8* @EOF
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %19, %21
br i1 %22, label %23, label %42
23: ; preds = %16
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sge i32 %25, 48
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 57
br i1 %30, label %31, label %41
31: ; preds = %27
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = trunc i32 %34 to i8
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %37
store i8 %35, i8* %38
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %41
41: ; preds = %31, %27, %23
br label %16
42: ; preds = %16
store i32 0, i32* %8
store i32 0, i32* %5
br label %43
43: ; preds = %70, %42
%44 = load i32, i32* %5
%45 = icmp slt i32 %44, 1000
br i1 %45, label %46, label %73
46: ; preds = %43
store i32 1, i32* %7
store i32 0, i32* %6
br label %47
47: ; preds = %60, %46
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 5
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load i32, i32* %5
%52 = load i32, i32* %6
%53 = add nsw i32 %51, %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = load i32, i32* %7
%59 = mul nsw i32 %58, %57
store i32 %59, i32* %7
br label %60
60: ; preds = %50
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %47
63: ; preds = %47
%64 = load i32, i32* %7
%65 = load i32, i32* %8
%66 = icmp sgt i32 %64, %65
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = load i32, i32* %7
store i32 %68, i32* %8
br label %69
69: ; preds = %67, %63
br label %70
70: ; preds = %69
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %43
73: ; preds = %43
%74 = load i32, i32* %8
%75 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %73, %12
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [9 x i8] c"c8.input\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Couldn't open c8.input\0A\00"
@EOF = global i8 0
@.str.3 = [21 x i8] c"The solution is: %i\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = tail call signext i8 @fgetc(i32* %3)
%7 = load i8, i8* @EOF
%8 = icmp eq i8 %6, %7
br i1 %8, label %14, label %81
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %95
12: ; preds = %90
%13 = load i8, i8* %2
br label %14
14: ; preds = %5, %12
%15 = phi i8 [ %13, %12 ], [ undef, %5 ]
%16 = insertelement <4 x i8> poison, i8 %15, i64 3
br label %17
17: ; preds = %17, %14
%18 = phi i64 [ 0, %14 ], [ %74, %17 ]
%19 = phi <4 x i8> [ %16, %14 ], [ %28, %17 ]
%20 = phi <4 x i32> [ zeroinitializer, %14 ], [ %72, %17 ]
%21 = phi <4 x i32> [ zeroinitializer, %14 ], [ %73, %17 ]
%22 = or i64 %18, 1
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %22
%24 = bitcast i8* %23 to <4 x i8>*
%25 = load <4 x i8>, <4 x i8>* %24
%26 = getelementptr inbounds i8, i8* %23, i64 4
%27 = bitcast i8* %26 to <4 x i8>*
%28 = load <4 x i8>, <4 x i8>* %27
%29 = shufflevector <4 x i8> %19, <4 x i8> %25, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%30 = shufflevector <4 x i8> %25, <4 x i8> %28, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%31 = sext <4 x i8> %29 to <4 x i32>
%32 = sext <4 x i8> %30 to <4 x i32>
%33 = sext <4 x i8> %25 to <4 x i32>
%34 = sext <4 x i8> %28 to <4 x i32>
%35 = mul nsw <4 x i32> %31, %33
%36 = mul nsw <4 x i32> %32, %34
%37 = or i64 %18, 2
%38 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %37
%39 = bitcast i8* %38 to <4 x i8>*
%40 = load <4 x i8>, <4 x i8>* %39
%41 = getelementptr inbounds i8, i8* %38, i64 4
%42 = bitcast i8* %41 to <4 x i8>*
%43 = load <4 x i8>, <4 x i8>* %42
%44 = sext <4 x i8> %40 to <4 x i32>
%45 = sext <4 x i8> %43 to <4 x i32>
%46 = mul nsw <4 x i32> %35, %44
%47 = mul nsw <4 x i32> %36, %45
%48 = or i64 %18, 3
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %48
%50 = bitcast i8* %49 to <4 x i8>*
%51 = load <4 x i8>, <4 x i8>* %50
%52 = getelementptr inbounds i8, i8* %49, i64 4
%53 = bitcast i8* %52 to <4 x i8>*
%54 = load <4 x i8>, <4 x i8>* %53
%55 = sext <4 x i8> %51 to <4 x i32>
%56 = sext <4 x i8> %54 to <4 x i32>
%57 = mul nsw <4 x i32> %46, %55
%58 = mul nsw <4 x i32> %47, %56
%59 = or i64 %18, 4
%60 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %59
%61 = bitcast i8* %60 to <4 x i8>*
%62 = load <4 x i8>, <4 x i8>* %61
%63 = getelementptr inbounds i8, i8* %60, i64 4
%64 = bitcast i8* %63 to <4 x i8>*
%65 = load <4 x i8>, <4 x i8>* %64
%66 = sext <4 x i8> %62 to <4 x i32>
%67 = sext <4 x i8> %65 to <4 x i32>
%68 = mul nsw <4 x i32> %57, %66
%69 = mul nsw <4 x i32> %58, %67
%70 = icmp sgt <4 x i32> %68, %20
%71 = icmp sgt <4 x i32> %69, %21
%72 = select <4 x i1> %70, <4 x i32> %68, <4 x i32> %20
%73 = select <4 x i1> %71, <4 x i32> %69, <4 x i32> %21
%74 = add nuw i64 %18, 8
%75 = icmp eq i64 %74, 1000
br i1 %75, label %76, label %17
76: ; preds = %17
%77 = icmp sgt <4 x i32> %72, %73
%78 = select <4 x i1> %77, <4 x i32> %72, <4 x i32> %73
%79 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %78)
%80 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %79)
br label %95
81: ; preds = %5, %90
%82 = phi i8 [ %92, %90 ], [ %6, %5 ]
%83 = phi i32 [ %91, %90 ], [ undef, %5 ]
%84 = add i8 %82, -48
%85 = icmp ult i8 %84, 10
br i1 %85, label %86, label %90
86: ; preds = %81
%87 = sext i32 %83 to i64
%88 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %87
store i8 %84, i8* %88
%89 = add nsw i32 %83, 1
br label %90
90: ; preds = %86, %81
%91 = phi i32 [ %89, %86 ], [ %83, %81 ]
%92 = tail call signext i8 @fgetc(i32* %3)
%93 = load i8, i8* @EOF
%94 = icmp eq i8 %92, %93
br i1 %94, label %12, label %81
95: ; preds = %76, %9
%96 = phi i32 [ 1, %9 ], [ 0, %76 ]
ret i32 %96
}