// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: expand
mcts_tree *expand(float *next, float *ko, network *net)
{
    mcts_tree *root = calloc(1, sizeof(mcts_tree));
    root->board = next;
    root->children = calloc(19*19+1, sizeof(mcts_tree*));
    root->prior = calloc(19*19 + 1, sizeof(float));
    root->prob = calloc(19*19 + 1, sizeof(float));
    root->mean = calloc(19*19 + 1, sizeof(float));
    root->value = calloc(19*19 + 1, sizeof(float));
    root->visit_count = calloc(19*19 + 1, sizeof(int));
    root->total_count = 1;
    int i;
    float *pred = network_predict_rotations(net, next);
    copy_cpu(19*19+1, pred, 1, root->prior, 1);
    float val = 2*pred[19*19 + 1] - 1;
    root->result = val;
    for(i = 0; i < 19*19+1; ++i) {
        root->visit_count[i] = 0;
        root->value[i] = 0;
        root->mean[i] = val;
        if(i < 19*19 && occupied(next, i)){
            root->value[i] = -1;
            root->mean[i] = -1;
            root->prior[i] = 0;
        }
    }
    //print_board(stderr, next, flip?-1:1, 0);
    return root;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, %edi
movl $0x48, %esi
callq 0x3220
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x8, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x59f00
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movl $0x16a, %edi            # imm = 0x16A
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x30(%rbp), %rax
movss 0x5a8(%rax), %xmm0
addss %xmm0, %xmm0
movss 0x19e3b(%rip), %xmm1    # 0x740dc
addss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x3c(%rax)
movl $0x0, -0x24(%rbp)
cmpl $0x16a, -0x24(%rbp)     # imm = 0x16A
jge 0x5a379
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movss -0x34(%rbp), %xmm0
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
cmpl $0x169, -0x24(%rbp)     # imm = 0x169
jge 0x5a369
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x58d60
cmpl $0x0, %eax
je 0x5a369
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movss 0x19da5(%rip), %xmm0    # 0x740dc
movss %xmm0, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
movss 0x19d8c(%rip), %xmm0    # 0x740dc
movss %xmm0, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x5a36b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5a2bf
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)