// File: /workspace/github_c_makefile_star2_O3/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, %r15d
movl %r8d, %ebp
movl %ecx, %r13d
movl %edx, %r14d
movl %esi, %r12d
movq %rdi, %rbx
movl $0x4a0, %edx            # imm = 0x4A0
xorl %esi, %esi
callq 0x31c0
movl $0x17, (%rbx)
movl %ebp, 0x84(%rbx)
movl %r15d, 0x130(%rbx)
movl %r12d, 0xc(%rsp)
movl %r12d, 0x48(%rbx)
movl %r13d, 0x6c(%rbx)
movl %r14d, 0x70(%rbx)
movl 0x58(%rsp), %eax
leal 0x5(%rax), %r12d
imull %ebp, %r12d
movl %r12d, 0x74(%rbx)
movl %r14d, 0x4(%rsp)
movl %r14d, 0x7c(%rbx)
movl %r13d, 0x8(%rsp)
movl %r13d, 0x78(%rbx)
movl %r12d, 0x80(%rbx)
movl %eax, 0xfc(%rbx)
pushq $0x1
popq %rdi
pushq $0x4
popq %r14
movq %r14, %rsi
callq 0x3250
movq %rax, 0x1d8(%rbx)
movq %r15, 0x10(%rsp)
addl %r15d, %r15d
movslq %r15d, %rdi
movq %r14, %rsi
callq 0x3250
movq %rax, %r14
movq 0x50(%rsp), %rax
movq %r14, 0x230(%rbx)
testq %rax, %rax
jne 0x8ef1
movslq %ebp, %rdi
pushq $0x4
popq %rsi
callq 0x3250
movq %rax, 0x128(%rbx)
testl %ebp, %ebp
jle 0x8ef8
movl %ebp, %edx
leal 0x1(%rbp), %ecx
andl $-0x2, %ecx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x4c203(%rip), %xmm1    # 0x55080
xorl %edx, %edx
movdqa 0x4c209(%rip), %xmm2    # 0x55090
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x51069(%rip), %xmm4    # 0x59f00
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x8ecc
movl %edx, (%rax,%rdx,4)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x8ee2
leal 0x1(%rdx), %esi
movl %esi, 0x4(%rax,%rdx,4)
addq $0x2, %rdx
paddq %xmm4, %xmm1
cmpq %rdx, %rcx
jne 0x8e97
jmp 0x8ef8
movq %rax, 0x128(%rbx)
addl %ebp, %ebp
movslq %ebp, %rdi
pushq $0x4
popq %rbp
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x238(%rbx)
imull 0x4(%rsp), %r12d
imull 0x8(%rsp), %r12d
movl %r12d, 0x58(%rbx)
movl %r12d, 0x54(%rbx)
movl $0x1c2, 0x68(%rbx)      # imm = 0x1C2
imull 0xc(%rsp), %r12d
movslq %r12d, %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x260(%rbx)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, 0x268(%rbx)
cmpl $0x0, 0x10(%rsp)
jle 0x905f
movl %r15d, %eax
addl $0x3, %r15d
andl $-0x4, %r15d
decq %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x4c1ee(%rip), %xmm1    # 0x55170
movdqa 0x4c0f6(%rip), %xmm2    # 0x55080
xorl %eax, %eax
movdqa 0x4c0fc(%rip), %xmm3    # 0x55090
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x4c1dc(%rip), %xmm5    # 0x55180
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %ecx
notl %ecx
testb $0x1, %cl
je 0x8fe0
movl $0x3f000000, (%r14,%rax,4) # imm = 0x3F000000
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %ecx
testb $0x1, %cl
je 0x8ff7
movl $0x3f000000, 0x4(%r14,%rax,4) # imm = 0x3F000000
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %ecx
testb $0x1, %cl
je 0x9037
movl $0x3f000000, 0x8(%r14,%rax,4) # imm = 0x3F000000
pextrw $0x4, %xmm6, %ecx
testb $0x1, %cl
je 0x904a
movl $0x3f000000, 0xc(%r14,%rax,4) # imm = 0x3F000000
addq $0x4, %rax
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
cmpq %rax, %r15
jne 0x8fa4
leaq 0x37f56(%rip), %rax     # 0x40fbc
movq %rax, 0x10(%rbx)
leaq 0x388a5(%rip), %rax     # 0x41916
movq %rax, 0x18(%rbx)
movq 0x62f7c(%rip), %rax     # 0x6bff8
movq (%rax), %rcx
leaq 0x50e9a(%rip), %rdi     # 0x59f20
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