// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: draw_detections
void draw_detections(image im, detection *dets, int num, float thresh, char **names, image **alphabet, int classes)
{
    int i,j;

    for(i = 0; i < num; ++i){
        char labelstr[4096] = {0};
        int class = -1;
        for(j = 0; j < classes; ++j){
            if (dets[i].prob[j] > thresh){
                if (class < 0) {
                    strcat(labelstr, names[j]);
                    class = j;
                } else {
                    strcat(labelstr, ", ");
                    strcat(labelstr, names[j]);
                }
                printf("%s: %.0f%%\n", names[j], dets[i].prob[j]*100);
            }
        }
        if(class >= 0){
            int width = im.h * .006;

            /*
               if(0){
               width = pow(prob, 1./2.)*10+1;
               alphabet = 0;
               }
             */

            //printf("%d %s: %.0f%%\n", i, names[class], prob*100);
            int offset = class*123457 % classes;
            float red = get_color(2,offset,classes);
            float green = get_color(1,offset,classes);
            float blue = get_color(0,offset,classes);
            float rgb[3];

            //width = prob*20+2;

            rgb[0] = red;
            rgb[1] = green;
            rgb[2] = blue;
            box b = dets[i].bbox;
            //printf("%f %f %f %f\n", b.x, b.y, b.w, b.h);

            int left  = (b.x-b.w/2.)*im.w;
            int right = (b.x+b.w/2.)*im.w;
            int top   = (b.y-b.h/2.)*im.h;
            int bot   = (b.y+b.h/2.)*im.h;

            if(left < 0) left = 0;
            if(right > im.w-1) right = im.w-1;
            if(top < 0) top = 0;
            if(bot > im.h-1) bot = im.h-1;

            draw_box_width(im, left, top, right, bot, width, red, green, blue);
            if (alphabet) {
                image label = get_label(alphabet, labelstr, (im.h*.03));
                draw_label(im, top + width, left, label, rgb);
                free_image(label);
            }
            if (dets[i].mask){
                image mask = float_to_image(14, 14, 1, dets[i].mask);
                image resized_mask = resize_image(mask, b.w*im.w, b.h*im.h);
                image tmask = threshold_image(resized_mask, .5);
                embed_image(tmask, im, left, top);
                free_image(mask);
                free_image(resized_mask);
                free_image(tmask);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1110, %rsp           # imm = 0x1110
leaq 0x10(%rbp), %rax
movq %rax, -0x10e0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movss %xmm0, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xfba4
leaq -0x1030(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3190
movl $0xffffffff, -0x1034(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xf690
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x2c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
ucomiss -0x10(%rbp), %xmm0
jbe 0xf680
cmpl $0x0, -0x1034(%rbp)
jge 0xf613
leaq -0x1030(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x33e0
movl -0x2c(%rbp), %eax
movl %eax, -0x1034(%rbp)
jmp 0xf63e
leaq -0x1030(%rbp), %rdi
leaq 0x6626c(%rip), %rsi     # 0x7588d
callq 0x33e0
leaq -0x1030(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x33e0
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x2c(%rbp), %rcx
movss 0x61bab(%rip), %xmm0    # 0x71214
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x63a17(%rip), %rdi     # 0x73090
movb $0x1, %al
callq 0x3130
jmp 0xf682
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf5b5
cmpl $0x0, -0x1034(%rbp)
jl 0xfb94
movq -0x10e0(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm0
movsd 0x63787(%rip), %xmm1    # 0x72e38
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1038(%rbp)
imull $0x1e241, -0x1034(%rbp), %eax # imm = 0x1E241
cltd
idivl -0x24(%rbp)
movl %edx, -0x103c(%rbp)
movl -0x103c(%rbp), %esi
movl -0x24(%rbp), %edx
movl $0x2, %edi
callq 0xe160
movss %xmm0, -0x1040(%rbp)
movl -0x103c(%rbp), %esi
movl -0x24(%rbp), %edx
movl $0x1, %edi
callq 0xe160
movss %xmm0, -0x1044(%rbp)
movl -0x103c(%rbp), %esi
movl -0x24(%rbp), %edx
xorl %edi, %edi
callq 0xe160
movq -0x10e0(%rbp), %rax
movss %xmm0, -0x1048(%rbp)
movss -0x1040(%rbp), %xmm0
movss %xmm0, -0x1054(%rbp)
movss -0x1044(%rbp), %xmm0
movss %xmm0, -0x1050(%rbp)
movss -0x1048(%rbp), %xmm0
movss %xmm0, -0x104c(%rbp)
movq -0x8(%rbp), %rcx
movslq -0x28(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, -0x1064(%rbp)
movq 0x8(%rcx), %rcx
movq %rcx, -0x105c(%rbp)
movss -0x1064(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x105c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x618bc(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
cvtsi2sdl (%rax), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x1068(%rbp)
movss -0x1064(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x105c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x61882(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdl (%rax), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x106c(%rbp)
movss -0x1060(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x1058(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x61848(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
cvtsi2sdl 0x4(%rax), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x1070(%rbp)
movss -0x1060(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x1058(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x6180d(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdl 0x4(%rax), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1074(%rbp)
cmpl $0x0, -0x1068(%rbp)
jge 0xf879
movl $0x0, -0x1068(%rbp)
movq -0x10e0(%rbp), %rcx
movl -0x106c(%rbp), %eax
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xf8a1
movq -0x10e0(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x106c(%rbp)
cmpl $0x0, -0x1070(%rbp)
jge 0xf8b4
movl $0x0, -0x1070(%rbp)
movq -0x10e0(%rbp), %rcx
movl -0x1074(%rbp), %eax
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xf8de
movq -0x10e0(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, -0x1074(%rbp)
movq -0x10e0(%rbp), %rax
movl -0x1068(%rbp), %edi
movl -0x1070(%rbp), %esi
movl -0x106c(%rbp), %edx
movl -0x1074(%rbp), %ecx
movl -0x1038(%rbp), %r8d
movss -0x1040(%rbp), %xmm0
movss -0x1044(%rbp), %xmm1
movss -0x1048(%rbp), %xmm2
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xf220
cmpq $0x0, -0x20(%rbp)
je 0xf9fc
movq -0x10e0(%rbp), %rax
movq -0x20(%rbp), %rsi
leaq -0x1030(%rbp), %rdx
cvtsi2sdl 0x4(%rax), %xmm0
movsd 0x634dc(%rip), %xmm1    # 0x72e40
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
leaq -0x1090(%rbp), %rdi
callq 0xebe0
movq -0x10e0(%rbp), %rcx
movl -0x1070(%rbp), %edi
addl -0x1038(%rbp), %edi
movl -0x1068(%rbp), %esi
leaq -0x1054(%rbp), %rdx
leaq -0x1090(%rbp), %rax
movq (%rcx), %r8
movq %r8, (%rsp)
movq 0x8(%rcx), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0xede0
leaq -0x1090(%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
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x20(%rax)
je 0xfb92
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %r8
leaq -0x10a8(%rbp), %rdi
movl $0xe, %edx
movl $0x1, %ecx
movl %edx, %esi
callq 0xfbb0
movq -0x10e0(%rbp), %rax
movss -0x105c(%rbp), %xmm0
cvtsi2ssl (%rax), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %esi
movss -0x1058(%rbp), %xmm0
cvtsi2ssl 0x4(%rax), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %edx
leaq -0x10c0(%rbp), %rdi
leaq -0x10a8(%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
leaq -0x10d8(%rbp), %rdi
leaq -0x10c0(%rbp), %rax
movss 0x61739(%rip), %xmm0    # 0x711ec
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x10040
movq -0x10e0(%rbp), %rax
movl -0x1068(%rbp), %edi
movl -0x1070(%rbp), %esi
leaq -0x10d8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0xeae0
leaq -0x10a8(%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 -0x10c0(%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 -0x10d8(%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
jmp 0xfb94
jmp 0xfb96
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xf585
addq $0x1110, %rsp           # imm = 0x1110
popq %rbp
retq
nopl (%rax)