#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 isprime(int);
int /*<<< orphan*/ printf(char *, int, int);
void twinprime(int max) {
  int i;
  for (i = 2; i <= (max - 2); i++) {
    if (isprime(i) == 1) {
      if (isprime(i + 2) == 1) {
        printf("{%d,%d} ", i, i + 2);
      }
    }
  }
}


x86 assembly (clang, -O0):
<twinprime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     1195 <twinprime+0x75>
mov    -0x8(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x1,%eax
jne    1182 <twinprime+0x62>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1040 <isprime@plt>
cmp    $0x1,%eax
jne    117d <twinprime+0x5d>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x2,%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <twinprime+0x62>
jmp    1187 <twinprime+0x67>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <twinprime+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twinprime>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jge    1137 <twinprime+0x17>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%r15d
neg    %r15d
mov    $0x4,%ebx
lea    0xeb7(%rip),%r14
jmp    1163 <twinprime+0x43>
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     112c <twinprime+0xc>
lea    -0x2(%rbx),%ebp
mov    %ebp,%edi
call   1040 <isprime@plt>
cmp    $0x1,%eax
jne    1150 <twinprime+0x30>
mov    %ebx,%edi
call   1040 <isprime@plt>
cmp    $0x1,%eax
jne    1150 <twinprime+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
jmp    1150 <twinprime+0x30>

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

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