#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 n = 600851475143;
  long long int h = 0;
  long long int c = 2;
  while (n != 1) {
    if ((n % c == 0) && (c > h)) {
      h = c;
      n /= c;
    }
    ++c;
  }
  printf("%lld\n", h);
}


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   $0x0,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
cmpq   $0x1,-0x10(%rbp)
je     1194 <main+0x84>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    1183 <main+0x73>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1183 <main+0x73>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113d <main+0x2d>
mov    -0x18(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x8be589eac7,%rcx
mov    $0x2,%edi
xor    %esi,%esi
jmp    115a <main+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,%rax
cqto
idiv   %rdi
test   %rdx,%rdx
sete   %r8b
cmp    %rsi,%rdi
setg   %dl
test   %dl,%r8b
cmovne %rax,%rcx
cmovne %rdi,%rsi
add    $0x1,%rdi
cmp    $0x1,%rcx
je     116e <main+0x5e>
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
jne    1130 <main+0x20>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
jmp    1138 <main+0x28>
push   %rax
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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