#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*/ abort();
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
unsigned char **alloc_2d_byte(int n1, int n2) {
  unsigned char **ii, *i;
  int j;
  ii = (unsigned char **)calloc(n1, sizeof(unsigned char *));
  {
    if ((ii) == NULL) {
      fprintf(
          stderr,
          "ERROR! Allocation failure. Probably out of memory in %s:%d.\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BIC-MNI/BEaST/refs/heads/master/alloc.c",
          168);
      abort();
    }
  };
  i = (unsigned char *)calloc(n1 * n2, sizeof(unsigned char));
  {
    if ((i) == NULL) {
      fprintf(
          stderr,
          "ERROR! Allocation failure. Probably out of memory in %s:%d.\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BIC-MNI/BEaST/refs/heads/master/alloc.c",
          170);
      abort();
    }
  };
  ii[0] = i;
  for (j = 1; j < n1; j++) {
    ii[j] = ii[j - 1] + n2;
  }
  return ii;
}


x86 assembly (clang, -O0):
<alloc_2d_byte>:
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 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1182 <alloc_2d_byte+0x52>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
lea    0xecc(%rip),%rdx
mov    $0xa8,%ecx
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ca <alloc_2d_byte+0x9a>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
lea    0xe84(%rip),%rdx
mov    $0xaa,%ecx
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    121a <alloc_2d_byte+0xea>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x8(%rbp),%rax
add    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11dc <alloc_2d_byte+0xac>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_2d_byte>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x8,%esi
call   1040 <calloc@plt>
test   %rax,%rax
je     1228 <alloc_2d_byte+0xf8>
mov    %rax,%rbx
mov    %r14d,%edi
imul   %ebp,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
test   %rax,%rax
je     1246 <alloc_2d_byte+0x116>
mov    %rax,(%rbx)
cmp    $0x2,%ebp
jl     1220 <alloc_2d_byte+0xf0>
movslq %r14d,%rcx
mov    %ebp,%esi
lea    -0x1(%rsi),%rdi
add    $0xfffffffffffffffe,%rsi
mov    %edi,%edx
and    $0x7,%edx
cmp    $0x7,%rsi
jae    119b <alloc_2d_byte+0x6b>
mov    $0x1,%esi
test   %rdx,%rdx
jne    1202 <alloc_2d_byte+0xd2>
jmp    1220 <alloc_2d_byte+0xf0>
and    $0xfffffffffffffff8,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %rcx,%rax
mov    %rax,0x8(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x10(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x18(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x20(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x28(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x30(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x38(%rbx,%rsi,8)
add    %rcx,%rax
mov    %rax,0x40(%rbx,%rsi,8)
add    $0x8,%rsi
cmp    %rsi,%rdi
jne    11b0 <alloc_2d_byte+0x80>
add    $0x1,%rsi
test   %rdx,%rdx
je     1220 <alloc_2d_byte+0xf0>
add    %rcx,%rax
lea    (%rbx,%rsi,8),%rsi
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
mov    %rax,(%rsi,%rdi,8)
add    $0x1,%rdi
add    %rcx,%rax
cmp    %rdi,%rdx
jne    1210 <alloc_2d_byte+0xe0>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    0xdc8(%rip),%rsi
lea    0xdfe(%rip),%rdx
mov    $0xa8,%ecx
jmp    1262 <alloc_2d_byte+0x132>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
lea    0xde0(%rip),%rdx
mov    $0xaa,%ecx
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"ERROR! Allocation failure. Probably out of memory in %s:%d.\0A\00"
@.str.1 = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BIC-MNI/BEaST/refs/heads/master/alloc.c\00"
define i8** @alloc_2d_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = call i64 @calloc(i32 %8, i32 8)
%10 = inttoptr i64 %9 to i8**
store i8** %10, i8*** %5
%11 = load i8**, i8*** %5
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 168)
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = call i64 @calloc(i32 %20, i32 1)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %29
25: ; preds = %17
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 170)
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %17
%30 = load i8*, i8** %6
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
store i8* %30, i8** %32
store i32 1, i32* %7
br label %33
33: ; preds = %51, %29
%34 = load i32, i32* %7
%35 = load i32, i32* %3
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %54
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = load i32, i32* %7
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %38, i64 %41
%43 = load i8*, i8** %42
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8**, i8*** %5
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
store i8* %46, i8** %50
br label %51
51: ; preds = %37
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %33
54: ; preds = %33
%55 = load i8**, i8*** %5
ret i8** %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"ERROR! Allocation failure. Probably out of memory in %s:%d.\0A\00"
@.str.1 = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BIC-MNI/BEaST/refs/heads/master/alloc.c\00"
define i8** @alloc_2d_byte(i32 %0, i32 %1) {
%3 = tail call i64 @calloc(i32 %0, i32 8)
%4 = inttoptr i64 %3 to i8**
%5 = icmp eq i64 %3, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 168)
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %2
%11 = mul nsw i32 %1, %0
%12 = tail call i64 @calloc(i32 %11, i32 1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 170)
%17 = tail call i32 (...) @abort()
unreachable
18: ; preds = %10
%19 = inttoptr i64 %12 to i8*
store i8* %19, i8** %4
%20 = icmp sgt i32 %0, 1
br i1 %20, label %21, label %73
21: ; preds = %18
%22 = sext i32 %1 to i64
%23 = zext i32 %0 to i64
%24 = add nsw i64 %23, -1
%25 = add nsw i64 %23, -2
%26 = and i64 %24, 7
%27 = icmp ult i64 %25, 7
br i1 %27, label %60, label %28
28: ; preds = %21
%29 = and i64 %24, -8
br label %30
30: ; preds = %30, %28
%31 = phi i8* [ %19, %28 ], [ %55, %30 ]
%32 = phi i64 [ 1, %28 ], [ %57, %30 ]
%33 = phi i64 [ 0, %28 ], [ %58, %30 ]
%34 = getelementptr inbounds i8, i8* %31, i64 %22
%35 = getelementptr inbounds i8*, i8** %4, i64 %32
store i8* %34, i8** %35
%36 = add nuw nsw i64 %32, 1
%37 = getelementptr inbounds i8, i8* %34, i64 %22
%38 = getelementptr inbounds i8*, i8** %4, i64 %36
store i8* %37, i8** %38
%39 = add nuw nsw i64 %32, 2
%40 = getelementptr inbounds i8, i8* %37, i64 %22
%41 = getelementptr inbounds i8*, i8** %4, i64 %39
store i8* %40, i8** %41
%42 = add nuw nsw i64 %32, 3
%43 = getelementptr inbounds i8, i8* %40, i64 %22
%44 = getelementptr inbounds i8*, i8** %4, i64 %42
store i8* %43, i8** %44
%45 = add nuw nsw i64 %32, 4
%46 = getelementptr inbounds i8, i8* %43, i64 %22
%47 = getelementptr inbounds i8*, i8** %4, i64 %45
store i8* %46, i8** %47
%48 = add nuw nsw i64 %32, 5
%49 = getelementptr inbounds i8, i8* %46, i64 %22
%50 = getelementptr inbounds i8*, i8** %4, i64 %48
store i8* %49, i8** %50
%51 = add nuw nsw i64 %32, 6
%52 = getelementptr inbounds i8, i8* %49, i64 %22
%53 = getelementptr inbounds i8*, i8** %4, i64 %51
store i8* %52, i8** %53
%54 = add nuw nsw i64 %32, 7
%55 = getelementptr inbounds i8, i8* %52, i64 %22
%56 = getelementptr inbounds i8*, i8** %4, i64 %54
store i8* %55, i8** %56
%57 = add nuw nsw i64 %32, 8
%58 = add i64 %33, 8
%59 = icmp eq i64 %58, %29
br i1 %59, label %60, label %30
60: ; preds = %30, %21
%61 = phi i8* [ %19, %21 ], [ %55, %30 ]
%62 = phi i64 [ 1, %21 ], [ %57, %30 ]
%63 = icmp eq i64 %26, 0
br i1 %63, label %73, label %64
64: ; preds = %60, %64
%65 = phi i8* [ %68, %64 ], [ %61, %60 ]
%66 = phi i64 [ %70, %64 ], [ %62, %60 ]
%67 = phi i64 [ %71, %64 ], [ 0, %60 ]
%68 = getelementptr inbounds i8, i8* %65, i64 %22
%69 = getelementptr inbounds i8*, i8** %4, i64 %66
store i8* %68, i8** %69
%70 = add nuw nsw i64 %66, 1
%71 = add i64 %67, 1
%72 = icmp eq i64 %71, %26
br i1 %72, label %73, label %64
73: ; preds = %60, %64, %18
ret i8** %4
}