#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 a, b, i, j, k = 0;
  scanf("%d", &a);
  for (b = 2; b < a; b++) {
    i = check_prime(b);
    if (b + 2 < a) {
      j = check_prime(b + 2);
    }
    if (i == 1 && j == 1) {
      k = k + 1;
    }
  }
  printf("%d", k);
  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,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c1 <main+0x91>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
cmp    -0x8(%rbp),%eax
jge    1191 <main+0x61>
mov    -0xc(%rbp),%edi
add    $0x2,%edi
call   1030 <check_prime@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    11ae <main+0x7e>
cmpl   $0x1,-0x14(%rbp)
jne    11ae <main+0x7e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b3 <main+0x83>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%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    %r15d,%r15d
cmpl   $0x3,0x4(%rsp)
jl     119c <main+0x6c>
mov    $0x2,%ebx
xor    %r15d,%r15d
jmp    117a <main+0x4a>
nopl   0x0(%rax)
xor    $0x1,%ebp
mov    %r14d,%ecx
xor    $0x1,%ecx
xor    %edx,%edx
or     %ebp,%ecx
sete   %dl
add    %edx,%r15d
add    $0x1,%ebx
cmp    %eax,%ebx
jge    119c <main+0x6c>
mov    %ebx,%edi
call   1030 <check_prime@plt>
mov    %eax,%ebp
lea    0x2(%rbx),%edi
mov    0x4(%rsp),%eax
cmp    %eax,%edi
jge    1160 <main+0x30>
call   1030 <check_prime@plt>
mov    %eax,%r14d
mov    0x4(%rsp),%eax
jmp    1160 <main+0x30>
lea    0xe5d(%rip),%rdi
mov    %r15d,%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* %3
br label %8
8: ; preds = %33, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @check_prime(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 2
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %12
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 2
%22 = call i32 @check_prime(i32 %21)
store i32 %22, i32* %5
br label %23
23: ; preds = %19, %12
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %32
32: ; preds = %29, %26, %23
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %8
36: ; preds = %8
%37 = load i32, i32* %6
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
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 sgt i32 %4, 2
br i1 %5, label %6, label %27
6: ; preds = %0, %17
%7 = phi i32 [ %24, %17 ], [ 0, %0 ]
%8 = phi i32 [ %19, %17 ], [ undef, %0 ]
%9 = phi i32 [ %25, %17 ], [ 2, %0 ]
%10 = call i32 @check_prime(i32 %9)
%11 = add nuw nsw i32 %9, 2
%12 = load i32, i32* %1
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = call i32 @check_prime(i32 %11)
%16 = load i32, i32* %1
br label %17
17: ; preds = %14, %6
%18 = phi i32 [ %16, %14 ], [ %12, %6 ]
%19 = phi i32 [ %15, %14 ], [ %8, %6 ]
%20 = icmp eq i32 %10, 1
%21 = icmp eq i32 %19, 1
%22 = select i1 %20, i1 %21, i1 false
%23 = zext i1 %22 to i32
%24 = add nuw nsw i32 %7, %23
%25 = add nuw nsw i32 %9, 1
%26 = icmp slt i32 %25, %18
br i1 %26, label %6, label %27
27: ; preds = %17, %0
%28 = phi i32 [ 0, %0 ], [ %24, %17 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}