// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/crnn_layer.c
// Function: forward_crnn_layer
void forward_crnn_layer(layer l, network net)
{
    network s = net;
    s.train = net.train;
    int i;
    layer input_layer = *(l.input_layer);
    layer self_layer = *(l.self_layer);
    layer output_layer = *(l.output_layer);

    fill_cpu(l.outputs * l.batch * l.steps, 0, output_layer.delta, 1);
    fill_cpu(l.hidden * l.batch * l.steps, 0, self_layer.delta, 1);
    fill_cpu(l.hidden * l.batch * l.steps, 0, input_layer.delta, 1);
    if(net.train) fill_cpu(l.hidden * l.batch, 0, l.state, 1);

    for (i = 0; i < l.steps; ++i) {
        s.input = net.input;
        forward_convolutional_layer(input_layer, s);

        s.input = l.state;
        forward_convolutional_layer(self_layer, s);

        float *old_state = l.state;
        if(net.train) l.state += l.hidden*l.batch;
        if(l.shortcut){
            copy_cpu(l.hidden * l.batch, old_state, 1, l.state, 1);
        }else{
            fill_cpu(l.hidden * l.batch, 0, l.state, 1);
        }
        axpy_cpu(l.hidden * l.batch, 1, input_layer.output, 1, l.state, 1);
        axpy_cpu(l.hidden * l.batch, 1, self_layer.output, 1, l.state, 1);

        s.input = l.state;
        forward_convolutional_layer(output_layer, s);

        net.input += l.inputs*l.batch;
        increment_layer(&input_layer, 1);
        increment_layer(&self_layer, 1);
        increment_layer(&output_layer, 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x14e0, %rsp           # imm = 0x14E0
leaq 0x4b0(%rbp), %rsi
movq %rsi, -0xf08(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0xf10(%rbp)
leaq -0x110(%rbp), %rdi
movl $0x110, %edx            # imm = 0x110
callq 0x3280
movq -0xf10(%rbp), %rax
movq -0xf08(%rbp), %rcx
movl 0xf8(%rcx), %ecx
movl %ecx, -0x18(%rbp)
movq 0x390(%rax), %rsi
leaq -0x5b8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movq 0x398(%rax), %rsi
leaq -0xa58(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movq 0x3a0(%rax), %rsi
leaq -0xef8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0xc98(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x7f8(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x358(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf08(%rbp), %rax
cmpl $0x0, 0xf8(%rax)
je 0x4a7f8
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movl $0x0, -0x114(%rbp)
movq -0xf10(%rbp), %rcx
movl -0x114(%rbp), %eax
cmpl 0xc0(%rcx), %eax
jge 0x4aa8f
movq -0xf08(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf20(%rbp)
movl $0x94, %ecx
leaq -0x5b8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf20(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x7bb0
movq -0xf10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf18(%rbp)
movl $0x94, %ecx
leaq -0xa58(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf18(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x7bb0
movq -0xf10(%rbp), %rcx
movq -0xf08(%rbp), %rax
movq 0x1e0(%rcx), %rcx
movq %rcx, -0xf00(%rbp)
cmpl $0x0, 0xf8(%rax)
je 0x4a903
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edx
imull 0x48(%rax), %edx
movq 0x1e0(%rax), %rcx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0x1e0(%rax)
movq -0xf10(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x4a93f
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
movq -0xf00(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
jmp 0x4a964
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
movq -0x350(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movss 0x26681(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0xf10(%rbp), %rax
movl 0xc4(%rax), %edi
imull 0x48(%rax), %edi
movq -0x7f0(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movss 0x2664c(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0xf10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf28(%rbp)
movl $0x94, %ecx
leaq -0xef8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf28(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x7bb0
movq -0xf10(%rbp), %rcx
movq -0xf08(%rbp), %rax
movl 0x54(%rcx), %edx
imull 0x48(%rcx), %edx
movq 0xd8(%rax), %rcx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0xd8(%rax)
leaq -0x5b8(%rbp), %rdi
movl $0x1, %esi
callq 0x4afc0
leaq -0xa58(%rbp), %rdi
movl $0x1, %esi
callq 0x4afc0
leaq -0xef8(%rbp), %rdi
movl $0x1, %esi
callq 0x4afc0
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x4a802
addq $0x14e0, %rsp           # imm = 0x14E0
popq %rbp
retq
nopl (%rax,%rax)