#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 *, long long);
int main(void) {
  long long int lpf = 2;
  long long int num = 600851475143;
  while (lpf < num) {
    if (num % lpf == 0) {
      num = num / lpf;
      lpf = 2;
    } else {
      lpf++;
    }
  }
  printf("%llu\n", lpf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x10(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1183 <main+0x73>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    1172 <main+0x62>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,-0x18(%rbp)
movq   $0x2,-0x10(%rbp)
jmp    117e <main+0x6e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1135 <main+0x25>
mov    -0x10(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x2,%edi
movabs $0x8be589eac7,%rcx
mov    $0x2,%esi
jmp    114c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,%rax
cqto
idiv   %rsi
add    $0x1,%rsi
test   %rdx,%rdx
cmove  %rdi,%rsi
cmove  %rax,%rcx
cmp    %rcx,%rsi
jge    1160 <main+0x50>
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
jne    1130 <main+0x20>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
jmp    1138 <main+0x28>
push   %rax
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%llu\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 600851475143, %0 ], [ %9, %1 ]
%3 = phi i64 [ 2, %0 ], [ %8, %1 ]
%4 = srem i64 %2, %3
%5 = sdiv i64 %2, %3
%6 = icmp eq i64 %4, 0
%7 = add nsw i64 %3, 1
%8 = select i1 %6, i64 2, i64 %7
%9 = select i1 %6, i64 %5, i64 %2
%10 = icmp slt i64 %8, %9
br i1 %10, label %1, label %11
11: ; preds = %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %8)
ret i32 0
}