// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/image.c
// Function: collapse_images_vert
image collapse_images_vert(image *ims, int n)
{
    int color = 1;
    int border = 1;
    int h,w,c;
    w = ims[0].w;
    h = (ims[0].h + border) * n - border;
    c = ims[0].c;
    if(c != 3 || !color){
        w = (w+border)*c - border;
        c = 1;
    }

    image filters = make_image(w, h, c);
    int i,j;
    for(i = 0; i < n; ++i){
        int h_offset = i*(ims[0].h+border);
        image copy = copy_image(ims[i]);
        //normalize_image(copy);
        if(c == 3 && color){
            embed_image(copy, filters, 0, h_offset);
        }
        else{
            for(j = 0; j < copy.c; ++j){
                int w_offset = j*(ims[0].w+border);
                image layer = get_image_layer(copy, j);
                embed_image(layer, filters, w_offset, h_offset);
                free_image(layer);
            }
        }
        free_image(copy);
    }
    return filters;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %ebp
movq %rdi, %rbx
movl (%rsi), %ecx
movl 0x4(%rsi), %eax
incl %eax
imull %edx, %eax
decl %eax
movq %rsi, 0x58(%rsp)
movl 0x8(%rsi), %edi
leal 0x1(%rcx), %edx
imull %edi, %edx
decl %edx
xorl %esi, %esi
movl %edi, 0x44(%rsp)
cmpl $0x3, %edi
sete %sil
cmovel %ecx, %edx
leal 0x1(%rsi,%rsi), %ecx
movq $0x0, 0x10(%rbx)
movl %eax, 0x4(%rbx)
movl %edx, (%rbx)
movl %ecx, 0x8(%rbx)
imull %ecx, %eax
imull %edx, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3260
movq %rbx, 0x38(%rsp)
movq %rax, 0x10(%rbx)
testl %ebp, %ebp
jle 0x1ae94
movl %ebp, %eax
movq %rax, 0x90(%rsp)
xorl %ecx, %ecx
movq 0x58(%rsp), %rdx
movl 0x4(%rdx), %eax
incl %eax
movl %ecx, %ebp
imull %eax, %ebp
movq %rcx, 0x98(%rsp)
leaq (%rcx,%rcx,2), %rax
movl (%rdx,%rax,8), %esi
movl 0x4(%rdx,%rax,8), %edi
movl 0x8(%rdx,%rax,8), %r15d
movl 0xc(%rdx,%rax,8), %ecx
movq 0x10(%rdx,%rax,8), %r14
movl %esi, 0x60(%rsp)
movl %edi, 0x64(%rsp)
movl %r15d, 0x68(%rsp)
movl %ecx, 0x6c(%rsp)
movq %r14, 0x70(%rsp)
movl %edi, 0x48(%rsp)
movl %edi, %eax
movl %esi, 0x4c(%rsp)
imull %esi, %eax
movl %eax, 0x34(%rsp)
imull %r15d, %eax
movslq %eax, %r12
movl $0x4, %esi
movq %r12, %rdi
callq 0x3260
movq %rax, 0x70(%rsp)
shlq $0x2, %r12
movq %rax, 0x50(%rsp)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x32c0
cmpl $0x3, 0x44(%rsp)
jne 0x1ad65
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
xorl %edi, %edi
movl %ebp, %esi
callq 0x158a0
jmp 0x1ae6c
testl %r15d, %r15d
jle 0x1ae6c
movslq 0x34(%rsp), %rax
movq %rax, 0xa8(%rsp)
movl %eax, %eax
shlq $0x2, %rax
movq %rax, 0xa0(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r15, 0xb0(%rsp)
movl %ebp, %r15d
movq 0x58(%rsp), %rax
movl (%rax), %ebp
movq $0x0, 0x88(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x78(%rsp)
movl $0x1, 0x80(%rsp)
movl $0x4, %esi
movq 0xa8(%rsp), %r12
movq %r12, %rdi
callq 0x3260
movq %rax, %r14
movq %rax, 0x88(%rsp)
testl %r12d, %r12d
jle 0x1ae08
movslq %r13d, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %r14, %rdi
movq 0xa0(%rsp), %rdx
callq 0x32c0
incl %ebp
movl %ebx, %edi
imull %ebp, %edi
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x78(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %ebp
movl %r15d, %esi
callq 0x158a0
testq %r14, %r14
je 0x1ae53
movq %r14, %rdi
callq 0x3040
incq %rbx
addl 0x34(%rsp), %r13d
movq 0xb0(%rsp), %r15
cmpq %rbx, %r15
jne 0x1ad96
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1ae7b
callq 0x3040
movq 0x98(%rsp), %rcx
incq %rcx
cmpq 0x90(%rsp), %rcx
jne 0x1aca0
movq 0x38(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq