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

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

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

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

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



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

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

    l.batch_normalize = batch_normalize;


    l.outputs = outputs;
    l.output = calloc(outputs*batch*steps, sizeof(float));
    l.delta = calloc(outputs*batch*steps, sizeof(float));
    l.state = calloc(outputs*batch, sizeof(float));
    l.prev_state = calloc(outputs*batch, sizeof(float));
    l.forgot_state = calloc(outputs*batch, sizeof(float));
    l.forgot_delta = calloc(outputs*batch, sizeof(float));

    l.r_cpu = calloc(outputs*batch, sizeof(float));
    l.z_cpu = calloc(outputs*batch, sizeof(float));
    l.h_cpu = calloc(outputs*batch, sizeof(float));

    l.forward = forward_gru_layer;
    l.backward = backward_gru_layer;
    l.update = update_gru_layer;


    return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c20, %rsp           # imm = 0x1C20
movq %rdi, -0x1be8(%rbp)
movq %rdi, -0x1be0(%rbp)
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 0x39c64(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
leaq 0x2c113(%rip), %rsi     # 0x754b7
movb $0x0, %al
callq 0x3240
movq -0x1be8(%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 -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %eax
movl %eax, 0x48(%rdi)
movl $0x10, (%rdi)
movl -0x10(%rbp), %eax
movl %eax, 0xc0(%rdi)
movl -0x8(%rbp), %eax
movl %eax, 0x54(%rdi)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x428(%rdi)
movq 0x39bef(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2c0a1(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x428(%rdi), %rax
movq %rax, -0x1c18(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0x4b8(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1c18(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x428(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x420(%rdi)
movq 0x39b55(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2c007(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x420(%rdi), %rax
movq %rax, -0x1c10(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0x958(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1c10(%rbp), %rdi
leaq -0x958(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x420(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x438(%rdi)
movq 0x39abb(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2bf6d(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x438(%rdi), %rax
movq %rax, -0x1c08(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0xdf8(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1c08(%rbp), %rdi
leaq -0xdf8(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x438(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x430(%rdi)
movq 0x39a21(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2bed3(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x430(%rdi), %rax
movq %rax, -0x1c00(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0x1298(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1c00(%rbp), %rdi
leaq -0x1298(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x430(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x448(%rdi)
movq 0x39987(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2be39(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x448(%rdi), %rax
movq %rax, -0x1bf8(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0x1738(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1bf8(%rbp), %rdi
leaq -0x1738(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x448(%rdi), %rax
movl %ecx, 0x48(%rax)
movl $0x4a0, %edi            # imm = 0x4A0
callq 0x32d0
movq -0x1be8(%rbp), %rdi
movq %rax, 0x440(%rdi)
movq 0x398ed(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
leaq 0x2bd9f(%rip), %rsi     # 0x754b4
movb $0x0, %al
callq 0x3240
movq -0x1be8(%rbp), %rdi
movq 0x440(%rdi), %rax
movq %rax, -0x1bf0(%rbp)
movl -0x4(%rbp), %esi
imull -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r9d
movl 0x10(%rbp), %eax
leaq -0x1bd8(%rbp), %rdi
movl $0x3, %r8d
movl %eax, (%rsp)
callq 0x3c260
movq -0x1bf0(%rbp), %rdi
leaq -0x1bd8(%rbp), %rsi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1be8(%rbp), %rdi
movl -0x4(%rbp), %ecx
movq 0x440(%rdi), %rax
movl %ecx, 0x48(%rax)
movl -0x14(%rbp), %eax
movl %eax, 0x40(%rdi)
movl -0xc(%rbp), %eax
movl %eax, 0x58(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
imull -0x10(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x268(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
imull -0x10(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x260(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x1e0(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x1e8(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x1f0(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x1f8(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x308(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, 0x300(%rdi)
movl -0xc(%rbp), %eax
imull -0x4(%rbp), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3220
movq -0x1be8(%rbp), %rdi
movq %rax, %rcx
movq -0x1be0(%rbp), %rax
movq %rcx, 0x310(%rdi)
leaq 0x23(%rip), %rcx        # 0x49900
movq %rcx, 0x10(%rdi)
leaq 0x748(%rip), %rcx       # 0x4a030
movq %rcx, 0x18(%rdi)
leaq 0x74d(%rip), %rcx       # 0x4a040
movq %rcx, 0x20(%rdi)
addq $0x1c20, %rsp           # imm = 0x1C20
popq %rbp
retq