// File: /workspace/github_c_makefile_star2_O3/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 0x16a0a
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x316bc
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 0x320a7
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
leaq 0x60(%rsp), %r13
testq %rbx, %rbx
je 0x4f3d6
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x4f425
leaq 0xad65(%rip), %rdi      # 0x5a142
xorl %eax, %eax
callq 0x3160
movq 0x1cbe5(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
callq 0x3310
movq 0x1cbde(%rip), %rax     # 0x6bfd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
testq %rax, %rax
je 0x4f59d
movq %rax, %r13
movq %rax, %rdi
leaq 0xb241(%rip), %rsi      # 0x5a661
callq 0x33b0
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x16ac9
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 0x170fa
movq 0x58(%rsp), %r12
callq 0x3120
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x32690
callq 0x3120
subq %r14, %rax
movq %rax, %rdi
callq 0xf0bf
cvtss2sd %xmm0, %xmm0
leaq 0xac88(%rip), %rdi      # 0x5a11c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
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 0x32a67
movq %rax, %r12
movq %rax, %rdi
movl %ebp, %esi
movl 0x24(%rsp), %edx
movss 0xb935(%rip), %xmm0     # 0x5ae14
callq 0x38a2a
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 0x1d1e7(%rip), %rdx     # 0x6c6f0
movq 0x40(%rsp), %rcx
movl $0x14, %r8d
callq 0x16add
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xbc18(%rip), %r14      # 0x5b14b
movq %r14, %rdi
callq 0x18301
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x40f9
movl 0x20(%rsp), %esi
movq %r12, %rdi
callq 0x32ac9
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
testq %rbx, %rbx
je 0x4f3bf
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq