#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, int);
int **threeSum(int *, int, int *);
int main() {
  int n[] = {-1, 0, 1, 2, -1, -4, -5, -9, 3, 5, 6, 7, 8, 4};
  int size;
  int **ts = threeSum(n, 14, &size);
  for (int i = 0; i < size; i++) {
    printf("[%d, %d, %d]\n", ts[i][0], ts[i][1], ts[i][2]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xe,%esi
lea    -0x44(%rbp),%rdx
call   1050 <threeSum@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11c3 <main+0x93>
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%edx
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%ecx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1171 <main+0x41>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0xf00(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0xe,%esi
call   1040 <threeSum@plt>
cmpl   $0x0,0xc(%rsp)
jle    11a2 <main+0x82>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xeb8(%rip),%r14
mov    (%r15,%rbx,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1180 <main+0x60>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.n = [14 x i32] [i32 -1, i32 0, i32 1, i32 2, i32 -1, i32 -4, i32 -5, i32 -9, i32 3, i32 5, i32 6, i32 7, i32 8, i32 4]
@.str = [14 x i8] c"[%d, %d, %d]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i32]
%3 = alloca i32
%4 = alloca i32**
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [14 x i32]* %2 to i8*
%7 = getelementptr inbounds [14 x i32], [14 x i32]* %2, i64 0, i64 0
%8 = call i32** @threeSum(i32* %7, i32 14, i32* %3)
store i32** %8, i32*** %4
store i32 0, i32* %5
br label %9
9: ; preds = %36, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %39
13: ; preds = %9
%14 = load i32**, i32*** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32*, i32** %14, i64 %16
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 0
%20 = load i32, i32* %19
%21 = load i32**, i32*** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32*, i32** %21, i64 %23
%25 = load i32*, i32** %24
%26 = getelementptr inbounds i32, i32* %25, i64 1
%27 = load i32, i32* %26
%28 = load i32**, i32*** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32*, i32** %28, i64 %30
%32 = load i32*, i32** %31
%33 = getelementptr inbounds i32, i32* %32, i64 2
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %27, i32 %34)
br label %36
36: ; preds = %13
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %9
39: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@__const.main.n = [14 x i32] [i32 -1, i32 0, i32 1, i32 2, i32 -1, i32 -4, i32 -5, i32 -9, i32 3, i32 5, i32 6, i32 7, i32 8, i32 4]
@.str = [14 x i8] c"[%d, %d, %d]\0A\00"
define i32 @main() {
%1 = alloca [14 x i32]
%2 = alloca i32
%3 = bitcast [14 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 0
%6 = call i32** @threeSum(i32* %5, i32 14, i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %10, %0
ret i32 0
10: ; preds = %0, %10
%11 = phi i64 [ %20, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds i32*, i32** %6, i64 %11
%13 = load i32*, i32** %12
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %13, i64 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %13, i64 2
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %18)
%20 = add nuw nsw i64 %11, 1
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %10, label %9
}