#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main() {
  unsigned long long number = 600851475143ull;
  int max_prime = 0;
  int i = 3;
  while (number != 1) {
    if ((number % i)) {
      i += 2;
    } else {
      max_prime = i;
      number = number / i;
    }
  }
  printf("%d\n", max_prime);
  exit(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   $0x0,-0x14(%rbp)
movl   $0x3,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
je     1197 <main+0x77>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     117b <main+0x5b>
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1192 <main+0x72>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
jmp    114b <main+0x2b>
mov    -0x14(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
movabs $0x8be589eac7,%rcx
xor    %esi,%esi
mov    $0x3,%edi
jmp    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,%rax
xor    %edx,%edx
div    %r8
test   %rdx,%rdx
cmove  %rax,%rcx
cmove  %edi,%esi
lea    0x2(%rdi),%eax
cmove  %edi,%eax
mov    %eax,%edi
cmp    $0x1,%rcx
je     1177 <main+0x57>
movslq %edi,%r8
mov    %rcx,%rax
or     %r8,%rax
shr    $0x20,%rax
jne    1140 <main+0x20>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
jmp    1148 <main+0x28>
push   %rax
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\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 0, i32* %3
store i32 3, i32* %4
br label %5
5: ; preds = %23, %0
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 1
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i64, i64* %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = urem i64 %9, %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 2
store i32 %16, i32* %4
br label %23
17: ; preds = %8
%18 = load i32, i32* %4
store i32 %18, i32* %3
%19 = load i64, i64* %2
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = udiv i64 %19, %21
store i64 %22, i64* %2
br label %23
23: ; preds = %17, %14
br label %5
24: ; preds = %5
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 3, %0 ], [ %12, %1 ]
%3 = phi i32 [ 0, %0 ], [ %11, %1 ]
%4 = phi i64 [ 600851475143, %0 ], [ %10, %1 ]
%5 = sext i32 %2 to i64
%6 = urem i64 %4, %5
%7 = udiv i64 %4, %5
%8 = icmp eq i64 %6, 0
%9 = add nsw i32 %2, 2
%10 = select i1 %8, i64 %7, i64 %4
%11 = select i1 %8, i32 %2, i32 %3
%12 = select i1 %8, i32 %2, i32 %9
%13 = icmp eq i64 %10, 1
br i1 %13, label %14, label %1
14: ; preds = %1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%16 = tail call i32 @exit(i32 0)
unreachable
}