void threeSumMain(void) {
  int len = 0;
  int array[] = {-4, -2, 1, -5, -4, -4, 4, -2, 0, 4, 0, -2, 3, 1, -5, 0};
  { len = sizeof(array) / sizeof(array[0]); };
  myQsort(array, 0, len - 1);
  while (len) {
    printf("%d\n", array[len - 1]);
    len--;
  }
  { len = sizeof(array) / sizeof(array[0]); };
  int returnSize = 0;
  int **result = threeSum(array, len, &returnSize);
  int i = 0;
  for (i = 0; i < returnSize; i++) {
    printf("%d %d %d\n", result[i][0], result[i][1], result[i][2]);
    free(result[i]);
  }
  free(result);
}


x86 assembly (clang, -O0):
<threeSumMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x10,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x0,%al
call   1060 <myQsort@plt>
cmpl   $0x0,-0x4(%rbp)
je     11c0 <threeSumMain+0x70>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <threeSumMain+0x3e>
movl   $0x10,-0x4(%rbp)
movl   $0x0,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%esi
lea    -0x54(%rbp),%rdx
mov    $0x0,%al
call   1070 <threeSum@plt>
cltq
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1259 <threeSumMain+0x109>
mov    -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
mov    -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%edx
mov    -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%ecx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11f4 <threeSumMain+0xa4>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threeSumMain>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movaps 0xee0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xf,%edx
xor    %eax,%eax
call   1050 <myQsort@plt>
mov    0x4c(%rsp),%esi
lea    0xeac(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1060 <threeSum@plt>
movslq %eax,%r15
cmpl   $0x0,0xc(%rsp)
jle    12dd <threeSumMain+0x19d>
lea    0xd9d(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     12b0 <threeSumMain+0x170>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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