// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/yolo_layer.c
// Function: delta_yolo_box
float delta_yolo_box(box truth, float *x, float *biases, int n, int index, int i, int j, int lw, int lh, int w, int h, float *delta, float scale, int stride)
{
    box pred = get_yolo_box(x, biases, n, index, i, j, lw, lh, w, h, stride);
    float iou = box_iou(pred, truth);

    float tx = (truth.x*lw - i);
    float ty = (truth.y*lh - j);
    float tw = log(truth.w*w / biases[2*n]);
    float th = log(truth.h*h / biases[2*n + 1]);

    delta[index + 0*stride] = scale * (tx - x[index + 0*stride]);
    delta[index + 1*stride] = scale * (ty - x[index + 1*stride]);
    delta[index + 2*stride] = scale * (tw - x[index + 2*stride]);
    delta[index + 3*stride] = scale * (th - x[index + 3*stride]);
    return iou;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl 0x38(%rbp), %eax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movlpd %xmm0, -0x28(%rbp)
movlpd %xmm1, -0x20(%rbp)
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movl %edx, -0x3c(%rbp)
movl %ecx, -0x40(%rbp)
movl %r8d, -0x44(%rbp)
movl %r9d, -0x48(%rbp)
movss %xmm2, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
movl -0x44(%rbp), %r8d
movl -0x48(%rbp), %r9d
movl 0x10(%rbp), %r10d
movl 0x18(%rbp), %r11d
movl 0x20(%rbp), %ebx
movl 0x28(%rbp), %r14d
movl 0x38(%rbp), %r15d
movq %rsp, %rax
movl %r15d, 0x20(%rax)
movl %r14d, 0x18(%rax)
movl %ebx, 0x10(%rax)
movl %r11d, 0x8(%rax)
movl %r10d, (%rax)
callq 0x52ac0
movlpd %xmm0, -0x5c(%rbp)
movlpd %xmm1, -0x54(%rbp)
movsd -0x5c(%rbp), %xmm0
movsd -0x54(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
movsd -0x20(%rbp), %xmm3
callq 0x44cd0
movss %xmm0, -0x60(%rbp)
movss -0x28(%rbp), %xmm0
cvtsi2ssl 0x10(%rbp), %xmm2
cvtsi2ssl -0x44(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x64(%rbp)
movss -0x24(%rbp), %xmm0
cvtsi2ssl 0x18(%rbp), %xmm2
cvtsi2ssl -0x48(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x68(%rbp)
movss -0x20(%rbp), %xmm0
cvtsi2ssl 0x20(%rbp), %xmm1
mulss %xmm1, %xmm0
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
divss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x31a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movss -0x1c(%rbp), %xmm0
cvtsi2ssl 0x28(%rbp), %xmm1
mulss %xmm1, %xmm0
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
divss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x31a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x70(%rbp)
movss -0x4c(%rbp), %xmm0
movss -0x64(%rbp), %xmm1
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
imull $0x0, 0x38(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm0
movq 0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
imull $0x0, 0x38(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movss -0x4c(%rbp), %xmm0
movss -0x68(%rbp), %xmm1
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
movl 0x38(%rbp), %edx
shll $0x0, %edx
addl %edx, %ecx
movslq %ecx, %rcx
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm0
movq 0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
movl 0x38(%rbp), %edx
shll $0x0, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movss -0x4c(%rbp), %xmm0
movss -0x6c(%rbp), %xmm1
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
movl 0x38(%rbp), %edx
shll %edx
addl %edx, %ecx
movslq %ecx, %rcx
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm0
movq 0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
movl 0x38(%rbp), %edx
shll %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movss -0x4c(%rbp), %xmm0
movss -0x70(%rbp), %xmm1
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
imull $0x3, 0x38(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm0
movq 0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
imull $0x3, 0x38(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movss -0x60(%rbp), %xmm0
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)