#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, int, int);
int sumOfTwoPrimes(int x) {
  int i;
  for (i = 2; i <= x; i++) {
    if (isPrime(i) && isPrime(x - i)) {
      printf("Yes, %d can be expressed as sum of %d and %d\n", x, i, x - i);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<sumOfTwoPrimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119c <sumOfTwoPrimes+0x7c>
mov    -0xc(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1189 <sumOfTwoPrimes+0x69>
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1189 <sumOfTwoPrimes+0x69>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <sumOfTwoPrimes+0x83>
jmp    118e <sumOfTwoPrimes+0x6e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <sumOfTwoPrimes+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfTwoPrimes>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     1197 <sumOfTwoPrimes+0x77>
mov    %edi,%r15d
mov    %edi,%r12d
neg    %r12d
lea    -0x2(%r15),%ebp
mov    $0x2,%ebx
jmp    1166 <sumOfTwoPrimes+0x46>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
add    $0xffffffff,%ebp
mov    %ecx,%ebx
cmp    $0x1,%eax
je     1197 <sumOfTwoPrimes+0x77>
mov    %ebx,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1150 <sumOfTwoPrimes+0x30>
mov    %ebp,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     1150 <sumOfTwoPrimes+0x30>
lea    0xe7b(%rip),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Yes, %d can be expressed as sum of %d and %d\0A\00"
define i32 @sumOfTwoPrimes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %30
9: ; preds = %5
%10 = load i32, i32* %4
%11 = call i64 @isPrime(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sub nsw i32 %14, %15
%17 = call i64 @isPrime(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %24)
store i32 1, i32* %2
br label %31
26: ; preds = %13, %9
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %5
30: ; preds = %5
store i32 0, i32* %2
br label %31
31: ; preds = %30, %19
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@.str = [46 x i8] c"Yes, %d can be expressed as sum of %d and %d\0A\00"
define i32 @sumOfTwoPrimes(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %16, label %3
3: ; preds = %1, %13
%4 = phi i32 [ %14, %13 ], [ 2, %1 ]
%5 = tail call i64 @isPrime(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = sub nsw i32 %0, %4
%9 = tail call i64 @isPrime(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4, i32 %8)
br label %16
13: ; preds = %3, %7
%14 = add nuw i32 %4, 1
%15 = icmp eq i32 %4, %0
br i1 %15, label %16, label %3
16: ; preds = %13, %1, %11
%17 = phi i32 [ 1, %11 ], [ 0, %1 ], [ 0, %13 ]
ret i32 %17
}