// File: /workspace/github_c_makefile_star2_O2/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, %r14d
movl %r8d, %r13d
movl %ecx, 0xc(%rsp)
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
xorl %r12d, %r12d
movl $0x4a0, %edx            # imm = 0x4A0
xorl %esi, %esi
callq 0x31c0
movl $0x17, (%rbx)
movl %r13d, 0x84(%rbx)
movl %r14d, 0x130(%rbx)
movl %r15d, 0x14(%rsp)
movl %r15d, 0x48(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x6c(%rbx)
movl %ebp, 0x70(%rbx)
movl 0x58(%rsp), %ecx
leal 0x5(%rcx), %r15d
movl %r13d, 0x8(%rsp)
imull %r13d, %r15d
movl %r15d, 0x74(%rbx)
movl %ebp, 0x10(%rsp)
movl %ebp, 0x7c(%rbx)
movl %eax, 0x78(%rbx)
movl %r15d, 0x80(%rbx)
movl %ecx, 0xfc(%rbx)
pushq $0x1
popq %rdi
pushq $0x4
popq %r13
movq %r13, %rsi
callq 0x3250
movq %rax, 0x1d8(%rbx)
addl %r14d, %r14d
movslq %r14d, %rdi
movq %r13, %rsi
callq 0x3250
movq %rax, %r13
movq 0x50(%rsp), %rax
movq %r13, 0x230(%rbx)
testq %rax, %rax
jne 0x349ae
movl 0x8(%rsp), %ebp
movslq %ebp, %rdi
pushq $0x4
popq %rsi
callq 0x3250
movq %rax, 0x128(%rbx)
testl %ebp, %ebp
movl $0x0, %ecx
cmovgl %ebp, %ecx
movl %ebp, %edx
cmpq %r12, %rcx
je 0x349b9
movl %r12d, (%rax,%r12,4)
incq %r12
jmp 0x349a0
movq %rax, 0x128(%rbx)
movl 0x8(%rsp), %edx
addl %edx, %edx
movslq %edx, %rdi
pushq $0x4
popq %rbp
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x238(%rbx)
imull 0x10(%rsp), %r15d
imull 0xc(%rsp), %r15d
movl %r15d, 0x58(%rbx)
movl %r15d, 0x54(%rbx)
movl $0x1c2, 0x68(%rbx)      # imm = 0x1C2
imull 0x14(%rsp), %r15d
movslq %r15d, %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x260(%rbx)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x268(%rbx)
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
cmpq %rax, %r14
je 0x34a34
movl $0x3f000000, (%r13,%rax,4) # imm = 0x3F000000
incq %rax
jmp 0x34a21
leaq 0x44(%rip), %rax        # 0x34a7f
movq %rax, 0x10(%rbx)
leaq 0xa30(%rip), %rax       # 0x35476
movq %rax, 0x18(%rbx)
movq 0x2f5a7(%rip), %rax     # 0x63ff8
movq (%rax), %rcx
leaq 0x1c3c5(%rip), %rdi     # 0x50e20
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x3440
xorl %edi, %edi
callq 0x3220
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq