#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 */
scalar_t__ malloc(int);
int list_relations(int ***n) {
  int i;
  int nn[3][4] = {{-1, -1, 1, 0}, {0, -1, -2, 2}, {-4, 3, -1, 1}};
  *n = (int **)malloc(3 * sizeof(int *));
  i = 0;
  while (i < 3) {
    (*n)[i] = (int *)malloc(4 * sizeof(int));
    (*n)[i][0] = nn[i][0];
    (*n)[i][1] = nn[i][1];
    (*n)[i][2] = nn[i][2];
    (*n)[i][3] = nn[i][3];
    i++;
  }
  return (3);
}


x86 assembly (clang, -O0):
<list_relations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
mov    $0x18,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    121e <list_relations+0xfe>
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0xc(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,(%rax)
movslq -0xc(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x4(%rax)
movslq -0xc(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0x8(%rax)
movslq -0xc(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0xc(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <list_relations+0x3c>
mov    $0x3,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_relations>:
push   %rbx
mov    %rdi,%rbx
mov    $0x18,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    (%rbx),%rcx
mov    %rax,(%rcx)
mov    (%rbx),%rax
mov    (%rax),%rax
movaps 0xec2(%rip),%xmm0
movups %xmm0,(%rax)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    (%rbx),%rcx
mov    %rax,0x8(%rcx)
mov    (%rbx),%rax
mov    0x8(%rax),%rax
movaps 0xeb0(%rip),%xmm0
movups %xmm0,(%rax)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    (%rbx),%rcx
mov    %rax,0x10(%rcx)
mov    (%rbx),%rax
mov    0x10(%rax),%rax
movaps 0xe9e(%rip),%xmm0
movups %xmm0,(%rax)
mov    $0x3,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @list_relations(i32*** nocapture %0) {
%2 = tail call i64 @malloc(i32 24)
%3 = inttoptr i64 %2 to i32**
store i32** %3, i32*** %0
%4 = tail call i64 @malloc(i32 16)
%5 = inttoptr i64 %4 to i32*
%6 = load i32**, i32*** %0
store i32* %5, i32** %6
%7 = bitcast i32*** %0 to <4 x i32>***
%8 = load <4 x i32>**, <4 x i32>*** %7
%9 = load <4 x i32>*, <4 x i32>** %8
store <4 x i32> <i32 -1, i32 -1, i32 1, i32 0>, <4 x i32>* %9
%10 = tail call i64 @malloc(i32 16)
%11 = inttoptr i64 %10 to i32*
%12 = load i32**, i32*** %0
%13 = getelementptr inbounds i32*, i32** %12, i64 1
store i32* %11, i32** %13
%14 = load i32**, i32*** %0
%15 = getelementptr inbounds i32*, i32** %14, i64 1
%16 = bitcast i32** %15 to <4 x i32>**
%17 = load <4 x i32>*, <4 x i32>** %16
store <4 x i32> <i32 0, i32 -1, i32 -2, i32 2>, <4 x i32>* %17
%18 = tail call i64 @malloc(i32 16)
%19 = inttoptr i64 %18 to i32*
%20 = load i32**, i32*** %0
%21 = getelementptr inbounds i32*, i32** %20, i64 2
store i32* %19, i32** %21
%22 = load i32**, i32*** %0
%23 = getelementptr inbounds i32*, i32** %22, i64 2
%24 = bitcast i32** %23 to <4 x i32>**
%25 = load <4 x i32>*, <4 x i32>** %24
store <4 x i32> <i32 -4, i32 3, i32 -1, i32 1>, <4 x i32>* %25
ret i32 3
}