#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 scanf(char *, int *);
int main() {
  int n, f, i;
  while (scanf("%d", &n) != -1) {
    if (!n)
      break;
    f = 0;
    for (i = 2; i < n; i++) {
      if (isprime(n - i) && isprime(i)) {
        f = i;
        break;
      }
    }
    if (f)
      printf("%d = %d + %d\n", n, f, n - f);
    else
      printf("Goldbach's conjecture is wrong.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0xffffffff,%eax
je     1202 <main+0xd2>
cmpl   $0x0,-0x8(%rbp)
jne    1167 <main+0x37>
jmp    1202 <main+0xd2>
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0x96>
mov    -0x8(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%rax
je     11b3 <main+0x83>
mov    -0x10(%rbp),%edi
call   1040 <isprime@plt>
cmp    $0x0,%rax
je     11b3 <main+0x83>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11c6 <main+0x96>
jmp    11b8 <main+0x88>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
je     11ef <main+0xbf>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fd <main+0xcd>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0xffffffff,%eax
je     1210 <main+0xd0>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     1210 <main+0xd0>
lea    0xe8b(%rip),%r14
lea    0xe92(%rip),%r15
lea    0xe7a(%rip),%r12
lea    0x4(%rsp),%r13
nopl   0x0(%rax,%rax,1)
cmp    $0x3,%edi
jl     11f0 <main+0xb0>
mov    $0x2,%ebp
mov    $0xfffffffe,%ebx
jmp    11be <main+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    0x4(%rsp),%edi
add    $0xffffffff,%ebx
cmp    %ebp,%edi
jle    11f0 <main+0xb0>
add    %ebx,%edi
call   1050 <isprime@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    %ebp,%edi
call   1050 <isprime@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    0x4(%rsp),%esi
mov    %esi,%ecx
sub    %ebp,%ecx
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f8 <main+0xb8>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
cmp    $0xffffffff,%eax
je     1210 <main+0xd0>
mov    0x4(%rsp),%edi
test   %edi,%edi
jne    1190 <main+0x50>
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 = [14 x i8] c"%d = %d + %d\0A\00"
@.str.2 = [33 x i8] c"Goldbach's conjecture is wrong.\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 = %45, %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 %46
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 %46
12: ; preds = %8
store i32 0, i32* %3
store i32 2, i32* %4
br label %13
13: ; preds = %30, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = sub nsw i32 %18, %19
%21 = call i64 @isprime(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i32, i32* %4
%25 = call i64 @isprime(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32, i32* %4
store i32 %28, i32* %3
br label %33
29: ; preds = %23, %17
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %13
33: ; preds = %27, %13
%34 = load i32, i32* %3
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = sub nsw i32 %39, %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38, i32 %41)
br label %45
43: ; preds = %33
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %36
br label %5
46: ; preds = %11, %5
ret i32 0
}

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