#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 isPrime(int);
int /*<<< orphan*/ printf(char *, int, int);
void printPrimePairs(int max) {
  int i;
  for (i = 2; i < max - 2; i++) {
    if (isPrime(i) == 1 && isPrime(i + 2) == 1)
      printf("%6d %6d is a prime pair\n", i, i + 2);
  }
}


x86 assembly (clang, -O0):
<printPrimePairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1190 <printPrimePairs+0x70>
mov    -0x8(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x1,%eax
jne    117d <printPrimePairs+0x5d>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1040 <isPrime@plt>
cmp    $0x1,%eax
jne    117d <printPrimePairs+0x5d>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x2,%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <printPrimePairs+0x62>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <printPrimePairs+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPrimePairs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x5,%edi
jl     1171 <printPrimePairs+0x51>
mov    %edi,%r15d
mov    $0x4,%ebx
lea    0xec5(%rip),%r14
jmp    1148 <printPrimePairs+0x28>
nopl   (%rax)
add    $0x1,%ebx
cmp    %ebx,%r15d
je     1171 <printPrimePairs+0x51>
lea    -0x2(%rbx),%ebp
mov    %ebp,%edi
call   1040 <isPrime@plt>
cmp    $0x1,%eax
jne    1140 <printPrimePairs+0x20>
mov    %ebx,%edi
call   1040 <isPrime@plt>
cmp    $0x1,%eax
jne    1140 <printPrimePairs+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
jmp    1140 <printPrimePairs+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"%6d %6d is a prime pair\0A\00"
define void @printPrimePairs(i32 %0) {
%2 = add i32 %0, -2
%3 = icmp sgt i32 %0, 4
br i1 %3, label %4, label %17
4: ; preds = %1, %14
%5 = phi i32 [ %15, %14 ], [ 2, %1 ]
%6 = tail call i32 @isPrime(i32 %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = add nuw nsw i32 %5, 2
%10 = tail call i32 @isPrime(i32 %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %9)
br label %14
14: ; preds = %4, %8, %12
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, %2
br i1 %16, label %17, label %4
17: ; preds = %14, %1
ret void
}