#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 check_prime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int j, n, c;
  int count = 0;
  scanf("%d", &n);
  for (j = 2; j + 2 <= n; j++) {
    c = check_prime(j);
    if (c == 1) {
      c = check_prime(j + 2);
      if (c == 1) {
        count = count + 1;
      }
    }
  }
  printf("%d", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
cmp    -0xc(%rbp),%eax
jg     11ba <main+0x8a>
mov    -0x8(%rbp),%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11a7 <main+0x77>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11a2 <main+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <main+0x77>
jmp    11ac <main+0x7c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x2d>
mov    -0x14(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %ebp,%ebp
cmpl   $0x4,0x4(%rsp)
jge    1164 <main+0x34>
lea    0xeac(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ebp,%ebp
mov    $0x4,%ebx
jmp    1179 <main+0x49>
nopl   (%rax)
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jg     114d <main+0x1d>
lea    -0x2(%rbx),%edi
call   1030 <check_prime@plt>
cmp    $0x1,%eax
jne    1170 <main+0x40>
mov    %ebx,%edi
call   1030 <check_prime@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%ebp
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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 0, i32* %5
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 2, i32* %2
br label %7
7: ; preds = %28, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 2
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %31
12: ; preds = %7
%13 = load i32, i32* %2
%14 = call i32 @check_prime(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 2
%20 = call i32 @check_prime(i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %26
26: ; preds = %23, %17
br label %27
27: ; preds = %26, %12
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %7
31: ; preds = %7
%32 = load i32, i32* %5
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}

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