// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: bcore_shell_loop
er_t bcore_shell_loop( bcore_shell* o, const bcore_main_frame_s* frame, bcore_shell_control_s* control )
{
    // bcore_shell.h:422:1
    BLM_INIT_LEVEL(0);
    if( !control        ) control = ((bcore_shell_control_s*)BLM_LEVEL_T_PUSH(0,bcore_shell_control_s,bcore_shell_control_s_create()));
    if( !control->source ) x_source_a_attach( &(control->source ), (x_source*)( ((bcore_source*)bcore_fork(frame->source))));
    if( !control->sink   ) x_sink_a_attach( &(control->sink   ), (x_sink*)( ((bcore_sink*)bcore_fork(frame->sink))));
    
    while( !x_source_eos(control->source) && !bcore_shell_control_s_exit_loop(control) && !bcore_shell_a_loop_callback(o) )
    {BLM_INIT_LEVEL(1);
        if( control->prompt.size > 0 )
        {
            x_sink_flush(x_sink_push_fa(control->sink,"\n#<sc_t>> ", control->prompt.sc ));
        }
        else
        {
            x_sink_flush(x_sink_push_fa(control->sink,"\n#<sc_t>#<sc_t>(#<sc_t>)> ", control->path.sc, control->path.size ? " " : "", bnameof( o->_ ) ));
        }
        bcore_shell_control_s_reset(control);
    
        st_s expression;BLM_T_INIT_SPUSH(st_s, &expression);;
        BLM_TRY(x_source_parse_fa(control->source," #until'\n'#skip'\n'", (&(expression)) ))
    
        if( expression.size > 0 )
        {BLM_INIT_LEVEL(2);
            if( x_hmap_tp_exists(((const x_hmap_tp*)(&(control->hmap_alias))),btypeof( expression.sc ) ) )
            {
                st_s_copy(&(expression),((const st_s*)(x_hmap_tp_c_get(((const x_hmap_tp*)(&(control->hmap_alias))),btypeof( expression.sc ) ))) );
            }
    
            if( !bcore_shell_run_expression(o,frame, control, ((x_source*)BLM_LEVEL_A_PUSH(2,x_source_create_from_st(&(expression )))) ) )
            {
                x_sink_push_fa(control->sink,"Syntax error in expression '#<sc_t>'\n", expression.sc );
                bcore_shell_help_to_sink(o,control,((bcore_sink*)( control->sink )));
            }
        BLM_DOWN();}
    BLM_DOWN();}
    
    control->exit_loop = false;
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdx, %r15
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0xe5a4f(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbx)
testq %r15, %r15
jne 0x323bc
callq 0x3295b
leaq 0x58(%rsp), %rdi
movabsq $0x65568789b6f2bdaf, %rdx # imm = 0x65568789B6F2BDAF
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r15
leaq 0x18(%r15), %rbx
cmpq $0x0, 0x18(%r15)
jne 0x323e3
movq 0x10(%rsp), %rax
movq 0xd0(%rax), %rdi
callq 0x6026d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3264f
cmpq $0x0, 0x10(%r15)
jne 0x32410
movq %rbx, %r13
leaq 0x10(%r15), %rbx
movq 0x10(%rsp), %rax
movq 0xd8(%rax), %rdi
callq 0x6026d
movq %rbx, %rdi
movq %r13, %rbx
movq %rax, %rsi
callq 0x32682
leaq 0x50(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %r12
movq %rbx, 0x28(%rsp)
movq (%rbx), %rdi
callq 0x2ef3b
testb %al, %al
jne 0x32616
cmpb $0x0, 0x88(%r15)
jne 0x32616
movq %r14, %rdi
callq 0x5844b
movq %r14, %rdi
callq *0x10(%rax)
testb %al, %al
jne 0x32616
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x8(%rsp)
leaq 0x58(%rsp), %rsi
callq 0x717f5
movq 0x8(%rsp), %r13
movq $0x1, 0x10(%r13)
cmpq $0x0, 0xc0(%r15)
movq 0x10(%r15), %rbp
je 0x324a3
movq 0xb8(%r15), %rdx
movq %rbp, %rdi
leaq 0x82597(%rip), %rsi     # 0xb4a31
xorl %eax, %eax
callq 0x2e1bb
jmp 0x324f2
movq 0x98(%r15), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0xa0(%r15)
leaq 0x8f2bf(%rip), %rbx     # 0xc177d
leaq 0x94107(%rip), %rax     # 0xc65cc
cmoveq %rax, %rbx
movq (%r14), %rdi
callq 0x71db6
movq %rbp, %rdi
leaq 0x82561(%rip), %rsi     # 0xb4a3c
movq 0x30(%rsp), %rdx
movq %rbx, %rcx
movq 0x28(%rsp), %rbx
movq %rax, %r8
xorl %eax, %eax
callq 0x2e1bb
movq %rbp, %rdi
callq 0x326b5
movb $0x0, 0x88(%r15)
movq %r12, %rdi
callq 0x8e048
movq %r13, %rdi
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
movq %r12, %rdx
callq 0x71998
movq 0x18(%r15), %rdi
leaq 0x8252d(%rip), %rsi     # 0xb4a57
movq %r12, %rdx
xorl %eax, %eax
callq 0x2ef9c
testq %rax, %rax
jne 0x3262d
cmpq $0x0, 0x48(%rsp)
je 0x32607
movq 0x8(%rsp), %rsi
leaq 0x88(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x717f5
movq 0x20(%rsp), %r13
movq $0x2, 0x10(%r13)
movq 0x40(%rsp), %rdi
callq 0x2f020
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x326ef
testb %al, %al
je 0x325aa
movq 0x40(%rsp), %rdi
callq 0x2f020
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x32705
movq %r12, %rdi
movq %rax, %rsi
callq 0x8e4fd
movq %r12, %rdi
callq 0x76c69
movq %r13, %rdi
pushq $0x2
popq %rsi
movq %rax, %rdx
callq 0x71a90
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0x31ab3
testb %al, %al
jne 0x325fd
movq 0x10(%r15), %rdi
movq 0x40(%rsp), %rdx
leaq 0x82483(%rip), %rsi     # 0xb4a6a
xorl %eax, %eax
callq 0x2e1bb
movq 0x10(%r15), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x31549
leaq 0x20(%rsp), %rdi
callq 0x71b48
leaq 0x8(%rsp), %rdi
callq 0x71b48
jmp 0x32423
movb $0x0, 0x88(%r15)
leaq 0x58(%rsp), %rdi
callq 0x71b64
xorl %r13d, %r13d
jmp 0x3263a
movq %rax, %r13
movq 0x8(%rsp), %rdi
callq 0x71b64
movq %r13, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq