#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 */
scalar_t__ is_prime(int *, int);
int /*<<< orphan*/ prime(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int i, n, sum = 0;
  int p[30000 + 1];
  prime(p, 30000);
  scanf("%d", &n);
  for (i = 2; i <= n / 2; i++) {
    if (is_prime(p, i) && is_prime(p, n - i)) {
      sum++;
    }
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d4f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1d4e0(%rbp),%rdi
mov    $0x7530,%esi
call   1060 <prime@plt>
lea    0xe88(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1d4e4(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1d4e4(%rbp),%eax
cmp    %ecx,%eax
jg     11fd <main+0xbd>
lea    -0x1d4e0(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     11ea <main+0xaa>
lea    -0x1d4e0(%rbp),%rdi
mov    -0x18(%rbp),%esi
sub    -0x14(%rbp),%esi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     11ea <main+0xaa>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ef <main+0xaf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <main+0x48>
mov    -0x1c(%rbp),%esi
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1d4f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1d4d8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x7530,%esi
call   1060 <prime@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
xor    %r15d,%r15d
cmpl   $0x4,0xc(%rsp)
jge    1196 <main+0x56>
lea    0xe82(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1d4d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
mov    $0x1,%ebp
mov    $0xfffffffe,%ebx
lea    0x10(%rsp),%r14
jmp    11c4 <main+0x84>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xffffffff,%ebx
cmp    %ecx,%ebp
jge    1177 <main+0x37>
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <is_prime@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    0xc(%rsp),%esi
add    %ebx,%esi
mov    %r14,%rdi
call   1040 <is_prime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
jmp    11b0 <main+0x70>

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

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