// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5b8, %rsp            # imm = 0x5B8
movq %rdi, %rbx
movl $0x169, %edi            # imm = 0x169
movl $0x4, %esi
callq 0x3260
movq %rax, %r14
leaq 0x5f0(%rbx), %r13
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
leaq 0x1(%r12), %rax
movq %rax, 0x8(%rsp)
leal -0x1(%r12), %eax
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
movl $0x5a4, %edx            # imm = 0x5A4
movq %r15, %rdi
xorl %esi, %esi
callq 0x31d0
xorps %xmm2, %xmm2
movss -0x5f0(%r13,%rbp,4), %xmm0
ucomiss %xmm2, %xmm0
jne 0x43fa3
jnp 0x43fb1
incq %rbp
cmpq $0x13, %rbp
jne 0x43f80
jmp 0x44181
movss -0x4c(%r13,%rbp,4), %xmm0
ucomiss %xmm2, %xmm0
jne 0x43fa3
jp 0x43fa3
testq %rbp, %rbp
je 0x44011
movss -0x5f4(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss %xmm2, %xmm0
jne 0x43fdb
jnp 0x43ff5
leal -0x1(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x46f49
xorps %xmm2, %xmm2
jmp 0x4400b
movss -0x50(%r13,%rbp,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x44134
jp 0x44134
cmpq $0x12, %rbp
je 0x44058
movss -0x5ec(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss %xmm2, %xmm0
jne 0x44028
jnp 0x44042
leal 0x1(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x46f49
xorps %xmm2, %xmm2
jmp 0x44058
movss -0x48(%r13,%rbp,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x4410f
jp 0x4410f
testq %r12, %r12
je 0x440b1
movss -0x63c(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss %xmm2, %xmm0
jne 0x44074
jnp 0x4408e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl 0x4(%rsp), %ecx
movl %ebp, %r8d
callq 0x46f49
xorps %xmm2, %xmm2
jmp 0x440a7
movss -0x98(%r13,%rbp,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x44159
jp 0x44159
cmpq $0x12, %r12
je 0x43fa3
movss -0x5a4(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss %xmm2, %xmm0
jne 0x440c8
jnp 0x440e3
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x46f49
jmp 0x43fa3
movss (%r13,%rbp,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x440f5
jnp 0x43fa3
ucomiss %xmm2, %xmm0
jne 0x440c8
jp 0x440c8
movss (%r13,%rbp,4), %xmm0
cmpneqss %xmm2, %xmm0
movd %xmm0, %r9d
jmp 0x440c8
ucomiss %xmm2, %xmm0
jne 0x44028
jp 0x44028
movss -0x48(%r13,%rbp,4), %xmm0
cmpneqss %xmm2, %xmm0
movd %xmm0, %r9d
jmp 0x44028
ucomiss %xmm2, %xmm0
jne 0x43fdb
jp 0x43fdb
movss -0x50(%r13,%rbp,4), %xmm0
cmpneqss %xmm2, %xmm0
movd %xmm0, %r9d
jmp 0x43fdb
ucomiss %xmm2, %xmm0
jne 0x44074
jp 0x44074
movss -0x98(%r13,%rbp,4), %xmm0
cmpneqss %xmm2, %xmm0
movd %xmm0, %r9d
jmp 0x44074
addq $0x4c, %r13
movq 0x8(%rsp), %rax
movq %rax, %r12
cmpq $0x13, %rax
jne 0x43f6b
movq %r14, %rax
addq $0x5b8, %rsp            # imm = 0x5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq