#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*/ fillRow(int /*<<< orphan*/, int **);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int main(int argc, char **argv) {
  int **chessboard, row;
  chessboard = (int **)malloc(8 * sizeof(int *));
  for (row = 0; row < 8; row++) {
    chessboard[row] = (int *)malloc(8 * sizeof(int));
    memset(chessboard[row], 0, 8 * sizeof(int));
  }
  fillRow(0, chessboard);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11a4 <main+0x74>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <main+0x2b>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1040 <fillRow@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x28(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x30(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    $0x20,%edi
call   1050 <malloc@plt>
mov    %rax,0x38(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <fillRow@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 64)
%4 = inttoptr i64 %3 to i32**
%5 = tail call i64 @malloc(i32 32)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %4
%7 = tail call i32 @memset(i32* %6, i32 0, i32 32)
%8 = tail call i64 @malloc(i32 32)
%9 = inttoptr i64 %8 to i32*
%10 = getelementptr inbounds i32*, i32** %4, i64 1
store i32* %9, i32** %10
%11 = tail call i32 @memset(i32* %9, i32 0, i32 32)
%12 = tail call i64 @malloc(i32 32)
%13 = inttoptr i64 %12 to i32*
%14 = getelementptr inbounds i32*, i32** %4, i64 2
store i32* %13, i32** %14
%15 = tail call i32 @memset(i32* %13, i32 0, i32 32)
%16 = tail call i64 @malloc(i32 32)
%17 = inttoptr i64 %16 to i32*
%18 = getelementptr inbounds i32*, i32** %4, i64 3
store i32* %17, i32** %18
%19 = tail call i32 @memset(i32* %17, i32 0, i32 32)
%20 = tail call i64 @malloc(i32 32)
%21 = inttoptr i64 %20 to i32*
%22 = getelementptr inbounds i32*, i32** %4, i64 4
store i32* %21, i32** %22
%23 = tail call i32 @memset(i32* %21, i32 0, i32 32)
%24 = tail call i64 @malloc(i32 32)
%25 = inttoptr i64 %24 to i32*
%26 = getelementptr inbounds i32*, i32** %4, i64 5
store i32* %25, i32** %26
%27 = tail call i32 @memset(i32* %25, i32 0, i32 32)
%28 = tail call i64 @malloc(i32 32)
%29 = inttoptr i64 %28 to i32*
%30 = getelementptr inbounds i32*, i32** %4, i64 6
store i32* %29, i32** %30
%31 = tail call i32 @memset(i32* %29, i32 0, i32 32)
%32 = tail call i64 @malloc(i32 32)
%33 = inttoptr i64 %32 to i32*
%34 = getelementptr inbounds i32*, i32** %4, i64 7
store i32* %33, i32** %34
%35 = tail call i32 @memset(i32* %33, i32 0, i32 32)
%36 = tail call i32 @fillRow(i32 0, i32** %4)
ret i32 0
}