// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/rnn_layer.c
// Function: make_rnn_layer
layer make_rnn_layer(int batch, int inputs, int outputs, int steps, ACTIVATION activation, int batch_normalize, int adam)
{
    fprintf(stderr, "RNN Layer: %d inputs, %d outputs\n", inputs, outputs);
    batch = batch / steps;
    layer l = {0};
    l.batch = batch;
    l.type = RNN;
    l.steps = steps;
    l.inputs = inputs;

    l.state = calloc(batch*outputs, sizeof(float));
    l.prev_state = calloc(batch*outputs, sizeof(float));

    l.input_layer = malloc(sizeof(layer));
    fprintf(stderr, "\t\t");
    *(l.input_layer) = make_connected_layer(batch*steps, inputs, outputs, activation, batch_normalize, adam);
    l.input_layer->batch = batch;

    l.self_layer = malloc(sizeof(layer));
    fprintf(stderr, "\t\t");
    *(l.self_layer) = make_connected_layer(batch*steps, outputs, outputs, activation, batch_normalize, adam);
    l.self_layer->batch = batch;

    l.output_layer = malloc(sizeof(layer));
    fprintf(stderr, "\t\t");
    *(l.output_layer) = make_connected_layer(batch*steps, outputs, outputs, activation, batch_normalize, adam);
    l.output_layer->batch = batch;

    l.outputs = outputs;
    l.output = l.output_layer->output;
    l.delta = l.output_layer->delta;

    l.forward = forward_rnn_layer;
    l.backward = backward_rnn_layer;
    l.update = update_rnn_layer;

    return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe30, %rsp            # imm = 0xE30
movq %rdi, -0xe08(%rbp)
movq %rdi, -0xe00(%rbp)
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movl %esi, -0x4(%rbp)
movl %edx, -0x8(%rbp)
movl %ecx, -0xc(%rbp)
movl %r8d, -0x10(%rbp)
movl %r9d, -0x14(%rbp)
movq 0x3a8f1(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq 0x2cd7b(%rip), %rsi     # 0x75492
movb $0x0, %al
callq 0x3240
movq -0xe08(%rbp), %rdi
movl -0x4(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0x4(%rbp)
xorl %esi, %esi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3190
movq -0xe08(%rbp), %rdi
movl -0x4(%rbp), %eax
movl %eax, 0x48(%rdi)
movl $0xf, (%rdi)
movl -0x10(%rbp), %eax
movl %eax, 0xc0(%rdi)
movl -0x8(%rbp), %eax
movl %eax, 0x54(%rdi)
movl -0x4(%rbp), %eax
imull -0xc(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0xe08(%rbp), %rdi
movq %rax, 0x1e0(%rdi)
movl -0x4(%rbp), %eax
imull -0xc(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0xe08(%rbp), %rdi
movq %rax, 0x1e8(%rdi)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0xe08(%rbp), %rdi
movq %rax, 0x390(%rdi)
movq 0x3a838(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2ccea(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0xe08(%rbp), %rdi
movq 0x390(%rdi), %rax
movq %rax, -0xe20(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r8d
movl 0x10(%rbp), %r9d
movl 0x18(%rbp), %eax
leaq -0x4b8(%rbp), %rdi
movl %eax, (%rsp)
callq 0x3c260
movq -0xe20(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xe08(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x390(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0xe08(%rbp), %rdi
movq %rax, 0x398(%rdi)
movq 0x3a7a0(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2cc52(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0xe08(%rbp), %rdi
movq 0x398(%rdi), %rax
movq %rax, -0xe18(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r8d
movl 0x10(%rbp), %r9d
movl 0x18(%rbp), %eax
leaq -0x958(%rbp), %rdi
movl %eax, (%rsp)
callq 0x3c260
movq -0xe18(%rbp), %rdi
leaq -0x958(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xe08(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x398(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0xe08(%rbp), %rdi
movq %rax, 0x3a0(%rdi)
movq 0x3a708(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2cbba(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0xe08(%rbp), %rdi
movq 0x3a0(%rdi), %rax
movq %rax, -0xe10(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r8d
movl 0x10(%rbp), %r9d
movl 0x18(%rbp), %eax
leaq -0xdf8(%rbp), %rdi
movl %eax, (%rsp)
callq 0x3c260
movq -0xe10(%rbp), %rdi
leaq -0xdf8(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xe08(%rbp), %rdi
movq -0xe00(%rbp), %rax
movl -0x4(%rbp), %edx
movq 0x3a0(%rdi), %rcx
movl %edx, 0x48(%rcx)
movl -0xc(%rbp), %ecx
movl %ecx, 0x58(%rdi)
movq 0x3a0(%rdi), %rcx
movq 0x268(%rcx), %rcx
movq %rcx, 0x268(%rdi)
movq 0x3a0(%rdi), %rcx
movq 0x260(%rcx), %rcx
movq %rcx, 0x260(%rdi)
leaq 0x29(%rip), %rcx        # 0x489d0
movq %rcx, 0x10(%rdi)
leaq 0x3fe(%rip), %rcx       # 0x48db0
movq %rcx, 0x18(%rdi)
leaq 0x813(%rip), %rcx       # 0x491d0
movq %rcx, 0x20(%rdi)
addq $0xe30, %rsp            # imm = 0xE30
popq %rbp
retq
nopw (%rax,%rax)