// File: /workspace/github_c_makefile_star2_O3/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, 0x68(%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
leal 0x1(%rsi,%rsi), %esi
cmovel %ecx, %edx
movl %edx, 0x4(%rbx)
movl %eax, (%rbx)
movl %esi, 0x8(%rbx)
imull %esi, %eax
imull %edx, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x3250
movq %rbx, 0x38(%rsp)
movq %rax, 0x10(%rbx)
testl %ebp, %ebp
jle 0x1b8f4
movl 0x34(%rsp), %eax
movq %rax, 0x60(%rsp)
movl %ebp, %eax
movq %rax, 0x58(%rsp)
xorl %eax, %eax
movq %rax, %r15
imulq 0x60(%rsp), %r15
movq %rax, 0x70(%rsp)
leaq (%rax,%rax,2), %rax
movq 0x68(%rsp), %rcx
movq 0x10(%rcx,%rax,8), %r14
movups (%rcx,%rax,8), %xmm0
movl (%rcx,%rax,8), %edx
movl 0x4(%rcx,%rax,8), %r12d
movl 0x8(%rcx,%rax,8), %ebx
movaps %xmm0, 0xa0(%rsp)
movl %r12d, 0x48(%rsp)
movl %edx, 0x4c(%rsp)
imull %edx, %r12d
movl %r12d, %eax
imull %ebx, %eax
movslq %eax, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x3250
movq %rax, 0xb0(%rsp)
shlq $0x2, %r13
movq %rax, 0x50(%rsp)
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x32b0
cmpl $0x3, 0x44(%rsp)
jne 0x1b7f7
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xa0(%rsp), %xmm0
movups %xmm0, (%rsp)
movl %r15d, %edi
xorl %esi, %esi
callq 0x162c2
jmp 0x1b8d2
movq %r15, 0x80(%rsp)
testl %ebx, %ebx
jle 0x1b8d2
movslq %r12d, %r13
movl %r13d, %eax
shlq $0x2, %rax
movq %rax, 0x78(%rsp)
movl %ebx, %r15d
xorl %ebx, %ebx
xorl %r14d, %r14d
movl 0x48(%rsp), %eax
movl %eax, 0x8c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x88(%rsp)
movl $0x1, 0x90(%rsp)
movl $0x4, %esi
movq %r13, %rdi
callq 0x3250
movq %rax, %rbp
movq %rax, 0x98(%rsp)
testl %r13d, %r13d
jle 0x1b875
movslq %ebx, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %rbp, %rdi
movq 0x78(%rsp), %rdx
callq 0x32b0
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rsp)
movq 0x80(%rsp), %rdi
movl %r14d, %esi
callq 0x162c2
testq %rbp, %rbp
je 0x1b8c1
movq %rbp, %rdi
callq 0x3040
addl 0x34(%rsp), %r14d
addl %r12d, %ebx
decq %r15
jne 0x1b81e
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1b8e1
callq 0x3040
movq 0x70(%rsp), %rax
incq %rax
cmpq 0x58(%rsp), %rax
jne 0x1b73c
movq 0x38(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq