// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/lib/bcore/bcore_arr.c
// Function: bcore_arr_st_s_table_to_sink
void bcore_arr_st_s_table_to_sink( const bcore_arr_st_s* o, sz_t rows, sz_t cols, bcore_sink* sink )
{
    rows = ( rows < 0 ) ? ( ( cols > 0 ) ? o->size / cols : o->size ) : rows;
    cols = ( cols < 0 ) ? ( ( rows > 0 ) ? o->size / rows : o->size ) : cols;
    rows = ( cols * rows > o->size ) ? o->size / cols : rows;

    bcore_arr_sz_s* col_sz = bcore_arr_sz_s_create();
    bcore_arr_sz_s_fill( col_sz, cols, 0 );

    for( sz_t i = 0; i < o->size; i++ )
    {
        sz_t size = o->data[ i ] ? o->data[ i ]->size : 0;
        col_sz->data[ i % cols ] = sz_max( col_sz->data[ i % cols ], size );
    }

    for( sz_t i = 0; i < o->size; i++ )
    {
        sz_t size = o->data[ i ] ? o->data[ i ]->size : 0;
        sc_t sc = o->data[ i ] ? o->data[ i ]->sc : "";
        if( ( i + 1 ) % cols == 0 )
        {
            bcore_sink_a_push_fa( sink, "#<sc_t>\n", sc );
        }
        else
        {
            bcore_sink_a_push_fa( sink, "#<sc_t>#rn{ }", sc, col_sz->data[ i % cols ] - size );
        }
    }

    bcore_arr_sz_s_discard( col_sz );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
testq %rsi, %rsi
jns 0xc3cdc
movq 0x10(%r14), %rsi
testq %r15, %r15
jle 0xc3cdc
movq %rsi, %rax
xorl %edx, %edx
divq %r15
movq %rax, %rsi
testq %r15, %r15
jns 0xc3cf5
movq 0x10(%r14), %r15
testq %rsi, %rsi
jle 0xc3cf5
movq %r15, %rax
xorl %edx, %edx
divq %rsi
movq %rax, %r15
movl $0x20, %esi
xorl %edi, %edi
callq 0xc8315
movq %rax, %r12
movl $0x20, %esi
movq %rax, %rdi
callq 0xc8366
movabsq $0x3d19b4fc81c235e4, %rax # imm = 0x3D19B4FC81C235E4
movq %rax, (%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0xbfe41
testq %r15, %r15
je 0xc3d46
xorl %eax, %eax
movq 0x8(%r12), %rcx
movq $0x0, (%rcx,%rax,8)
incq %rax
cmpq %rax, %r15
jne 0xc3d31
movq %r15, 0x10(%r12)
cmpq $0x0, 0x10(%r14)
je 0xc3d8e
xorl %ecx, %ecx
movq 0x8(%r14), %rax
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0xc3d67
movq 0x10(%rax), %rsi
jmp 0xc3d69
xorl %esi, %esi
movq 0x8(%r12), %rdi
movq %rcx, %rax
cqto
idivq %r15
movq (%rdi,%rdx,8), %rax
cmpq %rsi, %rax
cmovgq %rax, %rsi
movq %rsi, (%rdi,%rdx,8)
incq %rcx
cmpq 0x10(%r14), %rcx
jb 0xc3d54
cmpq $0x0, 0x10(%r14)
je 0xc3e1b
leaq 0x8f94f(%rip), %rbp     # 0x1536ef
xorl %ecx, %ecx
movq 0x8(%r14), %rax
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0xc3db5
movq 0x10(%rax), %rsi
jmp 0xc3db7
xorl %esi, %esi
movq %rbp, %r8
testq %rax, %rax
je 0xc3dc3
movq 0x8(%rax), %r8
leaq 0x1(%rcx), %r13
movq %r13, %rax
cqto
idivq %r15
testq %rdx, %rdx
je 0xc3dfe
movq 0x8(%r12), %rdi
movq %rcx, %rax
cqto
idivq %r15
movq (%rdi,%rdx,8), %rcx
subq %rsi, %rcx
movq %rbx, %rdi
leaq 0x89966(%rip), %rsi     # 0x14d758
movq %r8, %rdx
xorl %eax, %eax
callq 0x109273
jmp 0xc3e12
movq %rbx, %rdi
leaq 0x95200(%rip), %rsi     # 0x159008
movq %r8, %rdx
xorl %eax, %eax
callq 0x109273
movq %r13, %rcx
cmpq 0x10(%r14), %r13
jb 0xc3da2
leaq -0x4122(%rip), %rdi     # 0xbfd00
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc8352