#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 **fourSum(int *, int, int, int *);
int /*<<< orphan*/ printf(char *, int, 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 = fourSum(n, 14, 6, &size);
  for (int i = 0; i < size; i++) {
    printf("[%d, %d, %d, %d]\n", ts[i][0], ts[i][1], ts[i][2], ts[i][3]);
  }
  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
mov    $0x6,%edx
lea    -0x44(%rbp),%rcx
call   1050 <fourSum@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11d8 <main+0xa8>
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
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rdi
mov    (%rax,%rdi,8),%rax
mov    0xc(%rax),%r8d
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1176 <main+0x46>
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),%rcx
mov    $0xe,%esi
mov    $0x6,%edx
call   1040 <fourSum@plt>
cmpl   $0x0,0xc(%rsp)
jle    11b6 <main+0x96>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xeb3(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1190 <main+0x70>
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 = [18 x i8] c"[%d, %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** @fourSum(i32* %7, i32 14, i32 6, i32* %3)
store i32** %8, i32*** %4
store i32 0, i32* %5
br label %9
9: ; preds = %43, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %46
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 = load i32**, i32*** %4
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32*, i32** %35, i64 %37
%39 = load i32*, i32** %38
%40 = getelementptr inbounds i32, i32* %39, i64 3
%41 = load i32, i32* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %27, i32 %34, i32 %41)
br label %43
43: ; preds = %13
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %9
46: ; 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 = [18 x i8] c"[%d, %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** @fourSum(i32* %5, i32 14, i32 6, 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 [ %22, %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 = getelementptr inbounds i32, i32* %13, i64 3
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %18, i32 %20)
%22 = add nuw nsw i64 %11, 1
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %10, label %9
}