#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__ rax_calloc(unsigned int, int);
scalar_t__ rax_malloc(int);
unsigned int **createBitVectors(int numberOfTrees,
                                unsigned int *vectorLengthPerTree) {
  unsigned int **bitVectors =
      (unsigned int **)rax_malloc(sizeof(unsigned int *) * numberOfTrees);
  int i = 0;
  for (i = 0; i < numberOfTrees; i++)
    bitVectors[i] = (unsigned int *)rax_calloc(vectorLengthPerTree[i],
                                               sizeof(unsigned int));
  return bitVectors;
}


x86 assembly (clang, -O0):
<createBitVectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <rax_malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118e <createBitVectors+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    $0x4,%esi
call   1040 <rax_calloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <createBitVectors+0x30>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createBitVectors>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
lea    0x0(,%r15,8),%edi
call   1030 <rax_malloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    116b <createBitVectors+0x4b>
mov    %r15d,%r15d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
mov    $0x4,%esi
call   1040 <rax_calloc@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <createBitVectors+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32** @createBitVectors(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32**
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = mul i64 8, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @rax_malloc(i32 %10)
%12 = inttoptr i64 %11 to i32**
store i32** %12, i32*** %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %13
13: ; preds = %29, %2
%14 = load i32, i32* %6
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = call i64 @rax_calloc(i32 %22, i32 4)
%24 = inttoptr i64 %23 to i32*
%25 = load i32**, i32*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32*, i32** %25, i64 %27
store i32* %24, i32** %28
br label %29
29: ; preds = %17
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %13
32: ; preds = %13
%33 = load i32**, i32*** %5
ret i32** %33
}

LLVM IR (-O2):
define i32** @createBitVectors(i32 %0, i32* nocapture %1) {
%3 = shl i32 %0, 3
%4 = tail call i64 @rax_malloc(i32 %3)
%5 = inttoptr i64 %4 to i32**
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %16, %9 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = tail call i64 @rax_calloc(i32 %12, i32 4)
%14 = inttoptr i64 %13 to i32*
%15 = getelementptr inbounds i32*, i32** %5, i64 %10
store i32* %14, i32** %15
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %2
ret i32** %5
}