#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 check_primo(int);
int /*<<< orphan*/ printf(char *, int, int);
check_goldbach(int pos_g) {
  int i, j, ret_chk_prim;
  for (i = 2; i <= pos_g; i++) {
    ret_chk_prim = check_primo(i);
    if (ret_chk_prim == 1) {
      if (i + i == pos_g) {
        printf("\n%d + %d\n", i, i);
        return 1;
      } else {
        for (j = 2; j <= pos_g; j++) {
          ret_chk_prim = check_primo(j);
          if (ret_chk_prim == 1) {
            if (i + j == pos_g) {
              printf("\n%d + %d\n", i, j);
              return 1;
            }
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_goldbach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120a <check_goldbach+0xea>
mov    -0xc(%rbp),%edi
call   1030 <check_primo@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11f7 <check_goldbach+0xd7>
mov    -0xc(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1180 <check_goldbach+0x60>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1211 <check_goldbach+0xf1>
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ed <check_goldbach+0xcd>
mov    -0x10(%rbp),%edi
call   1030 <check_primo@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11da <check_goldbach+0xba>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d5 <check_goldbach+0xb5>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe3c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1211 <check_goldbach+0xf1>
jmp    11da <check_goldbach+0xba>
jmp    11df <check_goldbach+0xbf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1187 <check_goldbach+0x67>
jmp    11f2 <check_goldbach+0xd2>
jmp    11f7 <check_goldbach+0xd7>
jmp    11fc <check_goldbach+0xdc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <check_goldbach+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_goldbach>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     11ce <check_goldbach+0xae>
mov    %edi,%r15d
mov    $0x1,%r13d
sub    %edi,%r13d
mov    $0x4,%ebp
sub    %edi,%ebp
mov    $0x2,%r12d
jmp    1170 <check_goldbach+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%r12),%eax
add    $0x1,%ebp
cmp    %r15d,%r12d
mov    %eax,%r12d
je     11ce <check_goldbach+0xae>
mov    %r12d,%edi
call   1030 <check_primo@plt>
cmp    $0x1,%eax
jne    1160 <check_goldbach+0x40>
lea    (%r12,%r12,1),%eax
cmp    %r15d,%eax
je     11e0 <check_goldbach+0xc0>
mov    $0x2,%ebx
jmp    11a3 <check_goldbach+0x83>
nopl   (%rax)
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
je     1160 <check_goldbach+0x40>
mov    %ebx,%edi
call   1030 <check_primo@plt>
cmp    $0x1,%eax
jne    1190 <check_goldbach+0x70>
lea    (%rbx,%rbp,1),%eax
cmp    $0x2,%eax
jne    1190 <check_goldbach+0x70>
lea    0xe42(%rip),%rdi
mov    %r12d,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12d,%ebx
jmp    11b7 <check_goldbach+0x97>

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

LLVM IR (-O2):
@.str = [10 x i8] c"\0A%d + %d\0A\00"
define i32 @check_goldbach(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %26, label %3
3: ; preds = %1, %20
%4 = phi i32 [ %21, %20 ], [ 2, %1 ]
%5 = tail call i32 @check_primo(i32 %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %20
7: ; preds = %3
%8 = shl nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %23, label %10
10: ; preds = %7, %17
%11 = phi i32 [ %18, %17 ], [ 2, %7 ]
%12 = tail call i32 @check_primo(i32 %11)
%13 = icmp eq i32 %12, 1
%14 = add nuw nsw i32 %11, %4
%15 = icmp eq i32 %14, %0
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %23, label %17
17: ; preds = %10
%18 = add nuw i32 %11, 1
%19 = icmp eq i32 %11, %0
br i1 %19, label %20, label %10
20: ; preds = %17, %3
%21 = add nuw i32 %4, 1
%22 = icmp eq i32 %4, %0
br i1 %22, label %26, label %3
23: ; preds = %7, %10
%24 = phi i32 [ %11, %10 ], [ %4, %7 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %24)
br label %26
26: ; preds = %20, %23, %1
%27 = phi i32 [ 0, %1 ], [ 1, %23 ], [ 0, %20 ]
ret i32 %27
}