#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*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ malloc(int const);
char **strArrAlloc(const int size, const int maxLen) {
  assert(size >= 0);
  assert(maxLen > 0);
  char **arr;
  if ((arr = (char **)malloc(size * sizeof(char *))) == NULL) {
    exit(EXIT_FAILURE);
  }
  for (int i = 0; i < size; i++) {
    if ((arr[i] = (char *)malloc(maxLen * sizeof(char))) == NULL) {
      exit(EXIT_FAILURE);
    }
  }
  return arr;
}


x86 assembly (clang, -O0):
<strArrAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    118b <strArrAlloc+0x5b>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e4 <strArrAlloc+0xb4>
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %rax,(%rcx,%rdx,8)
cmp    $0x0,%rax
jne    11d1 <strArrAlloc+0xa1>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
jmp    11d6 <strArrAlloc+0xa6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1192 <strArrAlloc+0x62>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strArrAlloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %edi,%r14d
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xor    %edi,%edi
test   %r15d,%r15d
setg   %dil
call   1030 <assert@plt>
lea    0x0(,%r14,8),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11a6 <strArrAlloc+0x76>
mov    %rax,%r12
test   %r14d,%r14d
jle    119a <strArrAlloc+0x6a>
mov    %r14d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
call   1040 <malloc@plt>
mov    %rax,(%r12,%rbx,8)
test   %rax,%rax
je     11a6 <strArrAlloc+0x76>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <strArrAlloc+0x50>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8** @strArrAlloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 8
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to i8**
store i8** %20, i8*** %5
%21 = icmp eq i8** %20, null
br i1 %21, label %22, label %25
22: ; preds = %2
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %2
store i32 0, i32* %6
br label %26
26: ; preds = %46, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %49
30: ; preds = %26
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = mul i64 %32, 1
%34 = trunc i64 %33 to i32
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to i8*
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
store i8* %36, i8** %40
%41 = icmp eq i8* %36, null
br i1 %41, label %42, label %45
42: ; preds = %30
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %30
br label %46
46: ; preds = %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %26
49: ; preds = %26
%50 = load i8**, i8*** %5
ret i8** %50
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i8** @strArrAlloc(i32 %0, i32 %1) {
%3 = xor i32 %0, -1
%4 = lshr i32 %3, 31
%5 = tail call i32 @assert(i32 %4)
%6 = icmp sgt i32 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = shl i32 %0, 3
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8**
%12 = icmp eq i64 %10, 0
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %22
15: ; preds = %13
%16 = zext i32 %0 to i64
br label %23
17: ; preds = %2
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %23
%21 = icmp eq i64 %29, %16
br i1 %21, label %22, label %23
22: ; preds = %20, %13
ret i8** %11
23: ; preds = %15, %20
%24 = phi i64 [ 0, %15 ], [ %29, %20 ]
%25 = tail call i64 @malloc(i32 %1)
%26 = inttoptr i64 %25 to i8*
%27 = getelementptr inbounds i8*, i8** %11, i64 %24
store i8* %26, i8** %27
%28 = icmp eq i64 %25, 0
%29 = add nuw nsw i64 %24, 1
br i1 %28, label %30, label %20
30: ; preds = %23
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
}