#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 *malloc(int);
int *twoSum(int *nums, int numsSize, int target) {
  int hashMap[100000] = {0};
  int *result = malloc(2 * sizeof(int));
  for (int i = 0; i < numsSize; i++) {
    if (hashMap[target - nums[i] + 50000] == 0) {
      hashMap[nums[i] + 50000] = i + 1;
    } else {
      result[0] = hashMap[target - nums[i] + 50000] - 1;
      result[1] = i;
      break;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<twoSum>:
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   1030 <memset@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x61a98(%rbp)
movl   $0x0,-0x61a9c(%rbp)
mov    -0x61a9c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <twoSum+0xfb>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x61a9c(%rbp),%rdx
sub    (%rcx,%rdx,4),%eax
add    $0xc350,%eax
cltq
cmpl   $0x0,-0x61a90(%rbp,%rax,4)
jne    11c2 <twoSum+0xa2>
mov    -0x61a9c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
movslq -0x61a9c(%rbp),%rdx
mov    (%rax,%rdx,4),%eax
add    $0xc350,%eax
cltq
mov    %ecx,-0x61a90(%rbp,%rax,4)
jmp    1202 <twoSum+0xe2>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x61a9c(%rbp),%rdx
sub    (%rcx,%rdx,4),%eax
add    $0xc350,%eax
cltq
mov    -0x61a90(%rbp,%rax,4),%ecx
sub    $0x1,%ecx
mov    -0x61a98(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x61a9c(%rbp),%ecx
mov    -0x61a98(%rbp),%rax
mov    %ecx,0x4(%rax)
jmp    121b <twoSum+0xfb>
jmp    1207 <twoSum+0xe7>
mov    -0x61a9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a9c(%rbp)
jmp    1163 <twoSum+0x43>
mov    -0x61a98(%rbp),%rax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twoSum>:
push   %rbp
push   %r14
push   %rbx
sub    $0x61a80,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0x61a80,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
test   %ebp,%ebp
jle    118c <twoSum+0x6c>
add    $0xc350,%ebx
mov    %ebp,%edx
xor    %ecx,%ecx
nopl   0x0(%rax)
movslq (%r14,%rcx,4),%rsi
mov    %ebx,%edi
sub    %esi,%edi
movslq %edi,%rdi
mov    (%rsp,%rdi,4),%edi
test   %edi,%edi
jne    1184 <twoSum+0x64>
add    $0x1,%rcx
mov    %ecx,0x30d40(%rsp,%rsi,4)
cmp    %rcx,%rdx
jne    1160 <twoSum+0x40>
jmp    118c <twoSum+0x6c>
add    $0xffffffff,%edi
mov    %edi,(%rax)
mov    %ecx,0x4(%rax)
add    $0x61a80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @twoSum(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*
%11 = call i32* @malloc(i32 8)
store i32* %11, i32** %8
store i32 0, i32* %9
br label %12
12: ; preds = %59, %3
%13 = load i32, i32* %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %62
16: ; preds = %12
%17 = load i32, i32* %6
%18 = load i32*, i32** %4
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = sub nsw i32 %17, %22
%24 = add nsw i32 %23, 50000
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %16
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
%32 = load i32*, i32** %4
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 50000
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 %38
store i32 %31, i32* %39
br label %58
40: ; preds = %16
%41 = load i32, i32* %6
%42 = load i32*, i32** %4
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = load i32, i32* %45
%47 = sub nsw i32 %41, %46
%48 = add nsw i32 %47, 50000
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100000 x i32], [100000 x i32]* %7, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = sub nsw i32 %51, 1
%53 = load i32*, i32** %8
%54 = getelementptr inbounds i32, i32* %53, i64 0
store i32 %52, i32* %54
%55 = load i32, i32* %9
%56 = load i32*, i32** %8
%57 = getelementptr inbounds i32, i32* %56, i64 1
store i32 %55, i32* %57
br label %62
58: ; preds = %29
br label %59
59: ; preds = %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %12
62: ; preds = %40, %12
%63 = load i32*, i32** %8
ret i32* %63
}

LLVM IR (-O2):
define noalias i32* @twoSum(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [100000 x i32]
%5 = bitcast [100000 x i32]* %4 to i8*
%6 = tail call i32* @malloc(i32 8)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %31
8: ; preds = %3
%9 = add i32 %2, 50000
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %8, %20
%12 = phi i64 [ 0, %8 ], [ %21, %20 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = sub i32 %9, %14
%16 = sext i32 %15 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 %20, label %27
20: ; preds = %11
%21 = add nuw nsw i64 %12, 1
%22 = add nsw i32 %14, 50000
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %23
%25 = trunc i64 %21 to i32
store i32 %25, i32* %24
%26 = icmp eq i64 %21, %10
br i1 %26, label %31, label %11
27: ; preds = %11
%28 = trunc i64 %12 to i32
%29 = add nsw i32 %18, -1
store i32 %29, i32* %6
%30 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %28, i32* %30
br label %31
31: ; preds = %20, %3, %27
ret i32* %6
}