#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(void) {
  long number, count, prime;
  number = 600851475143;
  for (prime = 3; prime < number; prime = prime + 2) {
    for (count = 2; count < prime; count++) {
      if (prime % count == 0)
        break;
    }
    if (count == prime) {
      if (number % prime == 0)
        number = number / prime;
    }
  }
  printf("%li", number);
  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)
movq   $0x3,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11d3 <main+0xc3>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1188 <main+0x78>
mov    -0x20(%rbp),%rax
cqto
idivq  -0x18(%rbp)
cmp    $0x0,%rdx
jne    1172 <main+0x62>
jmp    1188 <main+0x78>
jmp    1177 <main+0x67>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114b <main+0x3b>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    11bd <main+0xad>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    11b8 <main+0xa8>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x20(%rbp)
mov    %rax,-0x10(%rbp)
jmp    11bd <main+0xad>
jmp    11c2 <main+0xb2>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    1135 <main+0x25>
mov    -0x10(%rbp),%rsi
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x8be589eac7,%r8
mov    $0x3,%ecx
mov    $0xffffffffffffffff,%rdi
jmp    114c <main+0x3c>
nopl   0x0(%rax,%rax,1)
mov    %r8,%rax
cqto
idiv   %rcx
test   %rdx,%rdx
cmove  %rax,%r8
add    $0x2,%rcx
add    $0xfffffffffffffffe,%rdi
cmp    %r8,%rcx
jge    11c5 <main+0xb5>
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1180 <main+0x70>
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
test   %rdx,%rdx
jne    118b <main+0x7b>
jmp    11a0 <main+0x90>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
je     11a0 <main+0x90>
lea    (%rdi,%rsi,1),%rax
add    $0x1,%rax
add    $0x1,%rsi
cmp    $0x2,%rax
jne    1160 <main+0x50>
jmp    11a9 <main+0x99>
nop
add    %rdi,%rsi
cmp    $0x2,%rsi
jne    113f <main+0x2f>
mov    %r8,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1130 <main+0x20>
mov    %r8d,%eax
xor    %edx,%edx
div    %ecx
jmp    1138 <main+0x28>
push   %rax
lea    0xe33(%rip),%rdi
mov    %r8,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%li\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 3, i64* %4
br label %5
5: ; preds = %39, %0
%6 = load i64, i64* %4
%7 = load i64, i64* %2
%8 = icmp slt i64 %6, %7
br i1 %8, label %9, label %42
9: ; preds = %5
store i64 2, i64* %3
br label %10
10: ; preds = %21, %9
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = srem i64 %15, %16
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %24
20: ; preds = %14
br label %21
21: ; preds = %20
%22 = load i64, i64* %3
%23 = add nsw i64 %22, 1
store i64 %23, i64* %3
br label %10
24: ; preds = %19, %10
%25 = load i64, i64* %3
%26 = load i64, i64* %4
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = load i64, i64* %2
%30 = load i64, i64* %4
%31 = srem i64 %29, %30
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i64, i64* %2
%35 = load i64, i64* %4
%36 = sdiv i64 %34, %35
store i64 %36, i64* %2
br label %37
37: ; preds = %33, %28
br label %38
38: ; preds = %37, %24
br label %39
39: ; preds = %38
%40 = load i64, i64* %4
%41 = add nsw i64 %40, 2
store i64 %41, i64* %4
br label %5
42: ; preds = %5
%43 = load i64, i64* %2
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %43)
ret i32 0
}

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