#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__ isNumberPrime(long);
int /*<<< orphan*/ printf(char *, int, long);
int main(void) {
  long currentLargestPrimeDivisor = 0;
  long primeDenominator = 3;
  long numerator = 68571;
  if (0 == 68571 % 2) {
    currentLargestPrimeDivisor = 2;
  } else {
    while (primeDenominator <= 68571) {
      if (0 == (numerator % primeDenominator)) {
        if (isNumberPrime(primeDenominator)) {
          currentLargestPrimeDivisor = primeDenominator;
          printf("Prime denominator = %lu currentLargestPrimeDivisor = %lu\n",
                 primeDenominator, currentLargestPrimeDivisor);
          numerator /= primeDenominator;
          primeDenominator = 3;
          if (1 == numerator) {
            break;
          }
        }
      }
      primeDenominator += 2;
    }
  }
  printf("Largest Prime Divisor of %lu = %lu\n", 68571,
         currentLargestPrimeDivisor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x3,-0x18(%rbp)
movq   $0x10bdb,-0x20(%rbp)
cmpq   $0x10bdb,-0x18(%rbp)
jg     11e3 <main+0xc3>
mov    -0x20(%rbp),%rax
cqto
idivq  -0x18(%rbp)
xor    %eax,%eax
cmp    %rdx,%rax
jne    11d2 <main+0xb2>
mov    -0x18(%rbp),%rdi
call   1040 <isNumberPrime@plt>
cmp    $0x0,%rax
je     11cd <main+0xad>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
movq   $0x3,-0x18(%rbp)
mov    $0x1,%eax
cmp    -0x20(%rbp),%rax
jne    11c8 <main+0xa8>
jmp    11e3 <main+0xc3>
jmp    11cd <main+0xad>
jmp    11d2 <main+0xb2>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1147 <main+0x27>
mov    -0x10(%rbp),%rdx
lea    0xe4c(%rip),%rdi
mov    $0x10bdb,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x3,%ebx
mov    $0x10bdb,%r12d
xor    %r15d,%r15d
lea    0xec2(%rip),%r14
jmp    1155 <main+0x35>
mov    %rbx,%rax
mov    %r12,%r13
lea    0x2(%rax),%rbx
mov    %r13,%r12
cmp    $0x10bda,%rax
jge    11b7 <main+0x97>
mov    %r12,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1180 <main+0x60>
mov    %r12,%rax
cqto
idiv   %rbx
mov    %rax,%r13
test   %rdx,%rdx
jne    1140 <main+0x20>
jmp    118f <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
mov    %eax,%r13d
test   %rdx,%rdx
jne    1140 <main+0x20>
mov    %rbx,%rdi
call   1040 <isNumberPrime@plt>
test   %rax,%rax
je     1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x3,%eax
mov    %rbx,%r15
cmp    $0x1,%r13
jne    1146 <main+0x26>
lea    0xe7c(%rip),%rdi
mov    $0x10bdb,%esi
mov    %r15,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Prime denominator = %lu currentLargestPrimeDivisor = %lu\0A\00"
@.str.1 = [36 x i8] c"Largest Prime Divisor of %lu = %lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store i64 3, i64* %3
store i64 68571, i64* %4
br label %5
5: ; preds = %31, %0
%6 = load i64, i64* %3
%7 = icmp sle i64 %6, 68571
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = srem i64 %9, %10
%12 = icmp eq i64 0, %11
br i1 %12, label %13, label %31
13: ; preds = %8
%14 = load i64, i64* %3
%15 = call i64 @isNumberPrime(i64 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %30
17: ; preds = %13
%18 = load i64, i64* %3
store i64 %18, i64* %2
%19 = load i64, i64* %3
%20 = trunc i64 %19 to i32
%21 = load i64, i64* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %20, i64 %21)
%23 = load i64, i64* %3
%24 = load i64, i64* %4
%25 = sdiv i64 %24, %23
store i64 %25, i64* %4
store i64 3, i64* %3
%26 = load i64, i64* %4
%27 = icmp eq i64 1, %26
br i1 %27, label %28, label %29
28: ; preds = %17
br label %34
29: ; preds = %17
br label %30
30: ; preds = %29, %13
br label %31
31: ; preds = %30, %8
%32 = load i64, i64* %3
%33 = add nsw i64 %32, 2
store i64 %33, i64* %3
br label %5
34: ; preds = %28, %5
%35 = load i64, i64* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 68571, i64 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"Prime denominator = %lu currentLargestPrimeDivisor = %lu\0A\00"
@.str.1 = [36 x i8] c"Largest Prime Divisor of %lu = %lu\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %15
%2 = phi i64 [ 68571, %0 ], [ %18, %15 ]
%3 = phi i64 [ 3, %0 ], [ %19, %15 ]
%4 = phi i64 [ 0, %0 ], [ %16, %15 ]
%5 = srem i64 %2, %3
%6 = sdiv i64 %2, %3
%7 = icmp eq i64 %5, 0
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = tail call i64 @isNumberPrime(i64 %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = trunc i64 %3 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %12, i64 %3)
%14 = icmp eq i64 %6, 1
br i1 %14, label %21, label %15
15: ; preds = %8, %11, %1
%16 = phi i64 [ %3, %11 ], [ %4, %8 ], [ %4, %1 ]
%17 = phi i64 [ 3, %11 ], [ %3, %8 ], [ %3, %1 ]
%18 = phi i64 [ %6, %11 ], [ %2, %8 ], [ %2, %1 ]
%19 = add nsw i64 %17, 2
%20 = icmp slt i64 %17, 68570
br i1 %20, label %1, label %21
21: ; preds = %11, %15
%22 = phi i64 [ %3, %11 ], [ %16, %15 ]
%23 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 68571, i64 %22)
ret i32 0
}