#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 */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int **fourSum(int *, int, int /*<<< orphan*/, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(void) {
  int x[] = {1, 0, -1, 0, -2, 2};
  int i;
  int **res;
  res = fourSum(x, sizeof(x) / sizeof(int), 0, &i);
  while (i-- > 0)
    printf("%d %d %d %d\n", res[i][0], res[i][1], res[i][2], res[i][3]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
xor    %edx,%edx
lea    -0x24(%rbp),%rcx
call   1040 <fourSum@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x0,%eax
jle    11c9 <main+0xa9>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x4(%rax),%edx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%ecx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rdi
mov    (%rax,%rdi,8),%rax
mov    0xc(%rax),%r8d
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
jmp    1168 <main+0x48>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xee2(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rcx
mov    $0x6,%esi
xor    %edx,%edx
call   1040 <fourSum@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
test   %ecx,%ecx
jle    1199 <main+0x79>
lea    0xeaa(%rip),%r14
xchg   %ax,%ax
mov    %eax,%eax
mov    (%rbx,%rax,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
test   %ecx,%ecx
jg     1170 <main+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

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