#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*/ prime(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a, b = 3, i = 0;
  while (i < 10) {
    do {
      a = b;
      b = a + 1;
      while (!prime(b)) {
        b++;
      }
    } while (b - a != 2);
    printf("(%d, %d)\n", a, b);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11ba <main+0x9a>
jmp    114c <main+0x2c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <prime@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1178 <main+0x58>
jmp    1186 <main+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x3b>
jmp    118b <main+0x6b>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x2,%eax
jne    114c <main+0x2c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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