// File: /workspace/github_c_makefile_star2_O2/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, %r13
pushq $0x4
popq %rsi
movl $0x169, %edi            # imm = 0x169
callq 0x3250
movq %rax, %r14
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
movq %r13, %rbx
cmpq $0x13, %r12
je 0x3a724
leaq 0x1(%r12), %rax
movq %rax, 0x8(%rsp)
leal -0x1(%r12), %eax
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
cmpq $0x13, %rbp
je 0x3a716
movl $0x5a4, %edx            # imm = 0x5A4
movq %r15, %rdi
xorl %esi, %esi
callq 0x31c0
movss (%rbx,%rbp,4), %xmm0
ucomiss 0x11ab3(%rip), %xmm0    # 0x4c078
jne 0x3a5c9
jnp 0x3a5ce
incq %rbp
jmp 0x3a5a0
movss 0x5a4(%rbx,%rbp,4), %xmm0
ucomiss 0x11a9a(%rip), %xmm0    # 0x4c078
jne 0x3a5c9
jp 0x3a5c9
testq %rbp, %rbp
je 0x3a631
movss -0x4(%rbx,%rbp,4), %xmm0
ucomiss 0x11a84(%rip), %xmm0    # 0x4c078
pushq $0x1
popq %r9
jne 0x3a5fc
jnp 0x3a613
leal -0x1(%rbp), %r8d
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x3d2f7
jmp 0x3a62b
movss 0x5a0(%rbx,%rbp,4), %xmm0
ucomiss 0x11a55(%rip), %xmm0    # 0x4c078
pushq $-0x1
popq %r9
jne 0x3a5fc
jp 0x3a5fc
cmpq $0x12, %rbp
je 0x3a675
movss 0x4(%rbx,%rbp,4), %xmm0
ucomiss 0x11a3a(%rip), %xmm0    # 0x4c078
pushq $0x1
popq %r9
jne 0x3a646
jnp 0x3a65d
leal 0x1(%rbp), %r8d
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x3d2f7
jmp 0x3a675
movss 0x5a8(%rbx,%rbp,4), %xmm0
ucomiss 0x11a0b(%rip), %xmm0    # 0x4c078
pushq $-0x1
popq %r9
jne 0x3a646
jp 0x3a646
testq %r12, %r12
je 0x3a6c8
movss -0x4c(%rbx,%rbp,4), %xmm0
ucomiss 0x119f1(%rip), %xmm0    # 0x4c078
pushq $0x1
popq %r9
jne 0x3a68f
jnp 0x3a6a6
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl 0x4(%rsp), %ecx
movl %ebp, %r8d
callq 0x3d2f7
jmp 0x3a6be
movss 0x558(%rbx,%rbp,4), %xmm0
ucomiss 0x119c2(%rip), %xmm0    # 0x4c078
pushq $-0x1
popq %r9
jne 0x3a68f
jp 0x3a68f
cmpq $0x12, %r12
je 0x3a5c9
movss 0x4c(%rbx,%rbp,4), %xmm0
ucomiss 0x119a3(%rip), %xmm0    # 0x4c078
pushq $0x1
popq %r9
jne 0x3a6dd
jnp 0x3a6f8
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x3d2f7
jmp 0x3a5c9
movss 0x5f0(%rbx,%rbp,4), %xmm0
ucomiss 0x11970(%rip), %xmm0    # 0x4c078
pushq $-0x1
popq %r9
jne 0x3a6dd
jnp 0x3a5c9
jmp 0x3a6dd
addq $0x4c, %rbx
movq 0x8(%rsp), %r12
jmp 0x3a581
movq %r14, %rax
addq $0x5b8, %rsp            # imm = 0x5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq