#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*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
void createGeneAdjMatrix(int ***adj, int num_genes) {
  int i, j, num;
  num = 2 * num_genes + 1;
  *adj = (int **)malloc(num * sizeof(int *));
  if (*adj == (int **)NULL)
    fprintf(stderr, "ERROR: adj NULL\n");
  for (i = 0; i < num; i++) {
    (*adj)[i] = (int *)malloc(num * sizeof(int));
    if ((*adj)[i] == (int *)NULL)
      fprintf(stderr, "ERROR: adj[%d] NULL\n", i);
    for (j = 0; j < num; j++)
      (*adj)[i][j] = 0;
  }
  return;
}


x86 assembly (clang, -O0):
<createGeneAdjMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1179 <createGeneAdjMatrix+0x59>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122b <createGeneAdjMatrix+0x10b>
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    11dd <createGeneAdjMatrix+0xbd>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1218 <createGeneAdjMatrix+0xf8>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e4 <createGeneAdjMatrix+0xc4>
jmp    121d <createGeneAdjMatrix+0xfd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1180 <createGeneAdjMatrix+0x60>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createGeneAdjMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    (%rsi,%rsi,1),%r14d
add    $0x1,%r14d
mov    %esi,%ebp
add    %ebp,%ebp
lea    0x8(,%rbp,8),%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1168 <createGeneAdjMatrix+0x38>
test   %r14d,%r14d
jg     1184 <createGeneAdjMatrix+0x54>
jmp    11fa <createGeneAdjMatrix+0xca>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14d,%r14d
jle    11fa <createGeneAdjMatrix+0xca>
mov    %ebp,%r12d
shl    $0x2,%r12
or     $0x4,%r12
mov    %r14d,%r13d
shl    $0x2,%r14d
lea    0xe74(%rip),%r15
xor    %ebp,%ebp
jmp    11ca <createGeneAdjMatrix+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rax
mov    (%rax,%rbp,8),%rdi
xor    %esi,%esi
mov    %r12,%rdx
call   1030 <memset@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     11fa <createGeneAdjMatrix+0xca>
mov    %r14d,%edi
call   1050 <malloc@plt>
mov    (%rbx),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    (%rbx),%rax
cmpq   $0x0,(%rax,%rbp,8)
jne    11b0 <createGeneAdjMatrix+0x80>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b0 <createGeneAdjMatrix+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"ERROR: adj NULL\0A\00"
@.str.1 = [21 x i8] c"ERROR: adj[%d] NULL\0A\00"
define void @createGeneAdjMatrix(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* %4
%9 = mul nsw i32 2, %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 8
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i32**
%17 = load i32***, i32**** %3
store i32** %16, i32*** %17
%18 = load i32***, i32**** %3
%19 = load i32**, i32*** %18
%20 = icmp eq i32** %19, null
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %21, %2
store i32 0, i32* %5
br label %25
25: ; preds = %71, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %74
29: ; preds = %25
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 4
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to i32*
%36 = load i32***, i32**** %3
%37 = load i32**, i32*** %36
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32*, i32** %37, i64 %39
store i32* %35, i32** %40
%41 = load i32***, i32**** %3
%42 = load i32**, i32*** %41
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32*, i32** %42, i64 %44
%46 = load i32*, i32** %45
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %52
48: ; preds = %29
%49 = load i32, i32* @stderr
%50 = load i32, i32* %5
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %48, %29
store i32 0, i32* %6
br label %53
53: ; preds = %67, %52
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %70
57: ; preds = %53
%58 = load i32***, i32**** %3
%59 = load i32**, i32*** %58
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32*, i32** %59, i64 %61
%63 = load i32*, i32** %62
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
store i32 0, i32* %66
br label %67
67: ; preds = %57
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 1
store i32 %69, i32* %6
br label %53
70: ; preds = %53
br label %71
71: ; preds = %70
%72 = load i32, i32* %5
%73 = add nsw i32 %72, 1
store i32 %73, i32* %5
br label %25
74: ; preds = %25
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"ERROR: adj NULL\0A\00"
@.str.1 = [21 x i8] c"ERROR: adj[%d] NULL\0A\00"
define void @createGeneAdjMatrix(i32*** nocapture %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = or i32 %3, 1
%5 = shl i32 %4, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i32**
store i32** %7, i32*** %0
%8 = icmp eq i64 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %2
%13 = icmp sgt i32 %4, 0
br i1 %13, label %14, label %41
14: ; preds = %12
%15 = shl i32 %4, 2
%16 = zext i32 %3 to i64
%17 = shl nuw nsw i64 %16, 2
%18 = or i64 %17, 4
%19 = zext i32 %4 to i64
br label %20
20: ; preds = %14, %34
%21 = phi i64 [ 0, %14 ], [ %39, %34 ]
%22 = tail call i64 @malloc(i32 %15)
%23 = inttoptr i64 %22 to i32*
%24 = load i32**, i32*** %0
%25 = getelementptr inbounds i32*, i32** %24, i64 %21
store i32* %23, i32** %25
%26 = load i32**, i32*** %0
%27 = getelementptr inbounds i32*, i32** %26, i64 %21
%28 = load i32*, i32** %27
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %34
30: ; preds = %20
%31 = load i32, i32* @stderr
%32 = trunc i64 %21 to i32
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %30, %20
%35 = load i32**, i32*** %0
%36 = getelementptr inbounds i32*, i32** %35, i64 %21
%37 = bitcast i32** %36 to i8**
%38 = load i8*, i8** %37
%39 = add nuw nsw i64 %21, 1
%40 = icmp eq i64 %39, %19
br i1 %40, label %41, label %20
41: ; preds = %34, %12
ret void
}