#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 getIntRandom(int);
scalar_t__ mCalloc(int, int);
int **p_bootPositions(int nBoot, int len) {
  int i, j;
  int **pos;
  pos = (int **)mCalloc(nBoot, sizeof(int *));
  for (i = 0; i < nBoot; i++) {
    pos[i] = (int *)mCalloc(len, sizeof(int));
    for (j = 0; j < len; j++) {
      pos[i][j] = getIntRandom(len);
    }
  }
  return (pos);
}


x86 assembly (clang, -O0):
<p_bootPositions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <mCalloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11bf <p_bootPositions+0x9f>
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1040 <mCalloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ac <p_bootPositions+0x8c>
mov    -0x8(%rbp),%edi
call   1030 <getIntRandom@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <p_bootPositions+0x55>
jmp    11b1 <p_bootPositions+0x91>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <p_bootPositions+0x26>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_bootPositions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
mov    $0x8,%esi
call   1040 <mCalloc@plt>
mov    %rax,%r12
test   %r14d,%r14d
jle    119a <p_bootPositions+0x7a>
mov    %r14d,%r14d
mov    %r15d,%r13d
xor    %ebx,%ebx
jmp    1159 <p_bootPositions+0x39>
nopl   (%rax)
add    $0x1,%rbx
cmp    %r14,%rbx
je     119a <p_bootPositions+0x7a>
mov    %r15d,%edi
mov    $0x4,%esi
call   1040 <mCalloc@plt>
mov    %rax,(%r12,%rbx,8)
test   %r15d,%r15d
jle    1150 <p_bootPositions+0x30>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
call   1030 <getIntRandom@plt>
mov    (%r12,%rbx,8),%rcx
mov    %eax,(%rcx,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1180 <p_bootPositions+0x60>
jmp    1150 <p_bootPositions+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32** @p_bootPositions(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32**
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = call i64 @mCalloc(i32 %8, i32 8)
%10 = inttoptr i64 %9 to i32**
store i32** %10, i32*** %7
store i32 0, i32* %5
br label %11
11: ; preds = %42, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %45
15: ; preds = %11
%16 = load i32, i32* %4
%17 = call i64 @mCalloc(i32 %16, i32 4)
%18 = inttoptr i64 %17 to i32*
%19 = load i32**, i32*** %7
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32*, i32** %19, i64 %21
store i32* %18, i32** %22
store i32 0, i32* %6
br label %23
23: ; preds = %38, %15
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i32, i32* %4
%29 = call i32 @getIntRandom(i32 %28)
%30 = load i32**, i32*** %7
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32*, i32** %30, i64 %32
%34 = load i32*, i32** %33
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
store i32 %29, i32* %37
br label %38
38: ; preds = %27
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %23
41: ; preds = %23
br label %42
42: ; preds = %41
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %11
45: ; preds = %11
%46 = load i32**, i32*** %7
ret i32** %46
}

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