// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: calculate_liberties
static int *calculate_liberties(float *board)
{
    int *lib = calloc(19*19, sizeof(int));
    int visited[19*19];
    int i, j;
    for(j = 0; j < 19; ++j){
        for(i = 0; i < 19; ++i){
            memset(visited, 0, 19*19*sizeof(int));
            int index = j*19 + i;
            if(!occupied(board,index)){
                if ((i > 0)  && occupied(board,index - 1)) propagate_liberty(board, lib, visited, j, i-1, occupied(board,index-1));
                if ((i < 18) && occupied(board,index + 1)) propagate_liberty(board, lib, visited, j, i+1, occupied(board,index+1));
                if ((j > 0)  && occupied(board,index - 19)) propagate_liberty(board, lib, visited, j-1, i, occupied(board,index-19));
                if ((j < 18) && occupied(board,index + 19)) propagate_liberty(board, lib, visited, j+1, i, occupied(board,index+19));
            }
        }
    }
    return lib;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x650, %rsp            # imm = 0x650
movq %rdi, -0x8(%rbp)
movl $0x169, %edi            # imm = 0x169
movl $0x4, %esi
callq 0x3220
movq %rax, -0x10(%rbp)
movl $0x0, -0x5c8(%rbp)
cmpl $0x13, -0x5c8(%rbp)
jge 0x59cc8
movl $0x0, -0x5c4(%rbp)
cmpl $0x13, -0x5c4(%rbp)
jge 0x59cb2
leaq -0x5c0(%rbp), %rdi
xorl %esi, %esi
movl $0x5a4, %edx            # imm = 0x5A4
callq 0x3190
imull $0x13, -0x5c8(%rbp), %eax
addl -0x5c4(%rbp), %eax
movl %eax, -0x5cc(%rbp)
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
callq 0x58d60
cmpl $0x0, %eax
jne 0x59c9c
cmpl $0x0, -0x5c4(%rbp)
jle 0x59abd
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
subl $0x1, %esi
callq 0x58d60
cmpl $0x0, %eax
je 0x59abd
movq -0x8(%rbp), %rax
movq %rax, -0x5f0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x5e8(%rbp)
leaq -0x5c0(%rbp), %rax
movq %rax, -0x5e0(%rbp)
movl -0x5c8(%rbp), %eax
movl %eax, -0x5d4(%rbp)
movl -0x5c4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5d0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
subl $0x1, %esi
callq 0x58d60
movq -0x5f0(%rbp), %rdi
movq -0x5e8(%rbp), %rsi
movq -0x5e0(%rbp), %rdx
movl -0x5d4(%rbp), %ecx
movl -0x5d0(%rbp), %r8d
movl %eax, %r9d
callq 0x5dcf0
cmpl $0x12, -0x5c4(%rbp)
jge 0x59b5c
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
addl $0x1, %esi
callq 0x58d60
cmpl $0x0, %eax
je 0x59b5c
movq -0x8(%rbp), %rax
movq %rax, -0x610(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x608(%rbp)
leaq -0x5c0(%rbp), %rax
movq %rax, -0x600(%rbp)
movl -0x5c8(%rbp), %eax
movl %eax, -0x5f8(%rbp)
movl -0x5c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5f4(%rbp)
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
addl $0x1, %esi
callq 0x58d60
movq -0x610(%rbp), %rdi
movq -0x608(%rbp), %rsi
movq -0x600(%rbp), %rdx
movl -0x5f8(%rbp), %ecx
movl -0x5f4(%rbp), %r8d
movl %eax, %r9d
callq 0x5dcf0
cmpl $0x0, -0x5c8(%rbp)
jle 0x59bfb
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
subl $0x13, %esi
callq 0x58d60
cmpl $0x0, %eax
je 0x59bfb
movq -0x8(%rbp), %rax
movq %rax, -0x630(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x628(%rbp)
leaq -0x5c0(%rbp), %rax
movq %rax, -0x620(%rbp)
movl -0x5c8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x618(%rbp)
movl -0x5c4(%rbp), %eax
movl %eax, -0x614(%rbp)
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
subl $0x13, %esi
callq 0x58d60
movq -0x630(%rbp), %rdi
movq -0x628(%rbp), %rsi
movq -0x620(%rbp), %rdx
movl -0x618(%rbp), %ecx
movl -0x614(%rbp), %r8d
movl %eax, %r9d
callq 0x5dcf0
cmpl $0x12, -0x5c8(%rbp)
jge 0x59c9a
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
addl $0x13, %esi
callq 0x58d60
cmpl $0x0, %eax
je 0x59c9a
movq -0x8(%rbp), %rax
movq %rax, -0x650(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x648(%rbp)
leaq -0x5c0(%rbp), %rax
movq %rax, -0x640(%rbp)
movl -0x5c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x638(%rbp)
movl -0x5c4(%rbp), %eax
movl %eax, -0x634(%rbp)
movq -0x8(%rbp), %rdi
movl -0x5cc(%rbp), %esi
addl $0x13, %esi
callq 0x58d60
movq -0x650(%rbp), %rdi
movq -0x648(%rbp), %rsi
movq -0x640(%rbp), %rdx
movl -0x638(%rbp), %ecx
movl -0x634(%rbp), %r8d
movl %eax, %r9d
callq 0x5dcf0
jmp 0x59c9c
jmp 0x59c9e
movl -0x5c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c4(%rbp)
jmp 0x599d3
jmp 0x59cb4
movl -0x5c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c8(%rbp)
jmp 0x599bc
movq -0x10(%rbp), %rax
addq $0x650, %rsp            # imm = 0x650
popq %rbp
retq
nopw %cs:(%rax,%rax)