#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);
int main() {
  int i;
  int foundCombinations = 0;
  int previousPrime = 0;
  for (i = 3; foundCombinations < 10; i += 1) {
    if (IsPrime(i)) {
      if (previousPrime == i - 2) {
        printf("(%d, %d)\n", previousPrime, i);
        foundCombinations++;
      }
      previousPrime = i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11a5 <main+0x85>
mov    -0x8(%rbp),%edi
call   1040 <IsPrime@plt>
cmp    $0x0,%rax
je     1192 <main+0x72>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jne    118c <main+0x6c>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1197 <main+0x77>
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   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x3,%ebx
xor    %ebp,%ebp
lea    0xecb(%rip),%r14
xor    %r15d,%r15d
jmp    114b <main+0x2b>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%ebp
add    $0x1,%ebx
cmp    $0xa,%r15d
jge    1170 <main+0x50>
mov    %ebx,%edi
call   1040 <IsPrime@plt>
test   %rax,%rax
je     1142 <main+0x22>
lea    -0x2(%rbx),%eax
cmp    %ebp,%eax
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%r15d
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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