// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_sources.c
// Function: string_parse_em_fv
static er_t string_parse_em_fv( bcore_source_string_s* o, sc_t format, va_list args )
{
    if( o->ext_supplier ) string_refill( o, o->refill_limit );
    if( !o->string ) ERR( "No string defined." );

    struct { er_t er; st_s* msg; } er_arg;
    er_arg.er = 0;
    er_arg.msg = NULL;

    bl_t success = false;
    uz_t new_index = 0;

    while( !success )
    {
        new_index = st_s_parse_efv( o->string, o->index, o->string->size, string_s_parse_em_err, &er_arg, format, args );

        /** If in buffering mode and string parsing reached the end of buffered data, we clear all possible errors,
         *  double prefetch and refill limits, refill data and try parsing again.
         *  This situation should occur rarely so that we can tolerate the extra effort and memory overhead.
         */
        if( o->ext_supplier && ( ( new_index + 1 ) >= o->string->size ) )
        {

            success = false;

            // clear parse error if any
            er_arg.er = 0;
            if( er_arg.msg ) bcore_inst_a_discard( er_arg.msg );
            er_arg.msg = NULL;

            // refill with new limits
            o->refill_limit  = o->refill_limit * 2;
            o->prefetch_size = o->prefetch_size * 2;
            string_refill( o, o->refill_limit ); // turns buffering mode off after all data has been fetched
        }
        else
        {
            success = true;
        }
    }

    if( er_arg.er )
    {
        BLM_INIT();
        st_s* msg_main    = BLM_CREATE( st_s );
        st_s* msg_prefix  = BLM_CREATE( st_s );
        st_s* msg_context = BLM_CREATE( st_s );
        if( er_arg.msg ) BLM_A_PUSH( er_arg.msg );

        if( o->parent )
        {
            if( o->parent->data[ 0 ] && ( *( aware_t* )o->parent->data[ 0 ] ) == TYPEOF_bcore_source_file_s )
            {
                bcore_source_file_s* fo = o->parent->data[ 0 ];
                s3_t index = bcore_source_chain_s_get_index( o->parent );
                uz_t line, col;
                bcore_source_file_s_get_line_col_context( fo, index, &line, &col, msg_context );
                st_s_push_fa( msg_prefix, "#<sc_t>:#<uz_t>:#<uz_t>", bcore_source_file_s_get_name( fo ), line, col );
            }
        }
        else
        {
            msg_context = BLM_A_PUSH( st_s_show_line_context( o->string, o->index ) );
            uz_t line = st_s_lineof( o->string, o->index );
            uz_t col  = st_s_colof( o->string, o->index );
            st_s_push_fa( msg_prefix, "At line #<uz_t>, col #<uz_t>", line, col );
        }

        st_s_push_fa( msg_main, "\n#<sc_t>: error: #<sc_t>", msg_prefix->sc, er_arg.msg ? er_arg.msg->sc : "" );
        st_s_push_fa( msg_main, "\n#<sc_t>\n", msg_context->sc );

        bcore_error_push_sc( er_arg.er, msg_main->sc );
        BLM_DOWN();
    }
    o->index = new_index;
    return er_arg.er;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xd00a3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xcf920
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd00cf
leaq 0x821ad(%rip), %rdi     # 0x152262
leaq 0x81cff(%rip), %rsi     # 0x151dbb
movl $0x358, %edx            # imm = 0x358
leaq 0x821ad(%rip), %rcx     # 0x152275
movb $0x0, %al
callq 0x9cf40
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movb $0x0, -0x29(%rbp)
movq $0x0, -0x38(%rbp)
movb -0x29(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xd00f9
jmp 0xd01bc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %r9
movq -0x18(%rbp), %rax
leaq 0x39c(%rip), %rcx       # 0xd04c0
leaq -0x28(%rbp), %r8
movq %rax, (%rsp)
callq 0x101ef0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xd01b3
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0xd01b3
movb $0x0, -0x29(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xd0172
movq -0x20(%rbp), %rdi
callq 0xcfc80
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
shlq %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rcx
shlq %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xcf920
jmp 0xd01b7
movb $0x1, -0x29(%rbp)
jmp 0xd00eb
cmpq $0x0, -0x28(%rbp)
je 0xd04a7
leaq 0xe2162(%rip), %rax     # 0x1b2330
movq (%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xbfe80
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
movb $0x0, %al
callq 0xff2e0
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
callq 0xc00e0
movq %rax, -0x80(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xd0(%rbp)
movb $0x0, %al
callq 0xff2e0
movq -0xd0(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
callq 0xc00e0
movq %rax, -0x88(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xc8(%rbp)
movb $0x0, %al
callq 0xff2e0
movq -0xc8(%rbp), %rdi
movq %rax, %rdx
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
callq 0xc00e0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xd0299
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xc0460
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xd0377
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
je 0xd0372
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movabsq $0x766eac77ec0f2a97, %rcx # imm = 0x766EAC77EC0F2A97
cmpq %rcx, (%rax)
jne 0xd0372
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xcb600
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq -0x90(%rbp), %r8
leaq -0xa8(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0xccc10
movq -0x88(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x98(%rbp), %rdi
callq 0xcc8a0
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
movq -0xa8(%rbp), %rcx
movq -0xb0(%rbp), %r8
leaq 0x81f1d(%rip), %rsi     # 0x152288
movb $0x0, %al
callq 0x100210
jmp 0xd0408
movq -0x40(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x101d20
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0xc0460
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1018c0
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1018f0
movq %rax, -0xc0(%rbp)
movq -0x88(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movq -0xc0(%rbp), %rcx
leaq 0x81e9f(%rip), %rsi     # 0x1522a0
movb $0x0, %al
callq 0x100210
movq -0x80(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xd043d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x100(%rbp)
jmp 0xd044d
leaq 0x825de(%rip), %rax     # 0x152a22
movq %rax, -0x100(%rbp)
jmp 0xd044d
movq -0xf0(%rbp), %rdx
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rcx
leaq 0x81e54(%rip), %rsi     # 0x1522bd
movb $0x0, %al
callq 0x100210
movq -0x80(%rbp), %rdi
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x8838a(%rip), %rsi     # 0x158810
movb $0x0, %al
callq 0x100210
movq -0x28(%rbp), %rdi
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x9df70
leaq -0x78(%rbp), %rdi
callq 0xc06e0
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq