#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 NUM = 600851475143;
  int prime = 3;
  for (long long int i = prime; i <= NUM; i += 2) {
    while (NUM % i == 0) {
      prime = i;
      NUM = NUM / i;
    }
  }
  printf("%d", prime);
  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   $0x3,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1193 <main+0x83>
jmp    114f <main+0x3f>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    117d <main+0x6d>
mov    -0x20(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rax,-0x10(%rbp)
jmp    114f <main+0x3f>
jmp    1182 <main+0x72>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    113c <main+0x2c>
mov    -0x14(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x8be589eac7,%rcx
mov    $0x3,%esi
mov    $0x3,%edi
jmp    113f <main+0x2f>
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%esi
add    $0x2,%rdi
cmp    %rcx,%rdi
jg     11c4 <main+0xb4>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1160 <main+0x50>
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
jne    1132 <main+0x22>
jmp    117d <main+0x6d>
nopw   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
jne    1132 <main+0x22>
jmp    117d <main+0x6d>
nopl   (%rax)
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
jne    1130 <main+0x20>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     11a0 <main+0x90>
mov    %rcx,%rax
cqto
idiv   %rdi
mov    %rax,%rcx
jmp    11a8 <main+0x98>
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    1170 <main+0x60>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
test   %rdx,%rdx
je     117d <main+0x6d>
jmp    1130 <main+0x20>
push   %rax
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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