#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  for (int i = 3; i < 10000; i += 2) {
    int divisor = i / 2;
    int prime = 1;
    while (divisor > 1) {
      if (i % divisor == 0) {
        prime = 0;
        divisor = 0;
      } else
        divisor--;
    }
    if (prime == 1) {
      int j = i + 2;
      int divisor = j / 2;
      int prime = 1;
      while (divisor > 1) {
        if (j % divisor == 0) {
          prime = 0;
          divisor = 0;
        } else
          divisor--;
      }
      if (prime == 1)
        printf("%d and %d are a prime pair!\n", i, j);
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    122a <main+0x10a>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1193 <main+0x73>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1185 <main+0x65>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    118e <main+0x6e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x38>
cmpl   $0x1,-0x10(%rbp)
jne    1217 <main+0xf7>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x1,-0x18(%rbp)
jle    11f6 <main+0xd6>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    11e8 <main+0xc8>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11f1 <main+0xd1>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x9b>
cmpl   $0x1,-0x1c(%rbp)
jne    1212 <main+0xf2>
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdf3(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
jmp    121c <main+0xfc>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x3,%ebx
lea    0xed0(%rip),%r14
jmp    114d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x2(%rbx),%ebp
cmp    $0x270e,%ebx
mov    %ebp,%ebx
jae    11b8 <main+0x98>
cmp    $0x4,%ebx
jb     117a <main+0x5a>
mov    %ebx,%ecx
shr    %ecx
mov    $0x1,%esi
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
cltd
idiv   %ecx
add    $0xffffffff,%ecx
test   %edx,%edx
cmove  %edx,%ecx
cmove  %edx,%esi
cmp    $0x1,%ecx
ja     1160 <main+0x40>
cmp    $0x1,%esi
jne    1140 <main+0x20>
lea    0x2(%rbx),%ebp
mov    %ebp,%ecx
shr    %ecx
mov    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%eax
cltd
idiv   %ecx
add    $0xffffffff,%ecx
test   %edx,%edx
cmove  %edx,%ecx
cmove  %edx,%esi
cmp    $0x1,%ecx
ja     1190 <main+0x70>
cmp    $0x1,%esi
jne    1143 <main+0x23>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
jmp    1143 <main+0x23>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"%d and %d are a prime pair!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
br label %8
8: ; preds = %57, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10000
br i1 %10, label %11, label %60
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 2
store i32 %13, i32* %3
store i32 1, i32* %4
br label %14
14: ; preds = %26, %11
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = srem i32 %18, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %4
store i32 0, i32* %3
br label %26
23: ; preds = %17
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %22
br label %14
27: ; preds = %14
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %56
30: ; preds = %27
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 2
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = sdiv i32 %33, 2
store i32 %34, i32* %6
store i32 1, i32* %7
br label %35
35: ; preds = %47, %30
%36 = load i32, i32* %6
%37 = icmp sgt i32 %36, 1
br i1 %37, label %38, label %48
38: ; preds = %35
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = srem i32 %39, %40
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 0, i32* %7
store i32 0, i32* %6
br label %47
44: ; preds = %38
%45 = load i32, i32* %6
%46 = add nsw i32 %45, -1
store i32 %46, i32* %6
br label %47
47: ; preds = %44, %43
br label %35
48: ; preds = %35
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %55
51: ; preds = %48
%52 = load i32, i32* %2
%53 = load i32, i32* %5
%54 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %52, i32 %53)
br label %55
55: ; preds = %51, %48
br label %56
56: ; preds = %55, %27
br label %57
57: ; preds = %56
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 2
store i32 %59, i32* %2
br label %8
60: ; preds = %8
%61 = load i32, i32* @EXIT_SUCCESS
%62 = call i32 @exit(i32 %61)
unreachable
}

LLVM IR (-O2):
@.str = [29 x i8] c"%d and %d are a prime pair!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
br label %4
1: ; preds = %38
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
4: ; preds = %0, %38
%5 = phi i32 [ 3, %0 ], [ %39, %38 ]
%6 = icmp ugt i32 %5, 3
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = lshr i32 %5, 1
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ %16, %9 ], [ 1, %7 ]
%11 = phi i32 [ %15, %9 ], [ %8, %7 ]
%12 = srem i32 %5, %11
%13 = icmp eq i32 %12, 0
%14 = add nsw i32 %11, -1
%15 = select i1 %13, i32 0, i32 %14
%16 = select i1 %13, i32 0, i32 %10
%17 = icmp ugt i32 %15, 1
br i1 %17, label %9, label %18
18: ; preds = %9
%19 = icmp eq i32 %16, 1
br i1 %19, label %22, label %20
20: ; preds = %18
%21 = add nuw nsw i32 %5, 2
br label %38
22: ; preds = %4, %18
%23 = add nuw nsw i32 %5, 2
%24 = lshr i32 %23, 1
br label %25
25: ; preds = %22, %25
%26 = phi i32 [ %32, %25 ], [ 1, %22 ]
%27 = phi i32 [ %31, %25 ], [ %24, %22 ]
%28 = srem i32 %23, %27
%29 = icmp eq i32 %28, 0
%30 = add nsw i32 %27, -1
%31 = select i1 %29, i32 0, i32 %30
%32 = select i1 %29, i32 0, i32 %26
%33 = icmp ugt i32 %31, 1
br i1 %33, label %25, label %34
34: ; preds = %25
%35 = icmp eq i32 %32, 1
br i1 %35, label %36, label %38
36: ; preds = %34
%37 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %23)
br label %38
38: ; preds = %20, %34, %36
%39 = phi i32 [ %21, %20 ], [ %23, %34 ], [ %23, %36 ]
%40 = icmp ult i32 %5, 9998
br i1 %40, label %4, label %1
}