#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 n, x, y, i;
  int j = 0;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    x = check_prime(i);
    y = check_prime(i + 2);
    if ((x == 1) && (y == 1) && ((i + 2) <= n)) {
      j++;
    }
  }
  printf("%d", j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c1 <main+0x91>
mov    -0x14(%rbp),%edi
call   1030 <check_prime@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%edi
add    $0x2,%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11ae <main+0x7e>
cmpl   $0x1,-0x10(%rbp)
jne    11ae <main+0x7e>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
cmp    -0x8(%rbp),%eax
jg     11ae <main+0x7e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b3 <main+0x83>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x2d>
mov    -0x18(%rbp),%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %r14d,%r14d
cmpl   $0x2,0x4(%rsp)
jl     119b <main+0x6b>
mov    $0x2,%ebx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <check_prime@plt>
mov    %eax,%ebp
lea    0x2(%rbx),%r15d
mov    %r15d,%edi
call   1030 <check_prime@plt>
xor    $0x1,%ebp
xor    $0x1,%eax
or     %ebp,%eax
sete   %al
mov    0x4(%rsp),%ecx
cmp    %ecx,%r15d
setle  %dl
and    %al,%dl
movzbl %dl,%eax
add    %eax,%r14d
lea    0x1(%rbx),%eax
cmp    %ecx,%ebx
mov    %eax,%ebx
jl     1160 <main+0x30>
lea    0xe5e(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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