#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*/ free(int *);
int /*<<< orphan*/ printf(char *, int, int);
int *twoSum(int *, int, int);
int main(int argc, char **argv) {
  int numbers[] = {7, 2, 11, 15};
  int target = 9;
  int *indices = twoSum(numbers, 4, target);
  if (indices) {
    printf("index1 : %d, index2 : %d\n", indices[0], indices[1]);
    free(indices);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x9,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    $0x4,%esi
call   1050 <twoSum@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11a5 <main+0x75>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1050 <twoSum@plt>
test   %rax,%rax
je     1173 <main+0x43>
mov    %rax,%rbx
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.numbers = [4 x i32] [i32 7, i32 2, i32 11, i32 15]
@.str = [26 x i8] c"index1 : %d, index2 : %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i32]
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [4 x i32]* %6 to i8*
store i32 9, i32* %7
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%11 = load i32, i32* %7
%12 = call i32* @twoSum(i32* %10, i32 4, i32 %11)
store i32* %12, i32** %8
%13 = load i32*, i32** %8
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = load i32*, i32** %8
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %8
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %21)
%23 = load i32*, i32** %8
%24 = call i32 @free(i32* %23)
br label %25
25: ; preds = %15, %2
ret i32 0
}

LLVM IR (-O2):
@__const.main.numbers = [4 x i32] [i32 7, i32 2, i32 11, i32 15]
@.str = [26 x i8] c"index1 : %d, index2 : %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = call i32* @twoSum(i32* %5, i32 4, i32 9)
%7 = icmp eq i32* %6, null
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* %6
%10 = getelementptr inbounds i32, i32* %6, i64 1
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = call i32 @free(i32* %6)
br label %14
14: ; preds = %8, %2
ret i32 0
}