#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 getRecurringDigits(int);
int /*<<< orphan*/ initialize();
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char *argv[]) {
  int i, max = 0, max_i = 0;
  int current;
  double d;
  initialize();
  for (i = 3; i < 1000; i += 2) {
    if (i % 5 == 0)
      continue;
    d = 10.0e0;
    current = getRecurringDigits(i);
    if (current > max) {
      max = current;
      max_i = i;
      printf("|%3d, %3d| ", max_i, max);
    }
  }
  printf("%d produces the maximum cycle of %d\n", max_i, max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <initialize@plt>
movl   $0x3,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11dd <main+0xad>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1188 <main+0x58>
jmp    11cf <main+0x9f>
movsd  0xe70(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <getRecurringDigits@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11ca <main+0x9a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <main+0x9f>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x32>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r12d,%r12d
xor    %eax,%eax
call   1050 <initialize@plt>
mov    $0x3,%ebx
lea    0xeb2(%rip),%r14
xor    %r15d,%r15d
jmp    116d <main+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x2(%rbx),%eax
cmp    $0x3e6,%ebx
mov    %eax,%ebx
jae    11a5 <main+0x75>
movzwl %bx,%eax
imul   $0xcccd,%eax,%ecx
shr    $0x12,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %cx,%ax
je     1160 <main+0x30>
mov    %ebx,%edi
call   1040 <getRecurringDigits@plt>
cmp    %r12d,%eax
jle    1160 <main+0x30>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %ebx,%r15d
mov    %ebp,%r12d
jmp    1160 <main+0x30>
lea    0xe60(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"|%3d, %3d| \00"
@.str.1 = [37 x i8] c"%d produces the maximum cycle of %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%11 = call i32 (...) @initialize()
store i32 3, i32* %6
br label %12
12: ; preds = %33, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 1000
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = load i32, i32* %6
%17 = srem i32 %16, 5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
br label %33
20: ; preds = %15
store double 1.000000e+01, double* %10
%21 = load i32, i32* %6
%22 = call i32 @getRecurringDigits(i32 %21)
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = load i32, i32* %7
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i32, i32* %9
store i32 %27, i32* %7
%28 = load i32, i32* %6
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = load i32, i32* %7
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30)
br label %32
32: ; preds = %26, %20
br label %33
33: ; preds = %32, %19
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 2
store i32 %35, i32* %6
br label %12
36: ; preds = %12
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"|%3d, %3d| \00"
@.str.1 = [37 x i8] c"%d produces the maximum cycle of %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initialize()
br label %4
4: ; preds = %2, %16
%5 = phi i32 [ 3, %2 ], [ %19, %16 ]
%6 = phi i32 [ 0, %2 ], [ %18, %16 ]
%7 = phi i32 [ 0, %2 ], [ %17, %16 ]
%8 = trunc i32 %5 to i16
%9 = urem i16 %8, 5
%10 = icmp eq i16 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = tail call i32 @getRecurringDigits(i32 %5)
%13 = icmp sgt i32 %12, %6
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %12)
br label %16
16: ; preds = %11, %14, %4
%17 = phi i32 [ %7, %4 ], [ %5, %14 ], [ %7, %11 ]
%18 = phi i32 [ %6, %4 ], [ %12, %14 ], [ %6, %11 ]
%19 = add nuw nsw i32 %5, 2
%20 = icmp ult i32 %5, 998
br i1 %20, label %4, label %21
21: ; preds = %16
%22 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18)
ret i32 0
}