#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 <= 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
cmp    -0xc(%rbp),%eax
jg     11b7 <main+0x87>
mov    -0x8(%rbp),%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11a4 <main+0x74>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    119f <main+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a4 <main+0x74>
jmp    11a9 <main+0x79>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x2d>
mov    -0x14(%rbp),%esi
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
xor    %r14d,%r14d
cmpl   $0x2,0xc(%rsp)
jge    116d <main+0x3d>
lea    0xea6(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %r14d,%r14d
mov    $0x4,%ebx
jmp    1189 <main+0x59>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    0xc(%rsp),%ebp
jge    1153 <main+0x23>
lea    -0x2(%rbx),%ebp
mov    %ebp,%edi
call   1030 <check_prime@plt>
cmp    $0x1,%eax
jne    1180 <main+0x50>
mov    %ebx,%edi
call   1030 <check_prime@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%r14d
jmp    1180 <main+0x50>

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