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

    image filters = make_image(w, h, c);
    int i,j;
    for(i = 0; i < n; ++i){
        int w_offset = i*(size+border);
        image copy = copy_image(ims[i]);
        //normalize_image(copy);
        if(c == 3 && color){
            embed_image(copy, filters, w_offset, 0);
        }
        else{
            for(j = 0; j < copy.c; ++j){
                int h_offset = j*(size+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), %eax
movl 0x4(%rsi), %ecx
incl %eax
imull %edx, %eax
decl %eax
movq %rsi, 0x98(%rsp)
movl 0x8(%rsi), %edi
leal 0x1(%rcx), %esi
movl %edi, %edx
movl %esi, 0x34(%rsp)
imull %esi, %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 %edx, 0x4(%rbx)
movl %eax, (%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 0x1b116
movl 0x34(%rsp), %eax
movq %rax, 0x90(%rsp)
movl %ebp, %eax
movq %rax, 0x88(%rsp)
xorl %eax, %eax
movq %rax, %r12
imulq 0x90(%rsp), %r12
movq %rax, 0xa0(%rsp)
leaq (%rax,%rax,2), %rax
movq 0x98(%rsp), %rdx
movl (%rdx,%rax,8), %esi
movl 0x4(%rdx,%rax,8), %r15d
movl 0x8(%rdx,%rax,8), %ebx
movl 0xc(%rdx,%rax,8), %ecx
movq 0x10(%rdx,%rax,8), %r14
movl %esi, 0x58(%rsp)
movl %r15d, 0x5c(%rsp)
movl %ebx, 0x60(%rsp)
movl %ecx, 0x64(%rsp)
movq %r14, 0x68(%rsp)
movl %r15d, 0x48(%rsp)
movl %esi, 0x4c(%rsp)
imull %esi, %r15d
movl %r15d, %eax
imull %ebx, %eax
movslq %eax, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x3260
movq %rax, 0x68(%rsp)
shlq $0x2, %r13
movq %rax, 0x50(%rsp)
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x32c0
cmpl $0x3, 0x44(%rsp)
jne 0x1b00f
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %r12d, %edi
xorl %esi, %esi
callq 0x158a0
jmp 0x1b0ee
movq %r12, 0xb0(%rsp)
testl %ebx, %ebx
jle 0x1b0ee
movslq %r15d, %r13
movl %r13d, %eax
shlq $0x2, %rax
movq %rax, 0xa8(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
movq $0x0, 0x80(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x70(%rsp)
movl $0x1, 0x78(%rsp)
movl $0x4, %esi
movq %r13, %rdi
callq 0x3260
movq %rax, %rbp
movq %rax, 0x80(%rsp)
testl %r13d, %r13d
jle 0x1b094
movslq %r12d, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %rbp, %rdi
movq 0xa8(%rsp), %rdx
callq 0x32c0
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movq 0xb0(%rsp), %rdi
movl %r14d, %esi
callq 0x158a0
testq %rbp, %rbp
je 0x1b0dd
movq %rbp, %rdi
callq 0x3040
addl 0x34(%rsp), %r14d
addl %r15d, %r12d
decq %rbx
jne 0x1b037
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1b0fd
callq 0x3040
movq 0xa0(%rsp), %rax
incq %rax
cmpq 0x88(%rsp), %rax
jne 0x1af46
movq 0x38(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq