#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 = 0;
  int ii = 3;
  do {
    if (isPrime(ii)) {
      printf("(%d, %d)\n", ii, ii + 2);
      i++;
    }
    ii++;
  } while (i < 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     116d <main+0x4d>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
add    $0x2,%edx
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
mov    $0x5,%ebx
lea    0xeca(%rip),%r14
jmp    1149 <main+0x29>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0xa,%r15d
jge    116a <main+0x4a>
lea    -0x2(%rbx),%ebp
mov    %ebp,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     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
store i32 0, i32* %1
store i32 0, i32* %2
store i32 3, i32* %3
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %3
%6 = call i64 @isPrime(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 2
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %15
15: ; preds = %8, %4
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 10
br i1 %20, label %4, label %21
21: ; preds = %18
ret i32 0
}

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