#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 */
struct llu_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int, ...);
size_t recurring_length(int, int *);
int main(void) {
  int d;
  size_t max_len = 0;
  size_t len;
  int *in_seq;
  int d_at_max;
  struct llu_list *d_list;
  size_t i;
  in_seq = malloc(10000 * sizeof(int));
  if (in_seq == NULL)
    exit(EXIT_FAILURE);
  for (d = 1; d < 1000; ++d) {
    len = recurring_length(d, in_seq);
    if (max_len < len) {
      max_len = len;
      d_at_max = d;
    } else {
    }
    if (d == 110)
      printf("1/%d => %zu\n", d, len);
  }
  printf("1/%d => %zu\n", d_at_max, max_len);
  printf("ans: %d\n", d_at_max);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x9c40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117e <main+0x3e>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11fa <main+0xba>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <recurring_length@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11c3 <main+0x83>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11c8 <main+0x88>
jmp    11c8 <main+0x88>
cmpl   $0x6e,-0x8(%rbp)
jne    11e7 <main+0xa7>
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <main+0xac>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x45>
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x9c40,%edi
call   1050 <malloc@plt>
test   %rax,%rax
jne    1165 <main+0x25>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %rax,%r14
mov    $0x1,%ebp
lea    0xe8c(%rip),%r12
xor    %ebx,%ebx
jmp    118b <main+0x4b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x3e8,%ebp
je     11b9 <main+0x79>
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <recurring_length@plt>
cmp    %rax,%rbx
cmovb  %ebp,%r15d
cmovb  %rax,%rbx
cmp    $0x6e,%ebp
jne    1180 <main+0x40>
mov    %r12,%rdi
mov    $0x6e,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x40>
lea    0xe40(%rip),%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe39(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.llu_list = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [13 x i8] c"1/%d => %zu\0A\00"
@.str.1 = [9 x i8] c"ans: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
%7 = alloca %struct.llu_list*
%8 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
%9 = call i32* @malloc(i32 40000)
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
store i32 1, i32* %2
br label %16
16: ; preds = %38, %15
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 1000
br i1 %18, label %19, label %41
19: ; preds = %16
%20 = load i32, i32* %2
%21 = load i32*, i32** %5
%22 = call i64 @recurring_length(i32 %20, i32* %21)
store i64 %22, i64* %4
%23 = load i64, i64* %3
%24 = load i64, i64* %4
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %19
%27 = load i64, i64* %4
store i64 %27, i64* %3
%28 = load i32, i32* %2
store i32 %28, i32* %6
br label %30
29: ; preds = %19
br label %30
30: ; preds = %29, %26
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 110
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* %2
%35 = load i64, i64* %4
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %34, i64 %35)
br label %37
37: ; preds = %33, %30
br label %38
38: ; preds = %37
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %16
41: ; preds = %16
%42 = load i32, i32* %6
%43 = load i64, i64* %3
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %42, i64 %43)
%45 = load i32, i32* %6
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* @EXIT_SUCCESS
%48 = call i32 @exit(i32 %47)
unreachable
}

LLVM IR (-O2):
%struct.llu_list = type { i32 }
@EXIT_FAILURE = global i32 0
@.str = [13 x i8] c"1/%d => %zu\0A\00"
@.str.1 = [9 x i8] c"ans: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32* @malloc(i32 40000)
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
6: ; preds = %0, %17
%7 = phi i32 [ %18, %17 ], [ 1, %0 ]
%8 = phi i64 [ %13, %17 ], [ 0, %0 ]
%9 = phi i32 [ %12, %17 ], [ undef, %0 ]
%10 = tail call i64 @recurring_length(i32 %7, i32* %1)
%11 = icmp ult i64 %8, %10
%12 = select i1 %11, i32 %7, i32 %9
%13 = select i1 %11, i64 %10, i64 %8
%14 = icmp eq i32 %7, 110
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 110, i64 %10)
br label %17
17: ; preds = %6, %15
%18 = add nuw nsw i32 %7, 1
%19 = icmp eq i32 %18, 1000
br i1 %19, label %20, label %6
20: ; preds = %17
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12, i64 %13)
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%23 = load i32, i32* @EXIT_SUCCESS
%24 = tail call i32 @exit(i32 %23)
unreachable
}