#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);
int main() {
  long a, b, c;
  for (a = 600851475143, b = 2, c; b != a;
       !(a % b) ? (a = a / b) | (c = b) | (b = 2) : b++)
    ;
  printf("%d\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x10(%rbp)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1197 <main+0x87>
jmp    1148 <main+0x38>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
cmp    $0x0,%rdx
jne    1186 <main+0x76>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
or     %rcx,%rax
movq   $0x2,-0x18(%rbp)
or     $0x2,%rax
jmp    1192 <main+0x82>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1135 <main+0x25>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

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