LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/tag.c
// Function: run_tag
void run_tag(int argc, char **argv)
{
    if(argc < 4){
        fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
        return;
    }

    int clear = find_arg(argc, argv, "-clear");
    char *cfg = argv[3];
    char *weights = (argc > 4) ? argv[4] : 0;
    char *filename = (argc > 5) ? argv[5] : 0;
    if(0==strcmp(argv[2], "train")) train_tag(cfg, weights, clear);
    else if(0==strcmp(argv[2], "test")) test_tag(cfg, weights, filename);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
cmpl $0x3, %edi
jle 0x4462d
movl %edi, %r15d
leaq 0x15b9c(%rip), %rdx     # 0x5a155
movq %r14, %rsi
callq 0xeca2
movl %eax, %ebp
cmpl $0x4, %r15d
jne 0x445cd
xorl %ebx, %ebx
jmp 0x445dd
movq 0x20(%r14), %rbx
cmpl $0x6, %r15d
jb 0x445dd
movq 0x28(%r14), %r15
jmp 0x445e0
xorl %r15d, %r15d
movq 0x18(%r14), %r12
movq 0x10(%r14), %r14
leaq 0x15e25(%rip), %rsi     # 0x5a414
movq %r14, %rdi
callq 0x3260
testl %eax, %eax
je 0x44637
leaq 0x16c53(%rip), %rsi     # 0x5b255
movq %r14, %rdi
callq 0x3260
testl %eax, %eax
je 0x44617
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x443a0
movq %r14, %rdi
callq 0x97d3
jmp 0x4460e
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x926b
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/cifar.c
// Function: test_cifar_multi
void test_cifar_multi(char *filename, char *weightfile)
{
    network *net = load_network(filename, weightfile, 0);
    set_batch_network(net, 1);
    srand(time(0));

    float avg_acc = 0;
    data test = load_cifar10_data("data/cifar/cifar-10-batches-bin/test_batch.bin");

    int i;
    for(i = 0; i < test.X.rows; ++i){
        image im = float_to_image(32, 32, 3, test.X.vals[i]);

        float pred[10] = {0};

        float *p = network_predict(net, im.data);
        axpy_cpu(10, 1, p, 1, pred, 1);
        flip_image(im);
        p = network_predict(net, im.data);
        axpy_cpu(10, 1, p, 1, pred, 1);

        int index = max_index(pred, 10);
        int class = max_index(test.y.vals[i], 10);
        if(index == class) avg_acc += 1;
        free_image(im);
        printf("%4d: %.2f%%\n", i, 100.*avg_acc/(i+1));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorl %edx, %edx
callq 0x316bc
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0x320a7
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
leaq 0x15540(%rip), %rsi     # 0x5a31b
leaq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x30336
cmpl $0x0, 0x8(%r14)
jle 0x44f52
xorpd %xmm0, %xmm0
movss %xmm0, 0x24(%rsp)
xorl %r15d, %r15d
leaq 0x28(%rsp), %r14
leaq 0x40(%rsp), %r12
leaq 0x15539(%rip), %r13     # 0x5a34a
movq 0x78(%rsp), %rax
movq (%rax,%r15,8), %r8
movq %r14, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x3, %ecx
callq 0x170ea
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x32690
movl $0xa, %edi
movss 0x101a4(%rip), %xmm0    # 0x55008
movq %rax, %rsi
movl $0x1, %edx
movq %r12, %rcx
movl $0x1, %r8d
callq 0x29d31
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1786a
movq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x32690
movl $0xa, %edi
movss 0x1015c(%rip), %xmm0    # 0x55008
movq %rax, %rsi
movl $0x1, %edx
movq %r12, %rcx
movl $0x1, %r8d
callq 0x29d31
movq %r12, %rdi
movl $0xa, %esi
callq 0xfa87
movl %eax, %ebp
movq 0x88(%rsp), %rax
movq (%rax,%r15,8), %rdi
movl $0xa, %esi
callq 0xfa87
cmpl %eax, %ebp
jne 0x44eff
movss 0x24(%rsp), %xmm0
addss 0x1010f(%rip), %xmm0    # 0x55008
movss %xmm0, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
xorps %xmm0, %xmm0
cvtss2sd 0x24(%rsp), %xmm0
mulsd 0x153c0(%rip), %xmm0    # 0x5a2e8
leaq 0x1(%r15), %rbp
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
movq %r13, %rdi
movl %r15d, %esi
movb $0x1, %al
callq 0x3160
movslq 0x70(%rsp), %rax
movq %rbp, %r15
cmpq %rax, %rbp
jl 0x44e11
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/cifar.c
// Function: test_cifar
void test_cifar(char *filename, char *weightfile)
{
    network *net = load_network(filename, weightfile, 0);
    srand(time(0));

    clock_t time;
    float avg_acc = 0;
    float avg_top5 = 0;
    data test = load_cifar10_data("data/cifar/cifar-10-batches-bin/test_batch.bin");

    time=clock();

    float *acc = network_accuracies(net, test, 2);
    avg_acc += acc[0];
    avg_top5 += acc[1];
    printf("top1: %f, %lf seconds, %d images\n", avg_acc, sec(clock()-time), test.X.rows);
    free_data(test);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
xorl %edx, %edx
callq 0x316bc
movq %rax, %r14
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
leaq 0x1538c(%rip), %rsi     # 0x5a31b
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x30336
callq 0x3120
movq %rax, %r15
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r14, %rdi
movl $0x2, %esi
callq 0x33345
xorps %xmm0, %xmm0
addss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
callq 0x3120
subq %r15, %rax
movq %rax, %rdi
callq 0xf0bf
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movl 0x8(%rbx), %esi
leaq 0x15352(%rip), %rdi     # 0x5a357
movsd 0x48(%rsp), %xmm0
movb $0x2, %al
callq 0x3160
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x2d296
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/cifar.c
// Function: extract_cifar
void extract_cifar()
{
char *labels[] = {"airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"};
    int i;
    data train = load_all_cifar10();
    data test = load_cifar10_data("data/cifar/cifar-10-batches-bin/test_batch.bin");
    for(i = 0; i < train.X.rows; ++i){
        image im = float_to_image(32, 32, 3, train.X.vals[i]);
        int class = max_index(train.y.vals[i], 10);
        char buff[256];
        sprintf(buff, "data/cifar/train/%d_%s",i,labels[class]);
        save_image_options(im, buff, PNG, 0);
    }
    for(i = 0; i < test.X.rows; ++i){
        image im = float_to_image(32, 32, 3, test.X.vals[i]);
        int class = max_index(test.y.vals[i], 10);
        char buff[256];
        sprintf(buff, "data/cifar/test/%d_%s",i,labels[class]);
        save_image_options(im, buff, PNG, 0);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30679
leaq 0x152af(%rip), %rsi     # 0x5a31b
leaq 0x30(%rsp), %rdi
callq 0x30336
cmpl $0x0, 0x8(%rbx)
jle 0x4511a
leaq 0x18(%rsp), %rbx
leaq 0x26cf4(%rip), %r13     # 0x6bd80
leaq 0x1531e(%rip), %r14     # 0x5a3b1
leaq 0xb0(%rsp), %r15
xorl %r12d, %r12d
movq 0x80(%rsp), %rax
movq (%rax,%r12,8), %r8
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x3, %ecx
callq 0x170ea
movq 0x90(%rsp), %rax
movq (%rax,%r12,8), %rdi
movl $0xa, %esi
callq 0xfa87
cltq
movq (%r13,%rax,8), %rcx
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x3420
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x18310
incq %r12
movslq 0x78(%rsp), %rax
cmpq %rax, %r12
jl 0x4509e
cmpl $0x0, 0x38(%rsp)
jle 0x451b9
leaq 0x18(%rsp), %rbx
leaq 0x26c4f(%rip), %r13     # 0x6bd80
leaq 0x15290(%rip), %r14     # 0x5a3c8
leaq 0xb0(%rsp), %r15
xorl %r12d, %r12d
movq 0x40(%rsp), %rax
movq (%rax,%r12,8), %r8
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x3, %ecx
callq 0x170ea
movq 0x50(%rsp), %rax
movq (%rax,%r12,8), %rdi
movl $0xa, %esi
callq 0xfa87
cltq
movq (%r13,%rax,8), %rcx
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x3420
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x18310
incq %r12
movslq 0x38(%rsp), %rax
cmpq %rax, %r12
jl 0x45143
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/cifar.c
// Function: run_cifar
void run_cifar(int argc, char **argv)
{
    if(argc < 4){
        fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
        return;
    }

    char *cfg = argv[3];
    char *weights = (argc > 4) ? argv[4] : 0;
    if(0==strcmp(argv[2], "train")) train_cifar(cfg, weights);
    else if(0==strcmp(argv[2], "extract")) extract_cifar();
    else if(0==strcmp(argv[2], "distill")) train_cifar_distill(cfg, weights);
    else if(0==strcmp(argv[2], "test")) test_cifar(cfg, weights);
    else if(0==strcmp(argv[2], "multi")) test_cifar_multi(cfg, weights);
    else if(0==strcmp(argv[2], "csv")) test_cifar_csv(cfg, weights);
    else if(0==strcmp(argv[2], "csvtrain")) test_cifar_csvtrain(cfg, weights);
    else if(0==strcmp(argv[2], "eval")) eval_cifar_csv();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x3, %edi
jle 0x452e5
cmpl $0x4, %edi
jne 0x451e1
xorl %ebx, %ebx
jmp 0x451e5
movq 0x20(%rsi), %rbx
movq 0x18(%rsi), %r14
movq 0x10(%rsi), %r15
leaq 0x15220(%rip), %rsi     # 0x5a414
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x452ab
leaq 0x151f6(%rip), %rsi     # 0x5a401
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x452bb
leaq 0x151e7(%rip), %rsi     # 0x5a409
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x452c5
leaq 0x1601c(%rip), %rsi     # 0x5b255
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x452d5
leaq 0x157cb(%rip), %rsi     # 0x5aa1b
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x452f3
leaq 0x15196(%rip), %rsi     # 0x5a3fd
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x45303
leaq 0x15193(%rip), %rsi     # 0x5a411
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
je 0x45313
leaq 0x15185(%rip), %rsi     # 0x5a41a
movq %r15, %rdi
callq 0x3260
testl %eax, %eax
jne 0x452ed
popq %rbx
popq %r14
popq %r15
jmp 0x9b88
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x4464c
popq %rbx
popq %r14
popq %r15
jmp 0x45046
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x449cb
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x44f64
movq %rsi, %rdi
callq 0x9c50
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x44d9e
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x97f5
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x99c1
nop
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: fgetgo
char *fgetgo(FILE *fp)
{
    if(feof(fp)) return 0;
    size_t size = 96;
    char *line = malloc(size*sizeof(char));
    if(size != fread(line, sizeof(char), size, fp)){
        free(line);
        return 0;
    }

    return line;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x3290
testl %eax, %eax
jne 0x45364
movl $0x60, %edi
callq 0x3300
movq %rax, %rbx
movl $0x1, %esi
movl $0x60, %edx
movq %rax, %rdi
movq %r14, %rcx
callq 0x30d0
cmpq $0x60, %rax
je 0x45366
movq %rbx, %rdi
callq 0x3040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: load_go_moves
moves load_go_moves(char *filename)
{
    moves m;
    m.n = 128;
    m.data = calloc(128, sizeof(char*));
    FILE *fp = fopen(filename, "rb");
    int count = 0;
    char *line = 0;
    while ((line = fgetgo(fp))) {
        if (count >= m.n) {
            m.n *= 2;
            m.data = realloc(m.data, m.n*sizeof(char*));
        }
        m.data[count] = line;
        ++count;
    }
    printf("%d\n", count);
    m.n = count;
    m.data = realloc(m.data, count*sizeof(char*));
    return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movl $0x80, %edi
movl $0x8, %esi
callq 0x3250
movq %rax, %rbx
leaq 0xfd43(%rip), %rsi      # 0x550d8
movq %r14, %rdi
callq 0x3390
movq %rax, %r15
movq %rax, %rdi
callq 0x45324
testq %rax, %rax
je 0x453ed
movq %rax, %r12
movl $0x80, %ebp
xorl %r14d, %r14d
movslq %ebp, %rax
cmpq %rax, %r14
jl 0x453d4
addl %ebp, %ebp
movslq %ebp, %rsi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x3350
movq %rax, %rbx
movq %r12, (%rbx,%r14,8)
incq %r14
movq %r15, %rdi
callq 0x45324
movq %rax, %r12
testq %rax, %rax
jne 0x453b8
jmp 0x453f0
xorl %r14d, %r14d
leaq 0x151a2(%rip), %rdi     # 0x5a599
movl %r14d, %esi
xorl %eax, %eax
callq 0x3160
movl %r14d, %esi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x3350
movl %r14d, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: string_to_board
void string_to_board(char *s, float *board)
{
    int i, j;
    memset(board, 0, 2*19*19*sizeof(float));
    int count = 0;
    for(i = 0; i < 91; ++i){
        char c = s[i];
        for(j = 0; j < 4; ++j){
            int me = (c >> (2*j)) & 1;
            int you = (c >> (2*j + 1)) & 1;
            if (me) board[count] = 1;
            else if (you) board[count + 19*19] = 1;
            ++count;
            if(count >= 19*19) break;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movl $0xb48, %edx            # imm = 0xB48
movq %rsi, %rdi
xorl %esi, %esi
callq 0x31c0
leaq 0x5a4(%rbx), %rax
xorl %r8d, %r8d
movsbl (%r14,%r15), %edx
movslq %r8d, %rdi
xorl %ecx, %ecx
xorl %esi, %esi
btl %ecx, %edx
movq %rbx, %r8
jb 0x45466
movl %edx, %r9d
shrl %cl, %r9d
movq %rax, %r8
testb $0x2, %r9b
je 0x4546e
movl $0x3f800000, (%r8,%rdi,4) # imm = 0x3F800000
leaq 0x1(%rdi), %r8
cmpq $0x167, %rdi            # imm = 0x167
jg 0x4548d
leal 0x1(%rsi), %r9d
addl $0x2, %ecx
movq %r8, %rdi
cmpl $0x3, %esi
movl %r9d, %esi
jb 0x4544f
incq %r15
cmpq $0x5b, %r15
jne 0x45443
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: board_to_string
void board_to_string(char *s, float *board)
{
    int i, j;
    memset(s, 0, (19*19/4+1)*sizeof(char));
    int count = 0;
    for(i = 0; i < 91; ++i){
        for(j = 0; j < 4; ++j){
            int me = (board[count] == 1);
            int you = (board[count + 19*19] == 1);
            if (me) s[i] = s[i] | (1<<(2*j));
            if (you) s[i] = s[i] | (1<<(2*j + 1));
            ++count;
            if(count >= 19*19) break;
        }
    }
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x4b(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
xorl %eax, %eax
movss 0xfb48(%rip), %xmm0     # 0x55008
xorl %edx, %edx
movslq %edx, %rdx
leaq (%rsi,%rdx,4), %r8
xorl %ecx, %ecx
xorl %r9d, %r9d
movss (%r8,%r9,4), %xmm1
ucomiss %xmm0, %xmm1
movss 0x5a4(%r8,%r9,4), %xmm1
jne 0x454f2
jp 0x454f2
movl $0x1, %r10d
shll %cl, %r10d
orb %r10b, (%rdi,%rax)
ucomiss %xmm0, %xmm1
jne 0x45506
jp 0x45506
movl $0x2, %r10d
shll %cl, %r10d
orb %r10b, (%rdi,%rax)
leaq (%rdx,%r9), %r11
leaq 0x1(%r9), %r10
cmpq $0x167, %r11            # imm = 0x167
jg 0x45523
addl $0x2, %ecx
cmpl $0x3, %r9d
movq %r10, %r9
jb 0x454ce
incq %rax
addq %r10, %rdx
cmpq $0x5b, %rax
jne 0x454c2
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: flip_board
void flip_board(float *board)
{
    int i;
    for(i = 0; i < 19*19; ++i){
        float swap = board[i];
        board[i] = board[i+19*19];
        board[i+19*19] = swap;
        board[i+19*19*2] = 1-board[i+19*19*2];
    }
}

// Assembly:
movq $-0x169, %rax           # imm = 0xFE97
movss 0xf0eb(%rip), %xmm0     # 0x55008
movss 0x5a4(%rdi,%rax,4), %xmm1
movss 0xb48(%rdi,%rax,4), %xmm2
movss %xmm2, 0x5a4(%rdi,%rax,4)
movss %xmm1, 0xb48(%rdi,%rax,4)
movaps %xmm0, %xmm1
subss 0x10ec(%rdi,%rax,4), %xmm1
movss %xmm1, 0x10ec(%rdi,%rax,4)
incq %rax
jne 0x45f1d
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: move_go
void move_go(float *b, int p, int r, int c)
{
    int *l = calculate_liberties(b);
    if(p > 0) b[r*19 + c] = 1;
    else b[19*19 + r*19 + c] = 1;
    remove_connected(b, l, -p, r+1, c);
    remove_connected(b, l, -p, r-1, c);
    remove_connected(b, l, -p, r, c+1);
    remove_connected(b, l, -p, r, c-1);
    free(l);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r12
callq 0x46202
movq %rax, %r15
testl %ebp, %ebp
leal (%r14,%r14,8), %eax
leal (%r14,%rax,2), %ecx
leal 0x169(%r14,%rax,2), %eax
cmovgl %ecx, %eax
addl %ebx, %eax
cltq
movl $0x3f800000, (%r12,%rax,4) # imm = 0x3F800000
negl %ebp
leal 0x1(%r14), %ecx
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %ebx, %r8d
callq 0x46438
leal -0x1(%r14), %ecx
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %ebx, %r8d
callq 0x46438
leal 0x1(%rbx), %r8d
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x46438
decl %ebx
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x46438
movq %r15, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: remove_connected
static void remove_connected(float *b, int *lib, int p, int r, int c)
{
    if (r < 0 || r >= 19 || c < 0 || c >= 19) return;
    if (occupied(b, r*19 + c) != p) return;
    if (lib[r*19 + c] != 1) return;
    b[r*19 + c] = 0;
    b[19*19 + r*19 + c] = 0;
    remove_connected(b, lib, p, r+1, c);
    remove_connected(b, lib, p, r-1, c);
    remove_connected(b, lib, p, r, c+1);
    remove_connected(b, lib, p, r, c-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
cmpl $0x13, %ecx
setae %al
cmpl $0x13, %r8d
setae %cl
orb %al, %cl
jne 0x46516
movl %r8d, %ebx
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
leal (%r14,%r14,8), %eax
leal (%r14,%rax,2), %eax
leal 0x1(%r14), %ecx
movl %ecx, 0x4(%rsp)
leal -0x1(%r14), %ecx
movl %ecx, (%rsp)
addl %r8d, %eax
movl %eax, %r13d
movss (%r12,%r13,4), %xmm0
movl $0x1, %eax
ucomiss 0xec0b(%rip), %xmm0     # 0x550a0
jne 0x464b0
jp 0x464b0
movss 0x5a4(%r12,%r13,4), %xmm0
cmpneqss 0xebf4(%rip), %xmm0     # 0x550a0
movd %xmm0, %eax
cmpl %ebp, %eax
jne 0x46516
cmpl $0x1, (%r15,%r13,4)
jne 0x46516
xorl %ecx, %ecx
movl %ecx, (%r12,%r13,4)
leal 0x169(%r13), %eax
movl %ecx, (%r12,%rax,4)
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl 0x4(%rsp), %ecx
movl %ebx, %r8d
callq 0x46438
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl (%rsp), %ecx
movl %ebx, %r8d
callq 0x46438
leal 0x1(%rbx), %r8d
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x46438
leal -0x1(%r13), %eax
decl %ebx
cmpl $0x13, %ebx
jb 0x46480
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: free_mcts
void free_mcts(mcts_tree *root)
{
    if(!root) return;
    int i;
    free(root->board);
    for(i = 0; i < 19*19+1; ++i){
        if(root->children[i]) free_mcts(root->children[i]);
    }
    free(root->children);
    free(root->prior);
    free(root->visit_count);
    free(root->value);
    free(root->mean);
    free(root->prob);
    free(root);
}

// Assembly:
testq %rdi, %rdi
je 0x465b5
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x3040
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x46564
callq 0x4653b
incq %r14
cmpq $0x16a, %r14            # imm = 0x16A
jne 0x46552
movq 0x8(%rbx), %rdi
callq 0x3040
movq 0x10(%rbx), %rdi
callq 0x3040
movq 0x18(%rbx), %rdi
callq 0x3040
movq 0x20(%rbx), %rdi
callq 0x3040
movq 0x28(%rbx), %rdi
callq 0x3040
movq 0x30(%rbx), %rdi
callq 0x3040
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3040
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rdi, %rbx
movl $0x1, %edi
movl $0x48, %esi
callq 0x3250
movq %rax, %r14
movq %rbx, (%rax)
movl $0x16a, %edi            # imm = 0x16A
movl $0x8, %esi
callq 0x3250
movq %rax, 0x8(%r14)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3250
movq %rax, %r15
movq %rax, 0x10(%r14)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3250
movq %rax, 0x30(%r14)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3250
movq %rax, %r12
movq %rax, 0x28(%r14)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3250
movq %rax, %r13
movq %rax, 0x20(%r14)
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3250
movq %rax, %rbp
movq %rax, 0x18(%r14)
movl $0x1, 0x38(%r14)
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x465b6
movq %rax, (%rsp)
movl $0x16a, %edi            # imm = 0x16A
movq %rax, %rsi
movl $0x1, %edx
movq %r15, %rcx
movl $0x1, %r8d
callq 0x29fe0
movq (%rsp), %rax
movss 0x5a8(%rax), %xmm0
addss %xmm0, %xmm0
addss 0xe99e(%rip), %xmm0     # 0x55294
movss %xmm0, 0x3c(%r14)
xorl %eax, %eax
movl %eax, (%rbp)
movl %eax, (%r13)
movss %xmm0, (%r12)
xorps %xmm1, %xmm1
movl $0xbf800000, %ecx       # imm = 0xBF800000
xorl %edx, %edx
movss (%rbx,%rdx), %xmm2
ucomiss %xmm1, %xmm2
jne 0x46921
jnp 0x46934
movl %ecx, (%r13,%rdx)
movl %ecx, (%r12,%rdx)
movl $0x0, (%r15,%rdx)
jmp 0x46944
movss 0x5a4(%rbx,%rdx), %xmm2
ucomiss %xmm1, %xmm2
jne 0x46921
jp 0x46921
movl %eax, 0x4(%rbp,%rdx)
movl %eax, 0x4(%r13,%rdx)
movss %xmm0, 0x4(%r12,%rdx)
addq $0x4, %rdx
cmpq $0x5a4, %rdx            # imm = 0x5A4
jne 0x46915
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: legal_go
int legal_go(float *b, float *ko, int p, int r, int c)
{
    if (occupied(b, r*19+c)) return 0;
    float curr[19*19*3];
    copy_cpu(19*19*3, b, 1, curr, 1);
    move_go(curr, p, r, c);
    if(check_ko(curr, ko)) return 0;
    if(suicide_go(b, p, r, c)) return 0;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10f8, %rsp           # imm = 0x10F8
movl %ecx, %r14d
leal (%r14,%r14,8), %eax
leal (%r14,%rax,2), %eax
addl %r8d, %eax
movslq %eax, %rcx
movss (%rdi,%rcx,4), %xmm1
xorl %eax, %eax
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x46cc7
jnp 0x46cd9
addq $0x10f8, %rsp           # imm = 0x10F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r15
movss 0x5a4(%rdi,%rcx,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x46cc7
jp 0x46cc7
movl %r8d, %ebx
movl %edx, %ebp
movq %rsi, %r12
movq %rsp, %r13
movl $0x43b, %edi            # imm = 0x43B
movq %r15, %rsi
movl $0x1, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0x29fe0
movq %r13, %rdi
movl %ebp, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x46164
movq %r13, %rdi
movq %r12, %rsi
callq 0x47073
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x46cc7
movq %r15, %rdi
movl %ebp, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x46f67
xorl $0x1, %eax
jmp 0x46cc7
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: run_mcts
mcts_tree *run_mcts(mcts_tree *tree, network *net, float *board, float *ko, int player, int n, float cpuct, float secs)
{
    int i;
    double t = what_time_is_it_now();
    if(player < 0) flip_board(board);
    if(!tree) tree = expand(copy_board(board), ko, net);
    assert(compare_board(tree->board, board));
    for(i = 0; i < n; ++i){
        if (secs > 0 && (what_time_is_it_now() - t) > secs) break;
        int max_i = max_int_index(tree->visit_count, 19*19+1);
        if (tree->visit_count[max_i] >= n) break;
        select_mcts(tree, net, ko, cpuct);
    }
    if(player < 0) flip_board(board);
    //fprintf(stderr, "%f Seconds\n", what_time_is_it_now() - t);
    return tree;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movss %xmm1, 0xc(%rsp)
movss %xmm0, 0x14(%rsp)
movl %r9d, %ebp
movl %r8d, %r14d
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
xorl %eax, %eax
callq 0xe79c
movsd %xmm0, 0x20(%rsp)
movl %r14d, 0x10(%rsp)
testl %r14d, %r14d
jns 0x46ddc
movq $-0x5a4, %rax           # imm = 0xFA5C
movss 0xe26b(%rip), %xmm0     # 0x55008
movss 0x5a4(%rbx,%rax), %xmm1
movss 0xb48(%rbx,%rax), %xmm2
movss %xmm2, 0x5a4(%rbx,%rax)
movss %xmm1, 0xb48(%rbx,%rax)
movaps %xmm0, %xmm1
subss 0x10ec(%rbx,%rax), %xmm1
movss %xmm1, 0x10ec(%rbx,%rax)
addq $0x4, %rax
jne 0x46d9d
testq %r12, %r12
jne 0x46e1c
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3250
movq %rax, %r12
movl $0x43b, %edi            # imm = 0x43B
movq %rbx, %rsi
movl $0x1, %edx
movq %rax, %rcx
movl $0x1, %r8d
callq 0x29fe0
movq %r12, %rdi
movq %r13, %rdx
callq 0x46806
movq %rax, %r12
movq (%r12), %rdi
movl $0x10ec, %edx           # imm = 0x10EC
movq %rbx, %rsi
callq 0x3330
testl %eax, %eax
jne 0x46f0a
testl %ebp, %ebp
jle 0x46ea3
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl %ebp, %r14d
movss 0xc(%rsp), %xmm0
ucomiss 0xe248(%rip), %xmm0     # 0x550a0
jbe 0x46e6f
xorl %eax, %eax
callq 0xe79c
subsd 0x20(%rsp), %xmm0
ucomisd 0x18(%rsp), %xmm0
ja 0x46ea3
movq 0x18(%r12), %rdi
movl $0x16a, %esi            # imm = 0x16A
callq 0xfa54
movq 0x18(%r12), %rcx
cltq
cmpl %ebp, (%rcx,%rax,4)
jge 0x46ea3
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movss 0x14(%rsp), %xmm0
callq 0x469b2
decl %r14d
jne 0x46e4b
cmpl $0x0, 0x10(%rsp)
jns 0x46ef8
movq $-0x5a4, %rax           # imm = 0xFA5C
movss 0xe14f(%rip), %xmm0     # 0x55008
movss 0x5a4(%rbx,%rax), %xmm1
movss 0xb48(%rbx,%rax), %xmm2
movss %xmm2, 0x5a4(%rbx,%rax)
movss %xmm1, 0xb48(%rbx,%rax)
movaps %xmm0, %xmm1
subss 0x10ec(%rbx,%rax), %xmm1
movss %xmm1, 0x10ec(%rbx,%rax)
addq $0x4, %rax
jne 0x46eb9
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x135b8(%rip), %rdi     # 0x5a4c9
leaq 0x135d3(%rip), %rsi     # 0x5a4eb
leaq 0x135d1(%rip), %rcx     # 0x5a4f0
movl $0x1f9, %edx            # imm = 0x1F9
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: move_mcts
mcts_tree *move_mcts(mcts_tree *tree, int index)
{
    if(index < 0 || index > 19*19 || !tree || !tree->children[index]) {
        free_mcts(tree);
        tree = 0;
    } else {
        mcts_tree *swap = tree;
        tree = tree->children[index];
        swap->children[index] = 0;
        free_mcts(swap);
    }
    return tree;
}

// Assembly:
pushq %rbx
cmpl $0x16a, %esi            # imm = 0x16A
setae %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x46f5b
movq 0x8(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x46f5b
movq $0x0, (%rax,%rcx,8)
callq 0x4653b
jmp 0x46f62
callq 0x4653b
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: suicide_go
int suicide_go(float *b, int p, int r, int c)
{
    int *l = calculate_liberties(b);
    int safe = 0;
    safe = safe || makes_safe_go(b, l, p, r+1, c);
    safe = safe || makes_safe_go(b, l, p, r-1, c);
    safe = safe || makes_safe_go(b, l, p, r, c+1);
    safe = safe || makes_safe_go(b, l, p, r, c-1);
    free(l);
    return !safe;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r12
callq 0x46202
movq %rax, %rbx
leal 0x1(%r15), %ecx
movq %r12, %rdi
movq %rax, %rsi
movl %ebp, %edx
movl %r14d, %r8d
callq 0x47007
xorl %r13d, %r13d
testl %eax, %eax
jne 0x46fed
leal -0x1(%r15), %ecx
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movl %r14d, %r8d
callq 0x47007
testl %eax, %eax
jne 0x46fed
leal 0x1(%r14), %r8d
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x47007
testl %eax, %eax
jne 0x46fed
decl %r14d
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0x47007
movl %eax, %r13d
xorl $0x1, %r13d
movq %rbx, %rdi
callq 0x3040
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: makes_safe_go
static int makes_safe_go(float *b, int *lib, int p, int r, int c){
    if (r < 0 || r >= 19 || c < 0 || c >= 19) return 0;
    if (occupied(b,r*19 + c) == -p){
        if (lib[r*19 + c] > 1) return 0;
        else return 1;
    }
    if (!occupied(b,r*19 + c)) return 1;
    if (lib[r*19 + c] > 1) return 1;
    return 0;
}

// Assembly:
cmpl $0x13, %ecx
setae %al
cmpl $0x13, %r8d
setae %r9b
orb %al, %r9b
je 0x4701e
xorl %ecx, %ecx
jmp 0x4706f
leal (%rcx,%rcx,8), %eax
leal (%rcx,%rax,2), %eax
addl %r8d, %eax
movss (%rdi,%rax,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x47036
jnp 0x47044
cmpl $-0x1, %edx
je 0x4705a
cmpl $0x2, (%rsi,%rax,4)
setge %cl
jmp 0x4706f
movss 0x5a4(%rdi,%rax,4), %xmm0
cmpneqss %xmm0, %xmm1
movd %xmm1, %ecx
addl %edx, %ecx
jne 0x47063
cmpl $0x2, (%rsi,%rax,4)
setl %cl
jmp 0x4706f
movb $0x1, %cl
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4703b
jp 0x4703b
movzbl %cl, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: check_ko
int check_ko(float *x, float *ko)
{
    if(!ko) return 0;
    float curr[19*19*3];
    copy_cpu(19*19*3, x, 1, curr, 1);
    if(curr[19*19*2] != ko[19*19*2]) flip_board(curr);
    if(compare_board(curr, ko)) return 1;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x10f8, %rsp           # imm = 0x10F8
movq %rsi, %rbx
testq %rsi, %rsi
je 0x47124
movq %rdi, %rsi
movq %rsp, %r14
movl $0x43b, %edi            # imm = 0x43B
movl $0x1, %edx
movq %r14, %rcx
movl $0x1, %r8d
callq 0x29fe0
movss 0xb48(%r14), %xmm0
ucomiss 0xb48(%rbx), %xmm0
jne 0x470bb
jnp 0x47109
movq $-0x5a4, %rax           # imm = 0xFA5C
movss 0xdf3e(%rip), %xmm0     # 0x55008
movss 0x5a4(%rsp,%rax), %xmm1
movss 0xb48(%rsp,%rax), %xmm2
movss %xmm2, 0x5a4(%rsp,%rax)
movss %xmm1, 0xb48(%rsp,%rax)
movaps %xmm0, %xmm1
subss 0x10ec(%rsp,%rax), %xmm1
movss %xmm1, 0x10ec(%rsp,%rax)
addq $0x4, %rax
jne 0x470ca
movq %rsp, %rdi
movl $0x10ec, %edx           # imm = 0x10EC
movq %rbx, %rsi
callq 0x3330
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
jmp 0x47126
xorl %eax, %eax
addq $0x10f8, %rsp           # imm = 0x10F8
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: print_game
int print_game(float *board, FILE *fp)
{
    int i, j;
    int count = 3;
    fprintf(fp, "komi 6.5\n");
    fprintf(fp, "boardsize 19\n");
    fprintf(fp, "clear_board\n");
    for(j = 0; j < 19; ++j){
        for(i = 0; i < 19; ++i){
            if(occupied(board,j*19 + i) == 1) fprintf(fp, "play black %c%d\n", 'A'+i+(i>=8), 19-j);
            if(occupied(board,j*19 + i) == -1) fprintf(fp, "play white %c%d\n", 'A'+i+(i>=8), 19-j);
            if(occupied(board,j*19 + i)) ++count;
        }
    }
    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1320a(%rip), %rdi     # 0x5a5ad
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3440
leaq 0x131fb(%rip), %rdi     # 0x5a5b7
movl $0xd, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3440
leaq 0x131f0(%rip), %rdi     # 0x5a5c5
movl $0xc, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3440
movl $0x3, %ebp
xorps %xmm2, %xmm2
leaq 0x131dc(%rip), %r15     # 0x5a5d2
xorl %eax, %eax
movl $0x13, %r13d
movq %rax, (%rsp)
subl %eax, %r13d
xorl %r12d, %r12d
movss (%r14,%r12,4), %xmm0
ucomiss %xmm2, %xmm0
jne 0x47415
jnp 0x4743b
cmpq $0x8, %r12
movl %r12d, %edx
sbbl $-0x1, %edx
addl $0x41, %edx
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x3270
xorps %xmm2, %xmm2
movss (%r14,%r12,4), %xmm0
ucomiss %xmm2, %xmm0
jne 0x4747d
jp 0x4747d
movss 0x5a4(%r14,%r12,4), %xmm1
ucomiss %xmm2, %xmm1
jne 0x47453
jnp 0x4747d
cmpq $0x8, %r12
movl %r12d, %edx
sbbl $-0x1, %edx
addl $0x41, %edx
movq %rbx, %rdi
leaq 0x13179(%rip), %rsi     # 0x5a5e3
movl %r13d, %ecx
xorl %eax, %eax
callq 0x3270
xorps %xmm2, %xmm2
movss (%r14,%r12,4), %xmm0
movl $0x1, %eax
ucomiss %xmm2, %xmm0
jne 0x4749f
jp 0x4749f
movss 0x5a4(%r14,%r12,4), %xmm0
cmpneqss %xmm2, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
addl %eax, %ebp
incq %r12
cmpq $0x13, %r12
jne 0x47408
movq (%rsp), %rax
incq %rax
addq $0x4c, %r14
cmpq $0x13, %rax
jne 0x473f8
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: stdin_ready
int stdin_ready()
{
    fd_set readfds;
    FD_ZERO(&readfds);

    struct timeval timeout;
    timeout.tv_sec = 0;
    timeout.tv_usec = 0;
    FD_SET(STDIN_FILENO, &readfds);

    if (select(1, &readfds, NULL, NULL, &timeout)){
        return 1;
    }
    return 0;
}

// Assembly:
subq $0x98, %rsp
xorps %xmm0, %xmm0
leaq 0x18(%rsp), %rsi
movups %xmm0, 0x68(%rsi)
movups %xmm0, 0x58(%rsi)
movups %xmm0, 0x48(%rsi)
movups %xmm0, 0x38(%rsi)
movups %xmm0, 0x28(%rsi)
movups %xmm0, 0x18(%rsi)
movups %xmm0, 0x8(%rsi)
movq $0x0, 0x78(%rsi)
movq %rsp, %r8
movaps %xmm0, (%r8)
movq $0x1, (%rsi)
movl $0x1, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x32d0
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x98, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: score_game
float score_game(float *board)
{
    int i;
    FILE *f = fopen("game.txt", "w");
    int count = print_game(board, f);
    fprintf(f, "final_score\n");
    fclose(f);
    FILE *p = popen("./gnugo --mode gtp < game.txt", "r");
    for(i = 0; i < count; ++i){
        free(fgetl(p));
        free(fgetl(p));
    }
    char *l = 0;
    float score = 0;
    char player = 0;
    while((l = fgetl(p))){
        fprintf(stderr, "%s  \t", l);
        int n = sscanf(l, "= %c+%f", &player, &score);
        free(l);
        if (n == 2) break;
    }
    if(player == 'W') score = -score;
    pclose(p);
    return score;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x11ed2(%rip), %rdi     # 0x5a90d
leaq 0x128e5(%rip), %rsi     # 0x5b327
callq 0x3390
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4738b
movl %eax, %ebp
leaq 0x11f74(%rip), %rdi     # 0x5a9d2
movl $0xc, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x3440
movq %r14, %rdi
callq 0x3130
leaq 0x11e79(%rip), %rdi     # 0x5a8f8
leaq 0x123a3(%rip), %rsi     # 0x5ae29
callq 0x3380
movq %rax, %rbx
testl %ebp, %ebp
jle 0x48ab6
movq %rbx, %rdi
callq 0xe948
movq %rax, %rdi
callq 0x3040
movq %rbx, %rdi
callq 0xe948
movq %rax, %rdi
callq 0x3040
decl %ebp
jne 0x48a92
leaq 0x4(%rsp), %r14
movl $0x0, (%r14)
leaq 0x3(%rsp), %r15
movb $0x0, (%r15)
movq %rbx, %rdi
callq 0xe948
testq %rax, %rax
je 0x48aea
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa3ea
testb $0x1, %al
je 0x48acb
cmpb $0x57, 0x3(%rsp)
jne 0x48b04
movss 0x4(%rsp), %xmm0
xorps 0xc592(%rip), %xmm0     # 0x55090
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x3170
movss 0x4(%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: propagate_liberty
static void propagate_liberty(float *board, int *lib, int *visited, int row, int col, int side)
{
    if (row < 0 || row > 18 || col < 0 || col > 18) return;
    int index = row*19 + col;
    if (occupied(board,index) != side) return;
    if (visited[index]) return;
    visited[index] = 1;
    lib[index] += 1;
    propagate_liberty(board, lib, visited, row+1, col, side);
    propagate_liberty(board, lib, visited, row-1, col, side);
    propagate_liberty(board, lib, visited, row, col+1, side);
    propagate_liberty(board, lib, visited, row, col-1, side);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
cmpl $0x13, %ecx
setae %al
cmpl $0x13, %r8d
setae %cl
orb %al, %cl
jne 0x49347
movl %r9d, %ebx
movl %r8d, %r14d
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
leal (%r15,%r15,8), %eax
leal (%r15,%rax,2), %eax
movq %rax, 0x10(%rsp)
leal 0x1(%r15), %eax
movl %eax, 0xc(%rsp)
leal -0x1(%r15), %eax
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rax
addl %r14d, %eax
movss (%rbp,%rax,4), %xmm0
movl $0x1, %ecx
ucomiss 0xbde0(%rip), %xmm0     # 0x550a0
jne 0x492da
jp 0x492da
movss 0x5a4(%rbp,%rax,4), %xmm0
cmpneqss 0xbdca(%rip), %xmm0     # 0x550a0
movd %xmm0, %ecx
cmpl %ebx, %ecx
jne 0x49347
cmpl $0x0, (%r12,%rax,4)
jne 0x49347
movl $0x1, (%r12,%rax,4)
incl (%r13,%rax,4)
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl 0xc(%rsp), %ecx
movl %r14d, %r8d
movl %ebx, %r9d
callq 0x49254
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl 0x8(%rsp), %ecx
movl %r14d, %r8d
movl %ebx, %r9d
callq 0x49254
leal 0x1(%r14), %r8d
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %r15d, %ecx
movl %ebx, %r9d
callq 0x49254
decl %r14d
cmpl $0x13, %r14d
jb 0x492a6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: load_files
unsigned char **load_files(char *filename, int *n)
{
    list *paths = get_paths(filename);
    *n = paths->size;
    unsigned char **contents = calloc(*n, sizeof(char *));
    int i;
    node *x = paths->front;
    for(i = 0; i < *n; ++i){
        contents[i] = read_file((char *)x->val);
        x = x->next;
    }
    return contents;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
callq 0x2af38
movq %rax, %r14
movslq (%rax), %r12
movl %r12d, (%rbx)
movl $0x8, %esi
movq %r12, %rdi
callq 0x3250
movq %rax, %r15
testq %r12, %r12
jle 0x493a4
xorl %r12d, %r12d
movq 0x8(%r14), %r14
movq (%r14), %rdi
callq 0xf166
movq %rax, (%r15,%r12,8)
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x49389
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: read_tokenized_data
int *read_tokenized_data(char *filename, size_t *read)
{
    size_t size = 512;
    size_t count = 0;
    FILE *fp = fopen(filename, "r");
    int *d = calloc(size, sizeof(int));
    int n, one;
    one = fscanf(fp, "%d", &n);
    while(one == 1){
        ++count;
        if(count > size){
            size = size*2;
            d = realloc(d, size*sizeof(int));
        }
        d[count-1] = n;
        one = fscanf(fp, "%d", &n);
    }
    fclose(fp);
    d = realloc(d, count*sizeof(int));
    *read = count;
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
leaq 0x11a5c(%rip), %rsi     # 0x5ae29
callq 0x3390
movq %rax, %r14
movl $0x200, %r12d           # imm = 0x200
movl $0x200, %edi            # imm = 0x200
movl $0x4, %esi
callq 0x3250
movq %rax, %r15
leaq 0x1198f(%rip), %rsi     # 0x5ad83
xorl %r13d, %r13d
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30a0
cmpl $0x1, %eax
jne 0x49464
leaq 0x11971(%rip), %rbp     # 0x5ad83
xorl %ebx, %ebx
leaq 0x1(%rbx), %r13
cmpq %r12, %r13
jbe 0x49442
movq %r15, %rdi
movq %r14, %r15
movq %rbp, %r14
leaq (%r12,%r12), %rbp
shlq $0x3, %r12
movq %r12, %rsi
callq 0x3350
movq %rbp, %r12
movq %r14, %rbp
movq %r15, %r14
movq %rax, %r15
movl 0xc(%rsp), %eax
movl %eax, (%r15,%rbx,4)
movq %r14, %rdi
movq %rbp, %rsi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x30a0
movq %r13, %rbx
cmpl $0x1, %eax
je 0x49414
movq %r14, %rdi
callq 0x3130
leaq (,%r13,4), %rsi
movq %r15, %rdi
callq 0x3350
movq 0x10(%rsp), %rcx
movq %r13, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: read_tokens
char **read_tokens(char *filename, size_t *read)
{
    size_t size = 512;
    size_t count = 0;
    FILE *fp = fopen(filename, "r");
    char **d = calloc(size, sizeof(char *));
    char *line;
    while((line=fgetl(fp)) != 0){
        ++count;
        if(count > size){
            size = size*2;
            d = realloc(d, size*sizeof(char *));
        }
        if(0==strcmp(line, "<NEWLINE>")) line = "\n";
        d[count-1] = line;
    }
    fclose(fp);
    d = realloc(d, count*sizeof(char *));
    *read = count;
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
leaq 0x11980(%rip), %rsi     # 0x5ae29
callq 0x3390
movq %rax, %r14
movl $0x200, %r12d           # imm = 0x200
movl $0x200, %edi            # imm = 0x200
movl $0x8, %esi
callq 0x3250
movq %rax, %r15
movq %r14, %rdi
callq 0xe948
testq %rax, %rax
je 0x49538
movq %rax, %r13
xorl %ebx, %ebx
leaq 0x1(%rbx), %rbp
cmpq %r12, %rbp
jbe 0x49503
movq %r15, %rdi
movq %r14, %r15
leaq (%r12,%r12), %r14
shlq $0x4, %r12
movq %r12, %rsi
callq 0x3350
movq %r14, %r12
movq %r15, %r14
movq %rax, %r15
movq %r13, %rdi
leaq 0x11583(%rip), %rsi     # 0x5aa90
callq 0x3260
testl %eax, %eax
leaq 0x11146(%rip), %rax     # 0x5a661
cmoveq %rax, %r13
movq %r13, (%r15,%rbx,8)
movq %r14, %rdi
callq 0xe948
movq %rax, %r13
movq %rbp, %rbx
testq %rax, %rax
jne 0x494db
jmp 0x4953a
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x3130
leaq (,%rbp,8), %rsi
movq %r15, %rdi
callq 0x3350
movq (%rsp), %rcx
movq %rbp, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: get_rnn_token_data
float_pair get_rnn_token_data(int *tokens, size_t *offsets, int characters, size_t len, int batch, int steps)
{
    float *x = calloc(batch * steps * characters, sizeof(float));
    float *y = calloc(batch * steps * characters, sizeof(float));
    int i,j;
    for(i = 0; i < batch; ++i){
        for(j = 0; j < steps; ++j){
            int curr = tokens[(offsets[i])%len];
            int next = tokens[(offsets[i] + 1)%len];

            x[(j*batch + i)*characters + curr] = 1;
            y[(j*batch + i)*characters + next] = 1;

            offsets[i] = (offsets[i] + 1) % len;

            if(curr >= characters || curr < 0 || next >= characters || next < 0){
                error("Bad char");
            }
        }
    }
    float_pair p;
    p.x = x;
    p.y = y;
    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %r14d
movq %rcx, 0x30(%rsp)
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
movl %r8d, %eax
imull %edx, %eax
movl %eax, 0x14(%rsp)
movl %r9d, 0x4(%rsp)
imull %r9d, %eax
movslq %eax, %rbx
movl $0x4, %esi
movq %rbx, %rdi
callq 0x3250
movq %rax, 0x20(%rsp)
movl $0x4, %esi
movq %rbx, %rdi
callq 0x3250
movq %rax, 0x18(%rsp)
testl %r14d, %r14d
jle 0x49696
movl %ebp, %edi
movl %r14d, %eax
movq %rax, 0x28(%rsp)
movq $0x0, 0x8(%rsp)
xorl %ebx, %ebx
cmpl $0x0, 0x4(%rsp)
jle 0x4967c
movq 0x8(%rsp), %r13
movl 0x4(%rsp), %ebp
movq (%r15,%rbx,8), %rcx
movq %rcx, %rax
xorl %edx, %edx
movq 0x30(%rsp), %r8
divq %r8
movl (%r12,%rdx,4), %esi
incq %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movl (%r12,%rdx,4), %eax
leal (%rsi,%r13), %ecx
movslq %ecx, %rcx
movq 0x20(%rsp), %r8
movl $0x3f800000, %r9d       # imm = 0x3F800000
movl %r9d, (%r8,%rcx,4)
leal (%r13,%rax), %ecx
movslq %ecx, %rcx
movq 0x18(%rsp), %r8
movl %r9d, (%r8,%rcx,4)
movq %rdx, (%r15,%rbx,8)
cmpl %edi, %esi
setge %cl
testl %esi, %esi
sets %dl
orb %cl, %dl
jne 0x4965d
cmpl %edi, %eax
setl %cl
testl %eax, %eax
setns %al
testb %al, %cl
jne 0x4966f
movl %edi, %r14d
leaq 0x11433(%rip), %rdi     # 0x5aa9a
callq 0xf141
movl %r14d, %edi
addl 0x14(%rsp), %r13d
decl %ebp
jne 0x495f2
incq %rbx
movq 0x8(%rsp), %rax
addl %edi, %eax
movq %rax, 0x8(%rsp)
cmpq 0x28(%rsp), %rbx
jne 0x495de
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/rnn.c
// Function: get_seq2seq_data
float_pair get_seq2seq_data(char **source, char **dest, int n, int characters, size_t len, int batch, int steps)
{
    int i,j;
    float *x = calloc(batch * steps * characters, sizeof(float));
    float *y = calloc(batch * steps * characters, sizeof(float));
    for(i = 0; i < batch; ++i){
        int index = rand()%n;
        //int slen = strlen(source[index]);
        //int dlen = strlen(dest[index]);
        for(j = 0; j < steps; ++j){
            unsigned char curr = source[index][j];
            unsigned char next = dest[index][j];

            x[(j*batch + i)*characters + curr] = 1;
            y[(j*batch + i)*characters + next] = 1;

            if(curr > 255 || curr <= 0 || next > 255 || next <= 0){
                /*text[(index+j+2)%len] = 0;
                printf("%ld %d %d %d %d\n", index, j, len, (int)text[index+j], (int)text[index+j+1]);
                printf("%s", text+index);
                */
                error("Bad char");
            }
        }
    }
    float_pair p;
    p.x = x;
    p.y = y;
    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebx
movl %edx, 0x14(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movl %r9d, %eax
movl %ecx, 0x18(%rsp)
imull %ecx, %eax
movl %eax, 0x1c(%rsp)
imull 0x80(%rsp), %eax
movslq %eax, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x3250
movq %rax, 0x20(%rsp)
movl $0x4, %esi
movq %r13, %rdi
callq 0x3250
movq %rax, %r13
testl %ebx, %ebx
jle 0x497cd
movl %ebx, %eax
movq %rax, 0x28(%rsp)
movl 0x80(%rsp), %ebx
movq $0x0, 0x8(%rsp)
movl $0x3f800000, %r14d      # imm = 0x3F800000
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
callq 0x34e0
cmpl $0x0, 0x80(%rsp)
jle 0x497ac
cltd
idivl 0x14(%rsp)
movslq %edx, %r15
movq 0x8(%rsp), %rbp
xorl %r12d, %r12d
movq 0x38(%rsp), %rax
movq (%rax,%r15,8), %rax
movzbl (%rax,%r12), %ecx
movq 0x40(%rsp), %rax
movq (%rax,%r15,8), %rax
movzbl (%rax,%r12), %eax
leal (%rbp,%rcx), %edx
leal (%rbp,%rax), %esi
movslq %edx, %rdx
movq 0x20(%rsp), %rdi
movl %r14d, (%rdi,%rdx,4)
movslq %esi, %rdx
movl %r14d, (%r13,%rdx,4)
testl %ecx, %ecx
je 0x49794
testb %al, %al
jne 0x497a0
leaq 0x112ff(%rip), %rdi     # 0x5aa9a
callq 0xf141
incq %r12
addl 0x1c(%rsp), %ebp
cmpq %r12, %rbx
jne 0x49754
movq 0x30(%rsp), %rcx
incq %rcx
movq 0x8(%rsp), %rax
addl 0x18(%rsp), %eax
movq %rax, 0x8(%rsp)
cmpq 0x28(%rsp), %rcx
jne 0x49730
movq 0x20(%rsp), %rax
movq %r13, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq