#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 argc, char const *argv[]) {
  long long num = 600851475143;
  for (int i = 1; i * i <= num; i++) {
    if (num % i == 0 && isPrime(i)) {
      printf("%d\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
cmp    -0x18(%rbp),%rax
jg     11a9 <main+0x89>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1196 <main+0x76>
mov    -0x1c(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1196 <main+0x76>
mov    -0x1c(%rbp),%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    119b <main+0x7b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%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(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 600851475143, i64* %6
store i32 1, i32* %7
br label %8
8: ; preds = %29, %2
%9 = load i32, i32* %7
%10 = load i32, i32* %7
%11 = mul nsw i32 %9, %10
%12 = sext i32 %11 to i64
%13 = load i64, i64* %6
%14 = icmp sle i64 %12, %13
br i1 %14, label %15, label %32
15: ; preds = %8
%16 = load i64, i64* %6
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = srem i64 %16, %18
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = load i32, i32* %7
%23 = call i64 @isPrime(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %7
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %21, %15
br label %29
29: ; preds = %28
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %8
32: ; preds = %8
ret i32 0
}

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