#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 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 = %d + %d\n", n, k, n - k);
    else
      printf("Goldbach's conjecture is wrong.\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    1231 <main+0xf1>
cmpl   $0x0,-0x8(%rbp)
jne    117e <main+0x3e>
jmp    1231 <main+0xf1>
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    122c <main+0xec>
lea    0xdec(%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   1050 <sieve@plt>
lea    0xe97(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    123b <main+0xeb>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     123b <main+0xeb>
lea    0xe82(%rip),%r14
lea    0xe6a(%rip),%r15
lea    0x4(%rsp),%r13
lea    0xe61(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x4,%eax
jge    11e0 <main+0x90>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    123b <main+0xeb>
mov    0x4(%rsp),%eax
test   %eax,%eax
jne    11b0 <main+0x60>
jmp    123b <main+0xeb>
nopw   0x0(%rax,%rax,1)
mov    $0x2,%ebx
mov    $0xfffffffe,%ebp
jmp    1209 <main+0xb9>
nopl   0x0(%rax)
lea    0x1(%rbx),%eax
mov    0x4(%rsp),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
add    $0xffffffff,%ebp
cmp    %edx,%ebx
mov    %eax,%ebx
jge    11b5 <main+0x65>
mov    %ebx,%edi
call   1060 <is_prime@plt>
cmp    $0x1,%eax
jne    11f0 <main+0xa0>
mov    0x4(%rsp),%edi
add    %ebp,%edi
call   1060 <is_prime@plt>
cmp    $0x1,%eax
jne    11f0 <main+0xa0>
mov    0x4(%rsp),%esi
mov    %esi,%ecx
sub    %ebx,%ecx
mov    %r12,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11bd <main+0x6d>
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
%5 = call i32 (...) @sieve()
br label %6
6: ; preds = %47, %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 %48
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 %48
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*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %40, i32 %43)
br label %47
45: ; preds = %35
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %38
br label %6
48: ; preds = %12, %6
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 = 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 %38, label %9
9: ; preds = %0, %32
%10 = phi i32 [ %35, %32 ], [ %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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %13, i32 %28)
br label %32
30: ; preds = %21, %9
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%34 = icmp ne i32 %33, 1
%35 = load i32, i32* %1
%36 = icmp eq i32 %35, 0
%37 = select i1 %34, i1 true, i1 %36
br i1 %37, label %38, label %9
38: ; preds = %32, %0
ret i32 0
}