#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 /*<<< orphan*/ printf(char *, int);
int main() {
  long long int in = 600851475143;
  int max;
  int i = 2;
  while (in != 1) {
    if (!(in % i))
      max = i;
    while (!(in % i)) {
      in /= i;
    }
    i++;
  }
  printf(" answer: %d", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x10(%rbp)
movl   $0x2,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
je     11a8 <main+0x98>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    115c <main+0x4c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x51>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1184 <main+0x74>
jmp    119a <main+0x8a>
movslq -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    1161 <main+0x51>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x8be589eac7,%rcx
mov    $0x2,%edi
jmp    113a <main+0x2a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
cmp    $0x1,%rcx
je     11b4 <main+0xa4>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1150 <main+0x40>
mov    %rcx,%rax
cqto
idiv   %rdi
jmp    1156 <main+0x46>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
cmove  %edi,%esi
jne    1130 <main+0x20>
jmp    116d <main+0x5d>
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
jne    1130 <main+0x20>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1190 <main+0x80>
mov    %rcx,%rax
cqto
idiv   %rdi
mov    %rax,%rcx
jmp    1198 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
mov    %eax,%ecx
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
jne    1160 <main+0x50>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
je     116d <main+0x5d>
jmp    1130 <main+0x20>
push   %rax
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c" answer: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i64 600851475143, i64* %2
store i32 2, i32* %4
br label %5
5: ; preds = %29, %0
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 1
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = load i64, i64* %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = srem i64 %9, %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = load i32, i32* %4
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %8
br label %17
17: ; preds = %24, %16
%18 = load i64, i64* %2
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = srem i64 %18, %20
%22 = icmp ne i64 %21, 0
%23 = xor i1 %22, true
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = load i64, i64* %2
%28 = sdiv i64 %27, %26
store i64 %28, i64* %2
br label %17
29: ; preds = %17
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
%33 = load i32, i32* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c" answer: %d\00"
define i32 @main() {
br label %1
1: ; preds = %0, %14
%2 = phi i64 [ 2, %0 ], [ %16, %14 ]
%3 = phi i32 [ undef, %0 ], [ %8, %14 ]
%4 = phi i64 [ 600851475143, %0 ], [ %15, %14 ]
%5 = srem i64 %4, %2
%6 = icmp eq i64 %5, 0
%7 = trunc i64 %2 to i32
%8 = select i1 %6, i32 %7, i32 %3
br i1 %6, label %9, label %14
9: ; preds = %1, %9
%10 = phi i64 [ %11, %9 ], [ %4, %1 ]
%11 = sdiv i64 %10, %2
%12 = srem i64 %11, %2
%13 = icmp eq i64 %12, 0
br i1 %13, label %9, label %14
14: ; preds = %9, %1
%15 = phi i64 [ %4, %1 ], [ %11, %9 ]
%16 = add nuw i64 %2, 1
%17 = icmp eq i64 %15, 1
br i1 %17, label %18, label %1
18: ; preds = %14
%19 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}