#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 findGoldbach1(int, int *);
int /*<<< orphan*/ generatePrimesUpTo(int, int *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int listPrimes[60];
  for (int i = 0; i < 20; i++)
    listPrimes[i] = 0;
  generatePrimesUpTo(250, listPrimes);
  int goldbach1[100];
  int goldbach2[100];
  for (int i = 0; i < 100; i++) {
    goldbach2[i] = 0;
    goldbach2[i] = 0;
  }
  for (int i = 20; i < 25; i += 1) {
    goldbach1[i] = findGoldbach1(4 + (i * 2), listPrimes);
    goldbach2[i] = ((4 + (2 * i)) - goldbach1[i]);
    int k = (4 + 2 * i);
    printf("%d is the sum of the two primes %d and %d '\n'", k, goldbach1[i],
           goldbach2[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x104(%rbp)
cmpl   $0x14,-0x104(%rbp)
jge    117f <main+0x4f>
movslq -0x104(%rbp),%rax
movl   $0x0,-0x100(%rbp,%rax,4)
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    114c <main+0x1c>
lea    -0x100(%rbp),%rsi
mov    $0xfa,%edi
call   1030 <generatePrimesUpTo@plt>
movl   $0x0,-0x434(%rbp)
cmpl   $0x64,-0x434(%rbp)
jge    11df <main+0xaf>
movslq -0x434(%rbp),%rax
movl   $0x0,-0x430(%rbp,%rax,4)
movslq -0x434(%rbp),%rax
movl   $0x0,-0x430(%rbp,%rax,4)
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    119a <main+0x6a>
movl   $0x14,-0x438(%rbp)
cmpl   $0x19,-0x438(%rbp)
jge    129a <main+0x16a>
mov    -0x438(%rbp),%edi
shl    $0x1,%edi
add    $0x4,%edi
lea    -0x100(%rbp),%rsi
call   1040 <findGoldbach1@plt>
mov    %eax,%ecx
movslq -0x438(%rbp),%rax
mov    %ecx,-0x2a0(%rbp,%rax,4)
mov    -0x438(%rbp),%ecx
shl    $0x1,%ecx
add    $0x4,%ecx
movslq -0x438(%rbp),%rax
sub    -0x2a0(%rbp,%rax,4),%ecx
movslq -0x438(%rbp),%rax
mov    %ecx,-0x430(%rbp,%rax,4)
mov    -0x438(%rbp),%eax
shl    $0x1,%eax
add    $0x4,%eax
mov    %eax,-0x43c(%rbp)
mov    -0x43c(%rbp),%esi
movslq -0x438(%rbp),%rax
mov    -0x2a0(%rbp,%rax,4),%edx
movslq -0x438(%rbp),%rax
mov    -0x430(%rbp,%rax,4),%ecx
lea    0xd7f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x438(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x438(%rbp)
jmp    11e9 <main+0xb9>
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    $0xfa,%edi
mov    %rbx,%rsi
call   1030 <generatePrimesUpTo@plt>
mov    $0x2c,%ebp
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1040 <findGoldbach1@plt>
sub    %eax,%ebp
lea    0xe7f(%rip),%r14
mov    %r14,%rdi
mov    $0x2c,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1050 <printf@plt>
mov    $0x2e,%ebp
mov    $0x2e,%edi
mov    %rbx,%rsi
call   1040 <findGoldbach1@plt>
sub    %eax,%ebp
mov    %r14,%rdi
mov    $0x2e,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1050 <printf@plt>
mov    $0x30,%ebp
mov    $0x30,%edi
mov    %rbx,%rsi
call   1040 <findGoldbach1@plt>
sub    %eax,%ebp
mov    %r14,%rdi
mov    $0x30,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1050 <printf@plt>
mov    $0x32,%ebp
mov    $0x32,%edi
mov    %rbx,%rsi
call   1040 <findGoldbach1@plt>
sub    %eax,%ebp
mov    %r14,%rdi
mov    $0x32,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1050 <printf@plt>
mov    $0x34,%ebp
mov    $0x34,%edi
mov    %rbx,%rsi
call   1040 <findGoldbach1@plt>
sub    %eax,%ebp
mov    %r14,%rdi
mov    $0x34,%esi
mov    %eax,%edx
mov    %ebp,%ecx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"%d is the sum of the two primes %d and %d '\0A'\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [60 x i32]
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca [100 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 20
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %14
store i32 0, i32* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %9
19: ; preds = %9
%20 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 0
%21 = call i32 @generatePrimesUpTo(i32 250, i32* %20)
store i32 0, i32* %6
br label %22
22: ; preds = %32, %19
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 100
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %27
store i32 0, i32* %28
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %30
store i32 0, i32* %31
br label %32
32: ; preds = %25
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %22
35: ; preds = %22
store i32 20, i32* %7
br label %36
36: ; preds = %72, %35
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 25
br i1 %38, label %39, label %75
39: ; preds = %36
%40 = load i32, i32* %7
%41 = mul nsw i32 %40, 2
%42 = add nsw i32 4, %41
%43 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 0
%44 = call i32 @findGoldbach1(i32 %42, i32* %43)
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %46
store i32 %44, i32* %47
%48 = load i32, i32* %7
%49 = mul nsw i32 2, %48
%50 = add nsw i32 4, %49
%51 = load i32, i32* %7
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = sub nsw i32 %50, %54
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %57
store i32 %55, i32* %58
%59 = load i32, i32* %7
%60 = mul nsw i32 2, %59
%61 = add nsw i32 4, %60
store i32 %61, i32* %8
%62 = load i32, i32* %8
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %62, i32 %66, i32 %70)
br label %72
72: ; preds = %39
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %36
75: ; preds = %36
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@.str = [46 x i8] c"%d is the sum of the two primes %d and %d '\0A'\00"
define i32 @main() {
%1 = alloca [60 x i32]
%2 = bitcast [60 x i32]* %1 to i8*
%3 = getelementptr inbounds [60 x i32], [60 x i32]* %1, i64 0, i64 0
%4 = call i32 @generatePrimesUpTo(i32 250, i32* %3)
%5 = call i32 @findGoldbach1(i32 44, i32* %3)
%6 = sub nsw i32 44, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 44, i32 %5, i32 %6)
%8 = call i32 @findGoldbach1(i32 46, i32* %3)
%9 = sub nsw i32 46, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 46, i32 %8, i32 %9)
%11 = call i32 @findGoldbach1(i32 48, i32* %3)
%12 = sub nsw i32 48, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 48, i32 %11, i32 %12)
%14 = call i32 @findGoldbach1(i32 50, i32* %3)
%15 = sub nsw i32 50, %14
%16 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 50, i32 %14, i32 %15)
%17 = call i32 @findGoldbach1(i32 52, i32* %3)
%18 = sub nsw i32 52, %17
%19 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 52, i32 %17, i32 %18)
ret i32 0
}