// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/lib/bcore/bcore_sources.c
// Function: string_refill
static void string_refill( bcore_source_string_s* o, uz_t min_remaining_size )
{
    if( !o->string ) o->string = st_s_create();
    if( o->string->size - o->index <= min_remaining_size )
    {
        if( o->index > 0 )
        {
            bcore_memmove( o->string->data, o->string->data + o->index, o->string->size - o->index );
            o->string->size -= o->index;
            o->string->data[ o->string->size ] = 0;
            o->index = 0;
        }
        uz_t refill_size = min_remaining_size - o->string->size > o->prefetch_size ? min_remaining_size - o->string->size : o->prefetch_size;
        st_s_set_min_space( o->string, o->string->size + refill_size + 1 );
        uz_t bytes_received = bcore_source_a_get_data( o->ext_supplier, o->string->data + o->string->size, refill_size );
        if( bytes_received < refill_size )
        {
            if( bcore_source_a_eos( o->ext_supplier ) ) o->ext_supplier = NULL; // detach supplier when empty
        }
        o->string->size += bytes_received;
        o->string->data[ o->string->size ] = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
jne 0xf2df1
xorl %eax, %eax
callq 0x114bbb
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rsi
movq 0x10(%rax), %rdx
subq %rsi, %rdx
cmpq %r14, %rdx
ja 0xf3004
testq %rsi, %rsi
je 0xf2e3a
movq 0x8(%rax), %rdi
addq %rdi, %rsi
callq 0xc8471
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rcx
subq 0x10(%rbx), %rcx
movq 0x8(%rax), %rdx
movq %rcx, 0x10(%rax)
movb $0x0, (%rdx,%rcx)
movq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rdi
movq 0x28(%rbx), %rax
movq 0x10(%rdi), %rcx
subq %rcx, %r14
cmpq %rax, %r14
cmovbeq %rax, %r14
leaq (%rcx,%r14), %rsi
incq %rsi
callq 0x1151a6
movq 0x8(%rbx), %rax
movq 0x18(%rbx), %r15
movq 0x8(%rax), %r12
addq 0x10(%rax), %r12
movq (%r15), %r13
leaq 0xb6e52(%rip), %rdx     # 0x1a9cc8
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0xf2ecf
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0xf2ecf
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0xf2ecf
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0xf3013
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0xf2eff
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %r13, %rsi
callq 0xf3f85
movq %rax, %rbp
leaq 0xb6dd4(%rip), %rdi     # 0x1a9cc8
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
cmpq $0x0, 0x10(%rbp)
jne 0xf2f15
leaq 0x52011(%rip), %rsi     # 0x144f1e
movq %rbp, %rdi
callq 0xf592c
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *0x10(%rbp)
movq %rax, %r15
cmpq %r14, %rax
jae 0xf2fed
movq 0x18(%rbx), %r14
movq (%r14), %r12
leaq 0xb6d8d(%rip), %rdx     # 0x1a9cc8
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r12, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xf2f94
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xf2f94
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xf2f94
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xf301a
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0xf2fc4
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %r12, %rsi
callq 0xf3f85
movq %rax, %r13
leaq 0xb6d0f(%rip), %rdi     # 0x1a9cc8
movq %r12, %rsi
movq %rax, %rdx
callq 0x12128c
cmpq $0x0, 0x40(%r13)
jne 0xf2fda
leaq 0x51f3f(%rip), %rsi     # 0x144f11
movq %r13, %rdi
callq 0xf592c
movq %r14, %rdi
callq *0x40(%r13)
testb %al, %al
je 0xf2fed
movq $0x0, 0x18(%rbx)
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rcx
addq %r15, %rcx
movq %rcx, 0x10(%rax)
movq 0x8(%rax), %rax
movb $0x0, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0xf2ed3
xorl %r13d, %r13d
jmp 0xf2f98