#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ is_prime(long);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, long *);
int main(int argc, char *argv[]) {
  long int n, max = 100000;
  if (scanf("%ld", &n) != 1) {
    return EXIT_FAILURE;
  }
  int count = 0;
  for (long int i = 2; i <= n - 2 && i < max - 2; i++) {
    if (is_prime(i) && is_prime(i + 2)) {
      count++;
    }
  }
  printf("%d", count);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x186a0,-0x20(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1178 <main+0x48>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    122a <main+0xfa>
movl   $0x0,-0x24(%rbp)
movq   $0x2,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rdx
sub    $0x2,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x31(%rbp)
jg     11b6 <main+0x86>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x2,%rcx
cmp    %rcx,%rax
setl   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11c6 <main+0x96>
jmp    120f <main+0xdf>
mov    -0x30(%rbp),%rdi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     11f9 <main+0xc9>
mov    -0x30(%rbp),%rdi
add    $0x2,%rdi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     11f9 <main+0xc9>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fe <main+0xce>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1187 <main+0x57>
mov    -0x24(%rbp),%esi
lea    0xdeb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11b1 <main+0x81>
xor    %ebp,%ebp
cmpq   $0x4,(%rsp)
jl     119a <main+0x6a>
xor    %ebp,%ebp
mov    $0x2,%ebx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <is_prime@plt>
test   %rax,%rax
je     117d <main+0x4d>
lea    0x2(%rbx),%rdi
call   1040 <is_prime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
cmp    $0x1869c,%rbx
ja     119a <main+0x6a>
lea    0x1(%rbx),%rax
mov    (%rsp),%rcx
add    $0xfffffffffffffffe,%rcx
cmp    %rcx,%rbx
mov    %rax,%rbx
jl     1160 <main+0x30>
lea    0xe63(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    0x2e29(%rip),%rax
jmp    11b8 <main+0x88>
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 100000, i64* %7
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %6)
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* @EXIT_FAILURE
store i32 %13, i32* %3
br label %47
14: ; preds = %2
store i32 0, i32* %8
store i64 2, i64* %9
br label %15
15: ; preds = %40, %14
%16 = load i64, i64* %9
%17 = load i64, i64* %6
%18 = sub nsw i64 %17, 2
%19 = icmp sle i64 %16, %18
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i64, i64* %9
%22 = load i64, i64* %7
%23 = sub nsw i64 %22, 2
%24 = icmp slt i64 %21, %23
br label %25
25: ; preds = %20, %15
%26 = phi i1 [ false, %15 ], [ %24, %20 ]
br i1 %26, label %27, label %43
27: ; preds = %25
%28 = load i64, i64* %9
%29 = call i64 @is_prime(i64 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i64, i64* %9
%33 = add nsw i64 %32, 2
%34 = call i64 @is_prime(i64 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %39
39: ; preds = %36, %31, %27
br label %40
40: ; preds = %39
%41 = load i64, i64* %9
%42 = add nsw i64 %41, 1
store i64 %42, i64* %9
br label %15
43: ; preds = %25
%44 = load i32, i32* %8
%45 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = load i32, i32* @EXIT_SUCCESS
store i32 %46, i32* %3
br label %47
47: ; preds = %43, %12
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %32
7: ; preds = %2
%8 = load i64, i64* %3
%9 = icmp sgt i64 %8, 3
br i1 %9, label %13, label %10
10: ; preds = %24, %7
%11 = phi i32 [ 0, %7 ], [ %25, %24 ]
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %32
13: ; preds = %7, %24
%14 = phi i64 [ %26, %24 ], [ 2, %7 ]
%15 = phi i32 [ %25, %24 ], [ 0, %7 ]
%16 = call i64 @is_prime(i64 %14)
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %13
%19 = add nuw nsw i64 %14, 2
%20 = call i64 @is_prime(i64 %19)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i32
%23 = add nsw i32 %15, %22
br label %24
24: ; preds = %18, %13
%25 = phi i32 [ %15, %13 ], [ %23, %18 ]
%26 = add nuw nsw i64 %14, 1
%27 = load i64, i64* %3
%28 = add nsw i64 %27, -2
%29 = icmp slt i64 %14, %28
%30 = icmp ult i64 %14, 99997
%31 = and i1 %30, %29
br i1 %31, label %13, label %10
32: ; preds = %2, %10
%33 = phi i32* [ @EXIT_SUCCESS, %10 ], [ @EXIT_FAILURE, %2 ]
%34 = load i32, i32* %33
ret i32 %34
}