#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 prime(long);
int /*<<< orphan*/ printf(char *, long, long, long);
int scanf(char *, long *);
int main() {
  long n, i;
  while (scanf("%ld", &n) == 1) {
    if (n == 0)
      break;
    for (i = 2; i < n; i++) {
      if (prime(i) == 1 && prime(n - i) == 1) {
        goto end;
      }
    }
  end:
    printf("%ld = %ld + %ld\n", n, i, n - i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11e7 <main+0xb7>
cmpq   $0x0,-0x10(%rbp)
jne    1168 <main+0x38>
jmp    11e7 <main+0xb7>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11c1 <main+0x91>
mov    -0x18(%rbp),%rdi
call   1050 <prime@plt>
cmp    $0x1,%eax
jne    11ab <main+0x7b>
mov    -0x10(%rbp),%rdi
sub    -0x18(%rbp),%rdi
call   1050 <prime@plt>
cmp    $0x1,%eax
jne    11ab <main+0x7b>
jmp    11c6 <main+0x96>
jmp    11b0 <main+0x80>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1170 <main+0x40>
jmp    11c6 <main+0x96>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
sub    -0x18(%rbp),%rcx
lea    0xe27(%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   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    120f <main+0xdf>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
je     120f <main+0xdf>
lea    0xe98(%rip),%r14
lea    0xe8d(%rip),%r15
lea    0x8(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    $0x2,%r13d
cmp    $0x3,%rsi
jl     11e0 <main+0xb0>
mov    $0x2,%r13d
mov    $0xfffffffffffffffe,%rbx
jmp    11b2 <main+0x82>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
mov    0x8(%rsp),%rsi
add    $0xffffffffffffffff,%rbx
cmp    %rsi,%r13
jge    11e0 <main+0xb0>
mov    %r13,%rdi
call   1050 <prime@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x70>
mov    0x8(%rsp),%rdi
add    %rbx,%rdi
call   1050 <prime@plt>
cmp    $0x1,%eax
jne    11a0 <main+0x70>
mov    0x8(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
mov    %rsi,%rcx
sub    %r13,%rcx
mov    %r14,%rdi
mov    %r13,%rdx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    120f <main+0xdf>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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