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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11f1 <main+0xe1>
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11a7 <main+0x97>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    1194 <main+0x84>
movl   $0x1,-0x10(%rbp)
jmp    11a7 <main+0x97>
jmp    1199 <main+0x89>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <main+0x4a>
cmpl   $0x0,-0x10(%rbp)
jne    11e3 <main+0xd3>
mov    -0xc(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jne    11dd <main+0xcd>
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %esi,%esi
mov    $0x2,%r15d
lea    0xeda(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    113a <main+0x2a>
nopl   0x0(%rax)
mov    %ebp,%esi
add    $0x1,%ebp
cmp    $0xa,%ebx
jge    1192 <main+0x82>
mov    %ebp,%ecx
shr    %ecx
cmp    $0x3,%ecx
cmovb  %r15d,%ecx
cmp    $0x4,%ebp
jb     117c <main+0x6c>
neg    %ecx
mov    $0x2,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
xor    %edx,%edx
div    %edi
test   %edx,%edx
je     1132 <main+0x22>
lea    (%rcx,%rdi,1),%eax
add    $0x1,%eax
mov    %edi,%edx
add    $0x1,%edx
mov    %edx,%edi
cmp    $0x1,%eax
jne    1160 <main+0x50>
lea    0x2(%rsi),%eax
cmp    %eax,%ebp
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1130 <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
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %42, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %45
10: ; preds = %7
store i32 0, i32* %4
store i32 2, i32* %5
br label %11
11: ; preds = %23, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %3
%14 = sdiv i32 %13, 2
%15 = icmp sle i32 %12, %14
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = srem i32 %17, %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 1, i32* %4
br label %26
22: ; preds = %16
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %11
26: ; preds = %21, %11
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %42
29: ; preds = %26
%30 = load i32, i32* %3
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 2
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %40
34: ; preds = %29
%35 = load i32, i32* %6
%36 = load i32, i32* %3
%37 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36)
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %40
40: ; preds = %34, %29
%41 = load i32, i32* %3
store i32 %41, i32* %6
br label %42
42: ; preds = %40, %26
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %7
45: ; preds = %7
ret i32 0
}

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