// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r12d
movl %r8d, %ebp
movl %ecx, %r13d
movl %edx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
movl $0x4a0, %edx            # imm = 0x4A0
xorl %esi, %esi
callq 0x31d0
movl $0x17, (%rbx)
movl %ebp, 0x84(%rbx)
movl %r12d, 0x130(%rbx)
movl %r14d, 0xc(%rsp)
movl %r14d, 0x48(%rbx)
movl %r13d, 0x6c(%rbx)
movl %r15d, 0x70(%rbx)
movl 0x58(%rsp), %eax
leal 0x5(%rax), %r14d
imull %ebp, %r14d
movl %r14d, 0x74(%rbx)
movl %r15d, 0x7c(%rbx)
movl %r13d, 0x8(%rsp)
movl %r13d, 0x78(%rbx)
movl %r14d, 0x80(%rbx)
movl %eax, 0xfc(%rbx)
pushq $0x1
popq %rdi
pushq $0x4
popq %r13
movq %r13, %rsi
callq 0x3260
movq %rax, 0x1d8(%rbx)
movq %r12, 0x10(%rsp)
addl %r12d, %r12d
movslq %r12d, %rdi
movq %r13, %rsi
callq 0x3260
movq %rax, %r13
movq 0x50(%rsp), %rax
movq %r13, 0x230(%rbx)
testq %rax, %rax
jne 0x89f4
movslq %ebp, %rdi
pushq $0x4
popq %rsi
callq 0x3260
movq %rax, 0x128(%rbx)
testl %ebp, %ebp
jle 0x89fb
movl %ebp, %ecx
xorl %edx, %edx
movl %edx, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x89e7
jmp 0x89fb
movq %rax, 0x128(%rbx)
addl %ebp, %ebp
movslq %ebp, %rdi
pushq $0x4
popq %rbp
movq %rbp, %rsi
callq 0x3260
movq %rax, 0x238(%rbx)
imull 0x8(%rsp), %r15d
imull %r15d, %r14d
movl %r14d, 0x58(%rbx)
movl %r14d, 0x54(%rbx)
movl $0x1c2, 0x68(%rbx)      # imm = 0x1C2
imull 0xc(%rsp), %r14d
movslq %r14d, %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3260
movq %rax, 0x260(%rbx)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3260
movq %rax, 0x268(%rbx)
cmpl $0x0, 0x10(%rsp)
jle 0x8a7d
cmpl $0x2, %r12d
pushq $0x1
popq %rax
cmovgel %r12d, %eax
xorl %ecx, %ecx
movl $0x3f000000, (%r13,%rcx,4) # imm = 0x3F000000
incq %rcx
cmpq %rcx, %rax
jne 0x8a6c
leaq 0x361b4(%rip), %rax     # 0x3ec38
movq %rax, 0x10(%rbx)
leaq 0x36b6b(%rip), %rax     # 0x3f5fa
movq %rax, 0x18(%rbx)
movq 0x6155e(%rip), %rax     # 0x69ff8
movq (%rax), %rcx
leaq 0x4f348(%rip), %rdi     # 0x57dec
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x3450
xorl %edi, %edi
callq 0x3230
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq