#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__ isThereASum(int *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int array[10] = {1, 3, 5, 7, 8, 10, 11, 13, 20, 22};
  if (isThereASum(array, 28)) {
    printf("There are two elements that added sum 28\n");
  }
  if (isThereASum(array, 3)) {
    printf("There are two elements that added sum 3\n");
  }
  if (isThereASum(array, 42)) {
    printf("There are two elements that added sum 42\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1c,%esi
call   1030 <isThereASum@plt>
cmp    $0x0,%rax
je     1178 <main+0x48>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1030 <isThereASum@plt>
cmp    $0x0,%rax
je     119c <main+0x6c>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x2a,%esi
call   1030 <isThereASum@plt>
cmp    $0x0,%rax
je     11c0 <main+0x90>
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x1c,%esi
call   1040 <isThereASum@plt>
test   %rax,%rax
je     1165 <main+0x45>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x3,%esi
call   1040 <isThereASum@plt>
test   %rax,%rax
je     1183 <main+0x63>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x2a,%esi
call   1040 <isThereASum@plt>
test   %rax,%rax
je     11a1 <main+0x81>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.array = [10 x i32] [i32 1, i32 3, i32 5, i32 7, i32 8, i32 10, i32 11, i32 13, i32 20, i32 22]
@.str = [42 x i8] c"There are two elements that added sum 28\0A\00"
@.str.1 = [41 x i8] c"There are two elements that added sum 3\0A\00"
@.str.2 = [42 x i8] c"There are two elements that added sum 42\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i64 @isThereASum(i32* %4, i32 28)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = call i64 @isThereASum(i32* %10, i32 3)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%17 = call i64 @isThereASum(i32* %16, i32 42)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@__const.main.array = [10 x i32] [i32 1, i32 3, i32 5, i32 7, i32 8, i32 10, i32 11, i32 13, i32 20, i32 22]
@str = [41 x i8] c"There are two elements that added sum 42\00"
@str.3 = [40 x i8] c"There are two elements that added sum 3\00"
@str.4 = [41 x i8] c"There are two elements that added sum 28\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i64 @isThereASum(i32* %3, i32 28)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.4, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i64 @isThereASum(i32* %3, i32 3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = call i64 @isThereASum(i32* %3, i32 42)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
ret i32 0
}