// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/yolo_layer.c
// Function: make_yolo_layer
layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes)
{
    int i;
    layer l = {0};
    l.type = YOLO;

    l.n = n;
    l.total = total;
    l.batch = batch;
    l.h = h;
    l.w = w;
    l.c = n*(classes + 4 + 1);
    l.out_w = l.w;
    l.out_h = l.h;
    l.out_c = l.c;
    l.classes = classes;
    l.cost = calloc(1, sizeof(float));
    l.biases = calloc(total*2, sizeof(float));
    if(mask) l.mask = mask;
    else{
        l.mask = calloc(n, sizeof(int));
        for(i = 0; i < n; ++i){
            l.mask[i] = i;
        }
    }
    l.bias_updates = calloc(n*2, sizeof(float));
    l.outputs = h*w*n*(classes + 4 + 1);
    l.inputs = l.outputs;
    l.truths = 90*(4 + 1);
    l.delta = calloc(batch*l.outputs, sizeof(float));
    l.output = calloc(batch*l.outputs, sizeof(float));
    for(i = 0; i < total*2; ++i){
        l.biases[i] = .5;
    }

    l.forward = forward_yolo_layer;
    l.backward = backward_yolo_layer;

    fprintf(stderr, "yolo\n");
    srand(0);

    return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x20(%rbp)
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movl %esi, -0x4(%rbp)
movl %edx, -0x8(%rbp)
movl %ecx, -0xc(%rbp)
movl %r8d, -0x10(%rbp)
movl %r9d, -0x14(%rbp)
xorl %esi, %esi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3190
movq -0x20(%rbp), %rdi
movl $0x17, (%rdi)
movl -0x10(%rbp), %eax
movl %eax, 0x84(%rdi)
movl -0x14(%rbp), %eax
movl %eax, 0x130(%rdi)
movl -0x4(%rbp), %eax
movl %eax, 0x48(%rdi)
movl -0xc(%rbp), %eax
movl %eax, 0x6c(%rdi)
movl -0x8(%rbp), %eax
movl %eax, 0x70(%rdi)
movl -0x10(%rbp), %eax
movl 0x18(%rbp), %ecx
addl $0x4, %ecx
addl $0x1, %ecx
imull %ecx, %eax
movl %eax, 0x74(%rdi)
movl 0x70(%rdi), %eax
movl %eax, 0x7c(%rdi)
movl 0x6c(%rdi), %eax
movl %eax, 0x78(%rdi)
movl 0x74(%rdi), %eax
movl %eax, 0x80(%rdi)
movl 0x18(%rbp), %eax
movl %eax, 0xfc(%rdi)
movl $0x1, %edi
movl $0x4, %esi
callq 0x3220
movq -0x20(%rbp), %rdi
movq %rax, 0x1d8(%rdi)
movl -0x14(%rbp), %eax
shll %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x20(%rbp), %rdi
movq %rax, 0x230(%rdi)
cmpq $0x0, 0x10(%rbp)
je 0x51ab4
movq -0x20(%rbp), %rax
movq 0x10(%rbp), %rcx
movq %rcx, 0x128(%rax)
jmp 0x51b01
movslq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x128(%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x51aff
movq -0x20(%rbp), %rax
movl -0x18(%rbp), %edx
movq 0x128(%rax), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x51ad7
jmp 0x51b01
movl -0x10(%rbp), %eax
shll %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x20(%rbp), %rcx
movq %rax, 0x238(%rcx)
movl -0xc(%rbp), %eax
imull -0x8(%rbp), %eax
imull -0x10(%rbp), %eax
movl 0x18(%rbp), %edx
addl $0x4, %edx
addl $0x1, %edx
imull %edx, %eax
movl %eax, 0x58(%rcx)
movl 0x58(%rcx), %eax
movl %eax, 0x54(%rcx)
movl $0x1c2, 0x68(%rcx)      # imm = 0x1C2
movl -0x4(%rbp), %eax
imull 0x58(%rcx), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x20(%rbp), %rcx
movq %rax, 0x260(%rcx)
movl -0x4(%rbp), %eax
imull 0x58(%rcx), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x268(%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x51bc0
movq -0x20(%rbp), %rax
movq 0x230(%rax), %rax
movslq -0x18(%rbp), %rcx
movss 0x1f63c(%rip), %xmm0    # 0x711ec
movss %xmm0, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x51b8d
movq -0x20(%rbp), %rax
leaq 0x45(%rip), %rcx        # 0x51c10
movq %rcx, 0x10(%rax)
leaq 0xdda(%rip), %rcx       # 0x529b0
movq %rcx, 0x18(%rax)
movq 0x31417(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x23ae5(%rip), %rsi     # 0x756d0
movb $0x0, %al
callq 0x3240
xorl %edi, %edi
callq 0x31e0
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)