// File: /workspace/github_c_makefile_star2_O3/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 0x3250
movq %rax, %r14
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
leaq 0x1(%r12), %rax
movq %rax, 0x8(%rsp)
imulq $0x4c, %r12, %r13
addq %rbx, %r13
leal -0x1(%r12), %eax
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
movl $0x5a4, %edx            # imm = 0x5A4
movq %r15, %rdi
xorl %esi, %esi
callq 0x31c0
movss (%r13,%rbp,4), %xmm0
ucomiss 0xee37(%rip), %xmm0     # 0x550a0
jne 0x4626d
jnp 0x4627b
incq %rbp
cmpq $0x13, %rbp
jne 0x4624c
jmp 0x46411
movss 0x5a4(%r13,%rbp,4), %xmm0
ucomiss 0xee14(%rip), %xmm0     # 0x550a0
jne 0x4626d
jp 0x4626d
testq %rbp, %rbp
je 0x462e7
movss -0x4(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss 0xedf7(%rip), %xmm0     # 0x550a0
jne 0x462ad
jnp 0x462c4
leal -0x1(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x49254
jmp 0x462e1
movss 0x5a0(%r13,%rbp,4), %xmm0
ucomiss 0xedcb(%rip), %xmm0     # 0x550a0
jne 0x463fb
jp 0x463fb
cmpq $0x12, %rbp
je 0x46333
movss 0x4(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss 0xeda5(%rip), %xmm0     # 0x550a0
jne 0x462ff
jnp 0x46316
leal 0x1(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x49254
jmp 0x46333
movss 0x5a8(%r13,%rbp,4), %xmm0
ucomiss 0xed79(%rip), %xmm0     # 0x550a0
jne 0x463f0
jp 0x463f0
testq %r12, %r12
je 0x4639c
movss -0x4c(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss 0xed54(%rip), %xmm0     # 0x550a0
jne 0x46350
jnp 0x46367
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl 0x4(%rsp), %ecx
movl %ebp, %r8d
callq 0x49254
jmp 0x46384
movss 0x558(%r13,%rbp,4), %xmm0
ucomiss 0xed28(%rip), %xmm0     # 0x550a0
jne 0x46406
jp 0x46406
cmpq $0x12, %r12
jne 0x4639c
incq %rbp
cmpq $0x13, %rbp
jne 0x4624c
jmp 0x46423
movss 0x4c(%r13,%rbp,4), %xmm0
movl $0x1, %r9d
ucomiss 0xecf0(%rip), %xmm0     # 0x550a0
jne 0x463b4
jnp 0x463cf
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x49254
jmp 0x4626d
movss 0x5f0(%r13,%rbp,4), %xmm0
ucomiss 0xecc0(%rip), %xmm0     # 0x550a0
jne 0x463e8
jnp 0x4626d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jmp 0x463b4
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jmp 0x462ff
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jmp 0x462ad
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jmp 0x46350
movq 0x8(%rsp), %rax
movq %rax, %r12
cmpq $0x13, %rax
jne 0x46230
movq %r14, %rax
addq $0x5b8, %rsp            # imm = 0x5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq