// File: /workspace/github_c_makefile_star2_O1/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 0x15ff7
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2f9e4
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
movq %r15, %rdi
movl $0x1, %esi
callq 0x302d4
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3230
leaq 0x60(%rsp), %r13
testq %rbx, %rbx
je 0x4d130
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x4d17f
leaq 0xaed3(%rip), %rdi      # 0x5800a
xorl %eax, %eax
callq 0x3170
movq 0x1ce8b(%rip), %rax     # 0x69fd0
movq (%rax), %rdi
callq 0x3320
movq 0x1ce84(%rip), %rax     # 0x69fd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3240
testq %rax, %rax
je 0x4d2f7
movq %rax, %r13
movq %rax, %rdi
leaq 0xb38f(%rip), %rsi      # 0x58509
callq 0x33c0
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
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 0x1676b
movq 0x58(%rsp), %r12
callq 0x3130
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x307ea
callq 0x3130
subq %r14, %rax
movq %rax, %rdi
callq 0xe8d4
cvtss2sd %xmm0, %xmm0
leaq 0xadf6(%rip), %rdi      # 0x57fe4
movq %r13, %rsi
movb $0x1, %al
callq 0x3170
movl $0x0, 0x20(%rsp)
xorps %xmm1, %xmm1
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %edx
movss 0x1c(%rsp), %xmm0
xorl %ecx, %ecx
xorl %r8d, %r8d
leaq 0x20(%rsp), %r9
callq 0x30bbb
movq %rax, %r12
movq %rax, %rdi
movl %ebp, %esi
movl 0x24(%rsp), %edx
movss 0xba83(%rip), %xmm0     # 0x58cbc
callq 0x36827
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
movss 0x1c(%rsp), %xmm0
leaq 0x1d49d(%rip), %rdx     # 0x6a700
movq 0x40(%rsp), %rcx
movl $0x14, %r8d
callq 0x160ca
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xbd66(%rip), %r14      # 0x58ff3
movq %r14, %rdi
callq 0x17a72
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x3f2e
movl 0x20(%rsp), %esi
movq %r12, %rdi
callq 0x30c1d
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
testq %rbx, %rbx
je 0x4d119
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq