#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*/ box_partition(int /*<<< orphan*/, int const, int,
                                 int const **, int ***);
int /*<<< orphan*/ box_partition_maps(int const, int const, int const ***,
                                      int const, int **, int **, int **,
                                      int **);
scalar_t__ malloc(int);
void box_partition_rcb(const int np, const int my_p, const int root_box[][2],
                       const int ghost, int (**pbox)[3][2], int **map_local_id,
                       int **map_recv_pc, int **map_send_pc,
                       int **map_send_id) {
  *pbox = (int(*)[3][2])malloc(sizeof(int) * np * 3 * 2);
  box_partition(0, np, 2, root_box, *pbox);
  box_partition_maps(np, my_p, (const int(*)[3][2]) * pbox, ghost, map_local_id,
                     map_recv_pc, map_send_pc, map_send_id);
}


x86 assembly (clang, -O0):
<box_partition_rcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
imul   $0x3,%rax,%rax
shl    $0x1,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    (%rax),%r8
xor    %edi,%edi
mov    $0x2,%edx
call   1050 <box_partition@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <box_partition_maps@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_partition_rcb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r15
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %rdx,%rbp
mov    %esi,%r13d
mov    %edi,%r14d
lea    0x0(,%r14,8),%eax
lea    (%rax,%rax,2),%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
xor    %edi,%edi
mov    %r14d,%esi
mov    $0x2,%edx
mov    %rbp,%rcx
mov    %rax,%r8
call   1050 <box_partition@plt>
mov    (%rbx),%rdx
movups 0x58(%rsp),%xmm0
movups %xmm0,(%rsp)
mov    %r14d,%edi
mov    %r13d,%esi
mov    %r12d,%ecx
mov    %r15,%r8
mov    0x50(%rsp),%r9
call   1040 <box_partition_maps@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @box_partition_rcb(i32 %0, i32 %1, [2 x i32]* %2, i32 %3, [3 x [2 x i32]]** %4, i32** %5, i32** %6, i32** %7, i32** %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca [2 x i32]*
%13 = alloca i32
%14 = alloca [3 x [2 x i32]]**
%15 = alloca i32**
%16 = alloca i32**
%17 = alloca i32**
%18 = alloca i32**
store i32 %0, i32* %10
store i32 %1, i32* %11
store [2 x i32]* %2, [2 x i32]** %12
store i32 %3, i32* %13
store [3 x [2 x i32]]** %4, [3 x [2 x i32]]*** %14
store i32** %5, i32*** %15
store i32** %6, i32*** %16
store i32** %7, i32*** %17
store i32** %8, i32*** %18
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = mul i64 4, %20
%22 = mul i64 %21, 3
%23 = mul i64 %22, 2
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to [3 x [2 x i32]]*
%27 = load [3 x [2 x i32]]**, [3 x [2 x i32]]*** %14
store [3 x [2 x i32]]* %26, [3 x [2 x i32]]** %27
%28 = load i32, i32* %10
%29 = load [2 x i32]*, [2 x i32]** %12
%30 = bitcast [2 x i32]* %29 to i32**
%31 = load [3 x [2 x i32]]**, [3 x [2 x i32]]*** %14
%32 = load [3 x [2 x i32]]*, [3 x [2 x i32]]** %31
%33 = bitcast [3 x [2 x i32]]* %32 to i32***
%34 = call i32 @box_partition(i32 0, i32 %28, i32 2, i32** %30, i32*** %33)
%35 = load i32, i32* %10
%36 = load i32, i32* %11
%37 = load [3 x [2 x i32]]**, [3 x [2 x i32]]*** %14
%38 = load [3 x [2 x i32]]*, [3 x [2 x i32]]** %37
%39 = bitcast [3 x [2 x i32]]* %38 to i32***
%40 = load i32, i32* %13
%41 = load i32**, i32*** %15
%42 = load i32**, i32*** %16
%43 = load i32**, i32*** %17
%44 = load i32**, i32*** %18
%45 = call i32 @box_partition_maps(i32 %35, i32 %36, i32*** %39, i32 %40, i32** %41, i32** %42, i32** %43, i32** %44)
ret void
}

LLVM IR (-O2):
define void @box_partition_rcb(i32 %0, i32 %1, [2 x i32]* %2, i32 %3, [3 x [2 x i32]]** nocapture %4, i32** %5, i32** %6, i32** %7, i32** %8) {
%10 = mul i32 %0, 24
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to [3 x [2 x i32]]*
store [3 x [2 x i32]]* %12, [3 x [2 x i32]]** %4
%13 = bitcast [2 x i32]* %2 to i32**
%14 = inttoptr i64 %11 to i32***
%15 = tail call i32 @box_partition(i32 0, i32 %0, i32 2, i32** %13, i32*** %14)
%16 = bitcast [3 x [2 x i32]]** %4 to i32****
%17 = load i32***, i32**** %16
%18 = tail call i32 @box_partition_maps(i32 %0, i32 %1, i32*** %17, i32 %3, i32** %5, i32** %6, i32** %7, i32** %8)
ret void
}