#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);
void sumOfTwoEle(int A[], int n, int sum) {
  int map[100000] = {0};
  int i, temp;
  for (i = 0; i < n; i++) {
    temp = sum - A[i];
    if (temp >= 0 && map[temp])
      printf("The two elements are: %d and %d\n", A[i], sum - A[i]);
    map[A[i]] = 1;
  }
}


x86 assembly (clang, -O0):
<sumOfTwoEle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x61a90(%rbp),%rdi
xor    %esi,%esi
mov    $0x61a80,%edx
call   1040 <memset@plt>
movl   $0x0,-0x61a94(%rbp)
mov    -0x61a94(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f3 <sumOfTwoEle+0xd3>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x61a94(%rbp),%rdx
sub    (%rcx,%rdx,4),%eax
mov    %eax,-0x61a98(%rbp)
cmpl   $0x0,-0x61a98(%rbp)
jl     11c5 <sumOfTwoEle+0xa5>
movslq -0x61a98(%rbp),%rax
cmpl   $0x0,-0x61a90(%rbp,%rax,4)
je     11c5 <sumOfTwoEle+0xa5>
mov    -0x8(%rbp),%rax
movslq -0x61a94(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x61a94(%rbp),%rcx
sub    (%rax,%rcx,4),%edx
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x61a94(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
movl   $0x1,-0x61a90(%rbp,%rax,4)
mov    -0x61a94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a94(%rbp)
jmp    1152 <sumOfTwoEle+0x32>
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfTwoEle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x61a80,%rsp
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    $0x61a80,%edx
xor    %esi,%esi
call   1040 <memset@plt>
test   %r14d,%r14d
jle    1192 <sumOfTwoEle+0x72>
mov    %r14d,%r12d
xor    %ebp,%ebp
lea    0xea8(%rip),%r14
jmp    1173 <sumOfTwoEle+0x53>
nopw   0x0(%rax,%rax,1)
movslq %esi,%rax
movl   $0x1,(%rsp,%rax,4)
add    $0x1,%rbp
cmp    %rbp,%r12
je     1192 <sumOfTwoEle+0x72>
mov    (%rbx,%rbp,4),%esi
mov    %r15d,%edx
sub    %esi,%edx
js     1160 <sumOfTwoEle+0x40>
mov    %edx,%eax
cmpl   $0x0,(%rsp,%rax,4)
je     1160 <sumOfTwoEle+0x40>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx,%rbp,4),%esi
jmp    1160 <sumOfTwoEle+0x40>
add    $0x61a80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"The two elements are: %d and %d\0A\00"
define void @sumOfTwoEle(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [100000 x i32]
%5 = bitcast [100000 x i32]* %4 to i8*
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %29
7: ; preds = %3
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %23
%10 = phi i64 [ 0, %7 ], [ %27, %23 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = sub nsw i32 %2, %12
%14 = icmp sgt i32 %13, -1
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = zext i32 %13 to i64
%17 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%22 = load i32, i32* %11
br label %23
23: ; preds = %20, %15, %9
%24 = phi i32 [ %22, %20 ], [ %12, %15 ], [ %12, %9 ]
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %25
store i32 1, i32* %26
%27 = add nuw nsw i64 %10, 1
%28 = icmp eq i64 %27, %8
br i1 %28, label %29, label %9
29: ; preds = %23, %3
ret void
}