// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/yolo.c
// Function: validate_yolo_recall
void validate_yolo_recall(char *cfg, char *weights)
{
    network *net = load_network(cfg, weights, 0);
    set_batch_network(net, 1);
    fprintf(stderr, "Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);
    srand(time(0));

    char *base = "results/comp4_det_test_";
    list *plist = get_paths("data/voc.2007.test");
    char **paths = (char **)list_to_array(plist);

    layer l = net->layers[net->n-1];
    int classes = l.classes;
    int side = l.side;

    int j, k;
    FILE **fps = calloc(classes, sizeof(FILE *));
    for(j = 0; j < classes; ++j){
        char buff[1024];
        snprintf(buff, 1024, "%s%s.txt", base, voc_names[j]);
        fps[j] = fopen(buff, "w");
    }

    int m = plist->size;
    int i=0;

    float thresh = .001;
    float iou_thresh = .5;
    float nms = 0;

    int total = 0;
    int correct = 0;
    int proposals = 0;
    float avg_iou = 0;

    for(i = 0; i < m; ++i){
        char *path = paths[i];
        image orig = load_image_color(path, 0, 0);
        image sized = resize_image(orig, net->w, net->h);
        char *id = basecfg(path);
        network_predict(net, sized.data);

        int nboxes = 0;
        detection *dets = get_network_boxes(net, orig.w, orig.h, thresh, 0, 0, 1, &nboxes);
        if (nms) do_nms_obj(dets, side*side*l.n, 1, nms);

        char labelpath[4096];
        find_replace(path, "images", "labels", labelpath);
        find_replace(labelpath, "JPEGImages", "labels", labelpath);
        find_replace(labelpath, ".jpg", ".txt", labelpath);
        find_replace(labelpath, ".JPEG", ".txt", labelpath);

        int num_labels = 0;
        box_label *truth = read_boxes(labelpath, &num_labels);
        for(k = 0; k < side*side*l.n; ++k){
            if(dets[k].objectness > thresh){
                ++proposals;
            }
        }
        for (j = 0; j < num_labels; ++j) {
            ++total;
            box t = {truth[j].x, truth[j].y, truth[j].w, truth[j].h};
            float best_iou = 0;
            for(k = 0; k < side*side*l.n; ++k){
                float iou = box_iou(dets[k].bbox, t);
                if(dets[k].objectness > thresh && iou > best_iou){
                    best_iou = iou;
                }
            }
            avg_iou += best_iou;
            if(best_iou > iou_thresh){
                ++correct;
            }
        }

        fprintf(stderr, "%5d %5d %5d\tRPs/Img: %.2f\tIOU: %.2f%%\tRecall:%.2f%%\n", i, correct, total, (float)proposals/(i+1), avg_iou*100/total, 100.*correct/total);
        free_detections(dets, nboxes);
        free(id);
        free_image(orig);
        free_image(sized);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x19b0, %rsp           # imm = 0x19B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
movq 0x1af1d(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movss 0x34(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x18(%rbp), %rax
movss 0x38(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x18(%rbp), %rax
movss 0x3c(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0xd65c(%rip), %rsi      # 0x75768
movb $0x3, %al
callq 0x3240
xorl %eax, %eax
movl %eax, %edi
callq 0x3290
movl %eax, %edi
callq 0x31e0
leaq 0xe6e2(%rip), %rax      # 0x7680c
movq %rax, -0x20(%rbp)
leaq 0xe856(%rip), %rdi      # 0x7698b
callq 0x31450
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x9020
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
cltq
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rsi
leaq -0x4d0(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movl -0x3d4(%rbp), %eax
movl %eax, -0x4d4(%rbp)
movl -0x43c(%rbp), %eax
movl %eax, -0x4d8(%rbp)
movslq -0x4d4(%rbp), %rdi
movl $0x8, %esi
callq 0x3220
movq %rax, -0x4e8(%rbp)
movl $0x0, -0x4dc(%rbp)
movl -0x4dc(%rbp), %eax
cmpl -0x4d4(%rbp), %eax
jge 0x6822a
leaq -0x8f0(%rbp), %rdi
movq -0x20(%rbp), %rcx
movslq -0x4dc(%rbp), %rdx
leaq 0x1ba66(%rip), %rax     # 0x83c40
movq (%rax,%rdx,8), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0xe860(%rip), %rdx      # 0x76a4a
movb $0x0, %al
callq 0x3150
leaq -0x8f0(%rbp), %rdi
leaq 0xe86c(%rip), %rsi      # 0x76a6b
callq 0x3360
movq %rax, %rdx
movq -0x4e8(%rbp), %rax
movslq -0x4dc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x4dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4dc(%rbp)
jmp 0x681b3
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x8f4(%rbp)
movl $0x0, -0x8f8(%rbp)
movss 0xbe98(%rip), %xmm0     # 0x740e0
movss %xmm0, -0x8fc(%rbp)
movss 0x8f94(%rip), %xmm0     # 0x711ec
movss %xmm0, -0x900(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x904(%rbp)
movl $0x0, -0x908(%rbp)
movl $0x0, -0x90c(%rbp)
movl $0x0, -0x910(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x914(%rbp)
movl $0x0, -0x8f8(%rbp)
movl -0x8f8(%rbp), %eax
cmpl -0x8f4(%rbp), %eax
jge 0x687ac
movq -0x30(%rbp), %rax
movslq -0x8f8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x920(%rbp)
movq -0x920(%rbp), %rsi
leaq -0x938(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xf510
movq -0x18(%rbp), %rax
movl 0x94(%rax), %esi
movq -0x18(%rbp), %rax
movl 0x90(%rax), %edx
leaq -0x950(%rbp), %rdi
leaq -0x938(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xfc00
movq -0x920(%rbp), %rdi
callq 0x4850
movq %rax, -0x958(%rbp)
movq -0x18(%rbp), %rdi
movq -0x940(%rbp), %rsi
callq 0x3b160
movl $0x0, -0x95c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x938(%rbp), %esi
movl -0x934(%rbp), %edx
movss -0x8fc(%rbp), %xmm0
xorps %xmm1, %xmm1
xorl %eax, %eax
movl %eax, %ecx
movl $0x1, %r8d
leaq -0x95c(%rbp), %r9
callq 0x3b640
movq %rax, -0x968(%rbp)
movss -0x904(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x68396
jp 0x68396
jmp 0x683c3
movq -0x968(%rbp), %rdi
movl -0x4d8(%rbp), %esi
imull -0x4d8(%rbp), %esi
imull -0x44c(%rbp), %esi
movss -0x904(%rbp), %xmm0
movl $0x1, %edx
callq 0x44a60
movq -0x920(%rbp), %rdi
leaq -0x1970(%rbp), %rcx
leaq 0xbf67(%rip), %rsi      # 0x7433f
leaq 0xbf67(%rip), %rdx      # 0x74346
callq 0x4a50
leaq -0x1970(%rbp), %rdi
leaq -0x1970(%rbp), %rcx
leaq 0xbf54(%rip), %rsi      # 0x7434d
leaq 0xbf46(%rip), %rdx      # 0x74346
callq 0x4a50
leaq -0x1970(%rbp), %rdi
leaq -0x1970(%rbp), %rcx
leaq 0xad1f(%rip), %rsi      # 0x73139
leaq 0xdc45(%rip), %rdx      # 0x76066
callq 0x4a50
leaq -0x1970(%rbp), %rdi
leaq -0x1970(%rbp), %rcx
leaq 0xbf22(%rip), %rsi      # 0x7435d
leaq 0xdc24(%rip), %rdx      # 0x76066
callq 0x4a50
movl $0x0, -0x1974(%rbp)
leaq -0x1970(%rbp), %rdi
leaq -0x1974(%rbp), %rsi
callq 0x319a0
movq %rax, -0x1980(%rbp)
movl $0x0, -0x4e0(%rbp)
movl -0x4e0(%rbp), %eax
movl -0x4d8(%rbp), %ecx
imull -0x4d8(%rbp), %ecx
imull -0x44c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x684d8
movq -0x968(%rbp), %rax
movslq -0x4e0(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movss 0x28(%rax), %xmm0
ucomiss -0x8fc(%rbp), %xmm0
jbe 0x684c5
movl -0x910(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x910(%rbp)
jmp 0x684c7
movl -0x4e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e0(%rbp)
jmp 0x68475
movl $0x0, -0x4dc(%rbp)
movl -0x4dc(%rbp), %eax
cmpl -0x1974(%rbp), %eax
jge 0x686a8
movl -0x908(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x908(%rbp)
movq -0x1980(%rbp), %rax
movslq -0x4dc(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x1990(%rbp)
movq -0x1980(%rbp), %rax
movslq -0x4dc(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x198c(%rbp)
movq -0x1980(%rbp), %rax
movslq -0x4dc(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x1988(%rbp)
movq -0x1980(%rbp), %rax
movslq -0x4dc(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movss 0x10(%rax), %xmm0
movss %xmm0, -0x1984(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1994(%rbp)
movl $0x0, -0x4e0(%rbp)
movl -0x4e0(%rbp), %eax
movl -0x4d8(%rbp), %ecx
imull -0x4d8(%rbp), %ecx
imull -0x44c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x6865a
movq -0x968(%rbp), %rax
movslq -0x4e0(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm0
movsd 0x8(%rax,%rcx), %xmm1
movsd -0x1990(%rbp), %xmm2
movsd -0x1988(%rbp), %xmm3
callq 0x44cd0
movss %xmm0, -0x1998(%rbp)
movq -0x968(%rbp), %rax
movslq -0x4e0(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movss 0x28(%rax), %xmm0
ucomiss -0x8fc(%rbp), %xmm0
jbe 0x68644
movss -0x1998(%rbp), %xmm0
ucomiss -0x1994(%rbp), %xmm0
jbe 0x68644
movss -0x1998(%rbp), %xmm0
movss %xmm0, -0x1994(%rbp)
jmp 0x68646
movl -0x4e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e0(%rbp)
jmp 0x685a0
movss -0x1994(%rbp), %xmm0
addss -0x914(%rbp), %xmm0
movss %xmm0, -0x914(%rbp)
movss -0x1994(%rbp), %xmm0
ucomiss -0x900(%rbp), %xmm0
jbe 0x68692
movl -0x90c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90c(%rbp)
jmp 0x68694
movl -0x4dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4dc(%rbp)
jmp 0x684e2
movq 0x1a949(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movl -0x8f8(%rbp), %edx
movl -0x90c(%rbp), %ecx
movl -0x908(%rbp), %r8d
cvtsi2ssl -0x910(%rbp), %xmm0
movl -0x8f8(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movss 0x8b2a(%rip), %xmm1     # 0x71214
mulss -0x914(%rbp), %xmm1
cvtsi2ssl -0x908(%rbp), %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
cvtsi2sdl -0x90c(%rbp), %xmm3
movsd 0xd37e(%rip), %xmm2     # 0x75a90
mulsd %xmm3, %xmm2
cvtsi2sdl -0x908(%rbp), %xmm3
divsd %xmm3, %xmm2
leaq 0xe126(%rip), %rsi      # 0x7684f
movb $0x3, %al
callq 0x3240
movq -0x968(%rbp), %rdi
movl -0x95c(%rbp), %esi
callq 0x3b6b0
movq -0x958(%rbp), %rdi
callq 0x3030
leaq -0x938(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
leaq -0x950(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
movl -0x8f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8f8(%rbp)
jmp 0x6829e
addq $0x19b0, %rsp           # imm = 0x19B0
popq %rbp
retq
nopw %cs:(%rax,%rax)