// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/maxpool_layer.c
// Function: make_maxpool_layer
maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding)
{
    maxpool_layer l = {0};
    l.type = MAXPOOL;
    l.batch = batch;
    l.h = h;
    l.w = w;
    l.c = c;
    l.pad = padding;
    l.out_w = (w + padding - size)/stride + 1;
    l.out_h = (h + padding - size)/stride + 1;
    l.out_c = c;
    l.outputs = l.out_h * l.out_w * l.out_c;
    l.inputs = h*w*c;
    l.size = size;
    l.stride = stride;
    int output_size = l.out_h * l.out_w * l.out_c * batch;
    l.indexes = calloc(output_size, sizeof(int));
    l.output =  calloc(output_size, sizeof(float));
    l.delta =   calloc(output_size, sizeof(float));
    l.forward = forward_maxpool_layer;
    l.backward = backward_maxpool_layer;
    fprintf(stderr, "max          %d x %d / %d  %4d x%4d x%4d   ->  %4d x%4d x%4d\n", size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c);
    return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x30(%rbp)
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
xorl %esi, %esi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3190
movq -0x38(%rbp), %rdi
movl $0x3, (%rdi)
movl -0x14(%rbp), %eax
movl %eax, 0x48(%rdi)
movl -0x18(%rbp), %eax
movl %eax, 0x6c(%rdi)
movl -0x1c(%rbp), %eax
movl %eax, 0x70(%rdi)
movl -0x20(%rbp), %eax
movl %eax, 0x74(%rdi)
movl 0x18(%rbp), %eax
movl %eax, 0xa8(%rdi)
movl -0x1c(%rbp), %eax
addl 0x18(%rbp), %eax
subl -0x24(%rbp), %eax
cltd
idivl 0x10(%rbp)
addl $0x1, %eax
movl %eax, 0x7c(%rdi)
movl -0x18(%rbp), %eax
addl 0x18(%rbp), %eax
subl -0x24(%rbp), %eax
cltd
idivl 0x10(%rbp)
addl $0x1, %eax
movl %eax, 0x78(%rdi)
movl -0x20(%rbp), %eax
movl %eax, 0x80(%rdi)
movl 0x78(%rdi), %eax
imull 0x7c(%rdi), %eax
imull 0x80(%rdi), %eax
movl %eax, 0x58(%rdi)
movl -0x18(%rbp), %eax
imull -0x1c(%rbp), %eax
imull -0x20(%rbp), %eax
movl %eax, 0x54(%rdi)
movl -0x24(%rbp), %eax
movl %eax, 0x90(%rdi)
movl 0x10(%rbp), %eax
movl %eax, 0x98(%rdi)
movl 0x78(%rdi), %eax
imull 0x7c(%rdi), %eax
imull 0x80(%rdi), %eax
imull -0x14(%rbp), %eax
movl %eax, -0x28(%rbp)
movslq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq -0x38(%rbp), %rdi
movq %rax, 0x1a0(%rdi)
movslq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq -0x38(%rbp), %rdi
movq %rax, 0x268(%rdi)
movslq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x260(%rax)
leaq 0x72(%rip), %rcx        # 0x30c80
movq %rcx, 0x10(%rax)
leaq 0x327(%rip), %rcx       # 0x30f40
movq %rcx, 0x18(%rax)
movq 0x523d4(%rip), %rcx     # 0x82ff8
movq (%rcx), %rdi
movl -0x24(%rbp), %edx
movl -0x24(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl -0x1c(%rbp), %r9d
movl -0x18(%rbp), %r14d
movl -0x20(%rbp), %ebx
movl 0x7c(%rax), %r11d
movl 0x78(%rax), %r10d
movl 0x80(%rax), %eax
leaq 0x43601(%rip), %rsi     # 0x74252
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x3240
movq -0x30(%rbp), %rax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)