// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/yolo.c
// Function: test_yolo
void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
{
    image **alphabet = load_alphabet();
    network *net = load_network(cfgfile, weightfile, 0);
    layer l = net->layers[net->n-1];
    set_batch_network(net, 1);
    srand(2222222);
    clock_t time;
    char buff[256];
    char *input = buff;
    float nms=.4;
    while(1){
        if(filename){
            strncpy(input, filename, 256);
        } else {
            printf("Enter Image Path: ");
            fflush(stdout);
            input = fgets(input, 256, stdin);
            if(!input) return;
            strtok(input, "\n");
        }
        image im = load_image_color(input,0,0);
        image sized = resize_image(im, net->w, net->h);
        float *X = sized.data;
        time=clock();
        network_predict(net, X);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));

        int nboxes = 0;
        detection *dets = get_network_boxes(net, 1, 1, thresh, 0, 0, 0, &nboxes);
        if (nms) do_nms_sort(dets, l.side*l.side*l.n, l.classes, nms);

        draw_detections(im, dets, l.side*l.side*l.n, thresh, voc_names, alphabet, 20);
        save_image(im, "predictions");
        show_image(im, "predictions", 0);
        free_detections(dets, nboxes);
        free_image(im);
        free_image(sized);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movss %xmm0, 0x1c(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
callq 0xbe7c
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x22658
movq %rax, %r15
movq 0x20(%rax), %rax
movslq (%r15), %rcx
imulq $0x4a0, %rcx, %rcx      # imm = 0x4A0
movl -0x40c(%rax,%rcx), %ebp
movl -0x3a4(%rax,%rcx), %edx
movl %edx, 0x24(%rsp)
imull %ebp, %ebp
imull -0x41c(%rax,%rcx), %ebp
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x22f00
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
leaq 0x60(%rsp), %r14
testq %rbx, %rbx
je 0x45426
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x45475
leaq 0xbc15(%rip), %rdi      # 0x51042
xorl %eax, %eax
callq 0x3160
movq 0x1eb95(%rip), %rax     # 0x63fd0
movq (%rax), %rdi
callq 0x3310
movq 0x1eb8e(%rip), %rax     # 0x63fd8
movq (%rax), %rdx
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
testq %rax, %rax
je 0x455e3
movq %rax, %r14
movq %rax, %rdi
leaq 0xc0a9(%rip), %rsi      # 0x51519
callq 0x33b0
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf36
movl 0x90(%r15), %edx
movl 0x94(%r15), %esi
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %rdi
callq 0xc3ee
movq 0x58(%rsp), %r13
callq 0x3120
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0x233e2
callq 0x3120
subq %r12, %rax
movq %rax, %rdi
callq 0x437c
cvtss2sd %xmm0, %xmm0
leaq 0xbb38(%rip), %rdi      # 0x5101c
movq %r14, %rsi
movb $0x1, %al
callq 0x3160
andl $0x0, 0x20(%rsp)
xorps %xmm1, %xmm1
movq %r15, %rdi
pushq $0x1
popq %rdx
movl %edx, %esi
movss 0x1c(%rsp), %xmm0
xorl %ecx, %ecx
xorl %r8d, %r8d
leaq 0x20(%rsp), %r9
callq 0x2379c
movq %rax, %r13
movq %rax, %rdi
movl %ebp, %esi
movl 0x24(%rsp), %edx
movss 0xc7ad(%rip), %xmm0     # 0x51cd4
callq 0x2b219
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movl %ebp, %esi
movss 0x1c(%rsp), %xmm0
leaq 0x1f1af(%rip), %rdx     # 0x64700
movq 0x40(%rsp), %rcx
pushq $0x14
popq %r8
callq 0xbf48
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xca92(%rip), %r12      # 0x5200b
movq %r12, %rdi
callq 0xd514
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0xd4c7
movl 0x20(%rsp), %esi
movq %r13, %rdi
callq 0x237fe
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
testq %rbx, %rbx
je 0x4540f
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq