#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__ prime(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i = 1;
  int i_plus;
  int n = 0;
  int n_max = 10;
  for (i; i > 0; i++) {
    i_plus = i + 2;
    if (prime(i) == 0 && prime(i_plus) == 0) {
      printf("(%d, %d)\n", i, i_plus);
      n = n + 1;
      if (n == n_max) {
        break;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11bf <main+0x9f>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <prime@plt>
cmp    $0x0,%rax
jne    11ac <main+0x8c>
mov    -0xc(%rbp),%edi
call   1040 <prime@plt>
cmp    $0x0,%rax
jne    11ac <main+0x8c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11a7 <main+0x87>
jmp    11bf <main+0x9f>
jmp    11ac <main+0x8c>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %r15d,%r15d
lea    0xeca(%rip),%r14
jmp    1143 <main+0x23>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
lea    0x2(%rbx),%ebp
mov    %ebx,%edi
call   1040 <prime@plt>
test   %rax,%rax
jne    1140 <main+0x20>
mov    %ebp,%edi
call   1040 <prime@plt>
test   %rax,%rax
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%r15d
cmp    $0xa,%r15d
jne    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
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %4
store i32 10, i32* %5
%6 = load i32, i32* %2
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 2
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = call i64 @prime(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %31
16: ; preds = %10
%17 = load i32, i32* %3
%18 = call i64 @prime(i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %20
br label %35
30: ; preds = %20
br label %31
31: ; preds = %30, %16, %10
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %7
35: ; preds = %29, %7
ret i32 0
}

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