#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 */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 2;
  unsigned long long v = 600851475143;
  for (i; i < v; i++) {
    if ((v % i) == 0) {
      if (isPrime(i)) {
        printf("%d\n", i);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11a2 <main+0x82>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    118f <main+0x6f>
mov    -0x8(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     118a <main+0x6a>
mov    -0x8(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    118f <main+0x6f>
jmp    1194 <main+0x74>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2,%ebx
movabs $0x8be589eac7,%r14
lea    0xec5(%rip),%r15
jmp    1144 <main+0x24>
nopl   (%rax)
add    $0x1,%rbx
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
test   %rdx,%rdx
jne    1140 <main+0x20>
mov    %ebx,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1140 <main+0x20>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>

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

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