#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 is_prime(int);
int /*<<< orphan*/ printf(char *, int, ...);
int scanf(char *, int *);
int /*<<< orphan*/ sieve();
int main() {
  int n, k;
  sieve();
  while (scanf("%d", &n) == 1) {
    if (n == 0)
      break;
    int flag = 0;
    for (k = 2; k <= n / 2; k++) {
      if (is_prime(k) == 1 && is_prime(n - k) == 1) {
        flag = 1;
        break;
      } else
        flag = 0;
    }
    if (flag == 1)
      printf("%d:\n%d+%d\n", n, k, n - k);
    else
      printf("%d:\nNO WAY!\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <sieve@plt>
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1234 <main+0xf4>
cmpl   $0x0,-0x8(%rbp)
jne    117e <main+0x3e>
jmp    1234 <main+0xf4>
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%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     11f5 <main+0xb5>
mov    -0xc(%rbp),%edi
call   1050 <is_prime@plt>
cmp    $0x1,%eax
jne    11db <main+0x9b>
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1050 <is_prime@plt>
cmp    $0x1,%eax
jne    11db <main+0x9b>
movl   $0x1,-0x10(%rbp)
jmp    11f5 <main+0xb5>
movl   $0x0,-0x10(%rbp)
jmp    11e7 <main+0xa7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118c <main+0x4c>
cmpl   $0x1,-0x10(%rbp)
jne    121e <main+0xde>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xef>
mov    -0x8(%rbp),%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1156 <main+0x16>
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
xor    %eax,%eax
call   1040 <sieve@plt>
lea    0xea7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    122b <main+0xeb>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     122b <main+0xeb>
lea    0xe8f(%rip),%r14
lea    0xe7a(%rip),%r15
lea    0x4(%rsp),%r13
lea    0xe71(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x4,%esi
jge    11d0 <main+0x90>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    122b <main+0xeb>
mov    0x4(%rsp),%esi
test   %esi,%esi
jne    11a0 <main+0x60>
jmp    122b <main+0xeb>
nopl   0x0(%rax)
mov    $0x2,%ebx
mov    $0xfffffffe,%ebp
jmp    11f9 <main+0xb9>
nopl   0x0(%rax)
lea    0x1(%rbx),%eax
mov    0x4(%rsp),%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
sar    %ecx
add    $0xffffffff,%ebp
cmp    %ecx,%ebx
mov    %eax,%ebx
jge    11a5 <main+0x65>
mov    %ebx,%edi
call   1050 <is_prime@plt>
cmp    $0x1,%eax
jne    11e0 <main+0xa0>
mov    0x4(%rsp),%edi
add    %ebp,%edi
call   1050 <is_prime@plt>
cmp    $0x1,%eax
jne    11e0 <main+0xa0>
mov    0x4(%rsp),%esi
mov    %esi,%ecx
sub    %ebx,%ecx
mov    %r12,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11af <main+0x6f>
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 = [11 x i8] c"%d:\0A%d+%d\0A\00"
@.str.2 = [13 x i8] c"%d:\0ANO WAY!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @sieve()
br label %6
6: ; preds = %48, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %49
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
br label %49
13: ; preds = %9
store i32 0, i32* %4
store i32 2, i32* %3
br label %14
14: ; preds = %32, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 2
%18 = icmp sle i32 %15, %17
br i1 %18, label %19, label %35
19: ; preds = %14
%20 = load i32, i32* %3
%21 = call i32 @is_prime(i32 %20)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = sub nsw i32 %24, %25
%27 = call i32 @is_prime(i32 %26)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %4
br label %35
30: ; preds = %23, %19
store i32 0, i32* %4
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %14
35: ; preds = %29, %14
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = load i32, i32* %3
%43 = sub nsw i32 %41, %42
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %40, i32 %43)
br label %48
45: ; preds = %35
%46 = load i32, i32* %2
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %45, %38
br label %6
49: ; preds = %12, %6
ret i32 0
}

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