#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 /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int sqrt(int);
void main() {
  int a, b, c, d;
  scanf("%d", &a);
  for (b = 3; b <= a / 2; b += 2) {
    for (c = 2; c <= sqrt(b); c++)
      if (b % c == 0)
        break;
    if (c > sqrt(b))
      d = a - b;
    else
      break;
    for (c = 2; c <= sqrt(d); c++)
      if (d % c == 0)
        break;
    if (c > sqrt(d))
      printf("%d = %d + %d\n", a, b, d);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     1272 <main+0x142>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11b7 <main+0x87>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11a4 <main+0x74>
jmp    11b7 <main+0x87>
jmp    11a9 <main+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x44>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jle    11e0 <main+0xb0>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11e5 <main+0xb5>
jmp    1272 <main+0x142>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jg     122f <main+0xff>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    121c <main+0xec>
jmp    122f <main+0xff>
jmp    1221 <main+0xf1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ec <main+0xbc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jle    125f <main+0x12f>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xda9(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <main+0x134>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x6,0xc(%rsp)
jge    1161 <main+0x31>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x3,%r15d
lea    0xe95(%rip),%r14
jmp    1186 <main+0x56>
add    $0x2,%r15d
mov    0xc(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cmp    %ecx,%r15d
jg     1154 <main+0x24>
mov    %r15d,%edi
call   1050 <sqrt@plt>
mov    $0x2,%ebp
cmp    $0x2,%eax
jl     11c2 <main+0x92>
mov    $0x2,%ebx
nopl   (%rax)
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
test   %edx,%edx
je     11c0 <main+0x90>
lea    0x1(%rbx),%ebp
mov    %r15d,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebx
mov    %ebp,%ebx
jl     11a0 <main+0x70>
jmp    11c2 <main+0x92>
xchg   %ax,%ax
mov    %ebx,%ebp
mov    %r15d,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebp
jle    1154 <main+0x24>
mov    0xc(%rsp),%r12d
sub    %r15d,%r12d
mov    %r12d,%edi
call   1050 <sqrt@plt>
mov    $0x2,%ebx
cmp    $0x2,%eax
jl     1212 <main+0xe2>
mov    $0x2,%ebp
nopl   (%rax)
mov    %r12d,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1210 <main+0xe0>
lea    0x1(%rbp),%ebx
mov    %r12d,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebp
mov    %ebx,%ebp
jl     11f0 <main+0xc0>
jmp    1212 <main+0xe2>
nopl   (%rax)
mov    %ebp,%ebx
mov    %r12d,%edi
call   1050 <sqrt@plt>
cmp    %eax,%ebx
jle    1170 <main+0x40>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
mov    %r15d,%edx
mov    %r12d,%ecx
call   1030 <printf@plt>
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"%d = %d + %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
store i32 3, i32* %2
br label %6
6: ; preds = %64, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = sdiv i32 %8, 2
%10 = icmp sle i32 %7, %9
br i1 %10, label %11, label %67
11: ; preds = %6
store i32 2, i32* %3
br label %12
12: ; preds = %24, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @sqrt(i32 %14)
%16 = icmp sle i32 %13, %15
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = srem i32 %18, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %27
23: ; preds = %17
br label %24
24: ; preds = %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %12
27: ; preds = %22, %12
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = call i32 @sqrt(i32 %29)
%31 = icmp sgt i32 %28, %30
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = sub nsw i32 %33, %34
store i32 %35, i32* %4
br label %37
36: ; preds = %27
br label %67
37: ; preds = %32
store i32 2, i32* %3
br label %38
38: ; preds = %50, %37
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = call i32 @sqrt(i32 %40)
%42 = icmp sle i32 %39, %41
br i1 %42, label %43, label %53
43: ; preds = %38
%44 = load i32, i32* %4
%45 = load i32, i32* %3
%46 = srem i32 %44, %45
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %43
br label %53
49: ; preds = %43
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %38
53: ; preds = %48, %38
%54 = load i32, i32* %3
%55 = load i32, i32* %4
%56 = call i32 @sqrt(i32 %55)
%57 = icmp sgt i32 %54, %56
br i1 %57, label %58, label %63
58: ; preds = %53
%59 = load i32, i32* %1
%60 = load i32, i32* %2
%61 = load i32, i32* %4
%62 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %59, i32 %60, i32 %61)
br label %63
63: ; preds = %58, %53
br label %64
64: ; preds = %63
%65 = load i32, i32* %2
%66 = add nsw i32 %65, 2
store i32 %66, i32* %2
br label %6
67: ; preds = %36, %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"%d = %d + %d\0A\00"
define void @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 = load i32, i32* %1
%5 = icmp slt i32 %4, 6
br i1 %5, label %47, label %6
6: ; preds = %0, %42
%7 = phi i32 [ %43, %42 ], [ 3, %0 ]
%8 = call i32 @sqrt(i32 %7)
%9 = icmp slt i32 %8, 2
br i1 %9, label %18, label %10
10: ; preds = %6, %14
%11 = phi i32 [ %15, %14 ], [ 2, %6 ]
%12 = urem i32 %7, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = add nuw nsw i32 %11, 1
%16 = call i32 @sqrt(i32 %7)
%17 = icmp slt i32 %11, %16
br i1 %17, label %10, label %18
18: ; preds = %14, %10, %6
%19 = phi i32 [ 2, %6 ], [ %11, %10 ], [ %15, %14 ]
%20 = call i32 @sqrt(i32 %7)
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %47
22: ; preds = %18
%23 = load i32, i32* %1
%24 = sub nsw i32 %23, %7
%25 = call i32 @sqrt(i32 %24)
%26 = icmp slt i32 %25, 2
br i1 %26, label %35, label %27
27: ; preds = %22, %31
%28 = phi i32 [ %32, %31 ], [ 2, %22 ]
%29 = srem i32 %24, %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = add nuw nsw i32 %28, 1
%33 = call i32 @sqrt(i32 %24)
%34 = icmp slt i32 %28, %33
br i1 %34, label %27, label %35
35: ; preds = %31, %27, %22
%36 = phi i32 [ 2, %22 ], [ %28, %27 ], [ %32, %31 ]
%37 = call i32 @sqrt(i32 %24)
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i32, i32* %1
%41 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %7, i32 %24)
br label %42
42: ; preds = %35, %39
%43 = add nuw nsw i32 %7, 2
%44 = load i32, i32* %1
%45 = sdiv i32 %44, 2
%46 = icmp sgt i32 %43, %45
br i1 %46, label %47, label %6
47: ; preds = %42, %18, %0
ret void
}