#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__ isprime(int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main() {
  int n, count, i;
  while (scanf("%d", &n) != -1) {
    if (!n)
      break;
    count = 0;
    for (i = 2; i <= n / 2; i++)
      if (isprime(i) && isprime(n - i))
        count++;
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
je     11ea <main+0xba>
cmpl   $0x0,-0x8(%rbp)
jne    1167 <main+0x37>
jmp    11ea <main+0xba>
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     11d6 <main+0xa6>
mov    -0x10(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%rax
je     11c3 <main+0x93>
mov    -0x8(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%rax
je     11c3 <main+0x93>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <main+0x98>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <main+0x45>
mov    -0xc(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
je     11f8 <main+0xc8>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f8 <main+0xc8>
lea    0xe9b(%rip),%r14
lea    0xe91(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %r13d,%r13d
cmp    $0x4,%eax
jge    11b0 <main+0x80>
mov    %r14,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
je     11f8 <main+0xc8>
mov    0x4(%rsp),%eax
test   %eax,%eax
jne    1180 <main+0x50>
jmp    11f8 <main+0xc8>
nopl   (%rax)
xor    %r13d,%r13d
mov    $0x1,%ebx
mov    $0xfffffffe,%ebp
jmp    11d4 <main+0xa4>
nop
mov    0x4(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xffffffff,%ebp
cmp    %ecx,%ebx
jge    1188 <main+0x58>
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <isprime@plt>
test   %rax,%rax
je     11c0 <main+0x90>
mov    0x4(%rsp),%edi
add    %ebp,%edi
call   1040 <isprime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r13d
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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