// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_body_code_s_parse
BCORE_DEFINE_OBJECT_INST_P_NASC_END( xoico_body_code_s )

er_t xoico_body_code_s_parse( xoico_body_code_s* o, const xoico_host* host, x_source* source )
{
    // xoico_body.x:68:1
    
    tp_t hash = bcore_tp_init();
    
    x_source_point_s_setup_from_source(&(o->source_point),source );
    
    if( x_source_parse_bl(source," #?'('" ) )
    {
        while( !x_source_eos(source) && x_source_inspect_char(source) != ')' ) hash = bcore_tp_fold_u0( hash, x_source_get_char(source) );
        BLM_TRY(x_source_parse_fa(source,")" ))
    }
    
    BLM_TRY(x_source_parse_fa(source," {" ))
    
    sz_t nest_count = 1;
    bl_t exit_loop = false;
    o->single_line = true;
    
    while( x_source_parse_bl(source,"#?' '" ) ); // skip leading spaces
    
    while( !x_source_eos(source) && !exit_loop )
    {
        u0_t c =  x_source_get_u0(source);
        switch( c )
        {
            case '{':
            {
                nest_count++;
            }
            break;
    
            case '}':
            {
                nest_count--;
                if( !nest_count )
                {
                    c = 0;
                    exit_loop = true;
                }
            }
            break;
    
            case '"': // string literal
            {
                hash = bcore_tp_fold_u0( hash, c );
                while( !x_source_eos(source) && ((c = x_source_get_char(source)) != '"') )
                {
                    hash = bcore_tp_fold_u0( hash, c );
                    if( c == '\\' ) hash = bcore_tp_fold_u0( hash, x_source_get_u0(source) );
                    if( c == '\n' ) return  x_source_parse_error_fa(source,"Newline in string literal." );
                }
                c = 0;
            }
            break;
    
            case '\'': // char literal
            {
                hash = bcore_tp_fold_u0( hash, c );
                while( !x_source_eos(source) && ((c = x_source_get_char(source)) != '\'') )
                {
                    hash = bcore_tp_fold_u0( hash, c );
                    if( c == '\\' ) hash = bcore_tp_fold_u0( hash, x_source_get_u0(source) );
                    if( c == '\n' ) return  x_source_parse_error_fa(source,"Newline in char literal." );
                }
                c = 0;
            }
            break;
    
            case '/': // comment
            {
                hash = bcore_tp_fold_u0( hash, c );
                if( x_source_inspect_char(source) == '/' )
                {
                    while( !x_source_eos(source) )
                    {
                        c = x_source_get_char(source);
                        hash = bcore_tp_fold_u0( hash, c );
                        if( c == '\n' )
                        {
                            o->single_line = false;
                            break;
                        }
                    }
                }
                else if( x_source_inspect_char(source) == '*' )
                {
                    while( !x_source_eos(source) )
                    {
                        if( x_source_parse_bl(source,"#?'*/'" ) )
                        {
                            hash = bcore_tp_fold_sc( hash, "*/" );
                            break;
                        }
                        else
                        {
                            c = x_source_get_char(source);
                            if( c == '\n' ) o->single_line = false;
                            hash = bcore_tp_fold_u0( hash, c );
                        }
                    }
                }
                c = 0;
            }
            break;
    
            case '\n' :
            {
                o->single_line = false;
                break;
            }
    
            default: break;
        }
        hash = bcore_tp_fold_u0( hash, c );
    }
    
    o->hash_source = hash;
    return  0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movabsq $-0x340d631b7bdddcdb, %r15 # imm = 0xCBF29CE484222325
addq $0x18, %rdi
movq %rdx, %rsi
callq 0xdc7d
leaq 0x9a37e(%rip), %rsi     # 0xaa535
movq %rbx, %rdi
callq 0xe5ff
movabsq $0x100000001b3, %r13    # imm = 0x100000001B3
testb %al, %al
je 0x1020f
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x101f9
movq %rbx, %rdi
callq 0x1048a
cmpb $0x29, %al
je 0x101f9
movq %rbx, %rdi
callq 0x104a2
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
jmp 0x101cd
leaq 0xb8ce7(%rip), %rsi     # 0xc8ee7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x10225
leaq 0x9a984(%rip), %rsi     # 0xaab9a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
je 0x10249
movq %rax, %r12
leaq 0x107ba1(%rip), %rax    # 0x117dd0
movq (%rax), %rdi
callq 0x71b64
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x8(%r14)
leaq 0x9a2e7(%rip), %r12     # 0xaa53c
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe5ff
testb %al, %al
jne 0x10255
pushq $0x1
popq %r12
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x1047e
testb $0x1, %bpl
jne 0x1047e
movq %rbx, %rdi
callq 0x104d1
cmpb $0xa, %al
je 0x103ce
movzbl %al, %ecx
cmpl $0x22, %ecx
je 0x10377
cmpl $0x27, %ecx
je 0x102c6
cmpl $0x2f, %ecx
je 0x1032f
cmpl $0x7d, %ecx
je 0x1031d
cmpl $0x7b, %ecx
jne 0x103d5
incq %r12
movb $0x7b, %al
jmp 0x103d5
xorq $0x27, %r15
imulq %r13, %r15
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x10440
movq %rbx, %rdi
callq 0x104a2
cmpb $0x27, %al
je 0x10440
movl %eax, %ebp
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
cmpb $0x5c, %bpl
jne 0x10312
movq %rbx, %rdi
callq 0x104d1
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
cmpb $0xa, %bpl
jne 0x102ce
jmp 0x10456
decq %r12
je 0x10426
xorl %ebp, %ebp
movb $0x7d, %al
jmp 0x10444
xorq $0x2f, %r15
imulq %r13, %r15
movq %rbx, %rdi
callq 0x1048a
cmpb $0x2f, %al
jne 0x103d9
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x10440
movq %rbx, %rdi
callq 0x104a2
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
cmpb $0xa, %al
jne 0x10347
movb $0x0, 0x8(%r14)
jmp 0x10440
xorq $0x22, %r15
imulq %r13, %r15
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x10440
movq %rbx, %rdi
callq 0x104a2
cmpb $0x22, %al
je 0x10440
movl %eax, %ebp
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
cmpb $0x5c, %bpl
jne 0x103c3
movq %rbx, %rdi
callq 0x104d1
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
cmpb $0xa, %bpl
jne 0x1037f
jmp 0x1045f
movb $0x0, 0x8(%r14)
movb $0xa, %al
xorl %ebp, %ebp
jmp 0x10444
movq %rbx, %rdi
callq 0x1048a
xorl %ebp, %ebp
cmpb $0x2a, %al
jne 0x10442
leaq 0x9a188(%rip), %rbp     # 0xaa576
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x10440
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe5ff
testb %al, %al
jne 0x1042e
movq %rbx, %rdi
callq 0x104a2
cmpb $0xa, %al
jne 0x1041a
movb $0x0, 0x8(%r14)
movzbl %al, %eax
xorq %rax, %r15
imulq %r13, %r15
jmp 0x103ee
movb $0x1, %bpl
xorl %r12d, %r12d
jmp 0x10442
movq %r15, %rdi
leaq 0x9a145(%rip), %rsi     # 0xaa57d
callq 0x10500
movq %rax, %r15
xorl %ebp, %ebp
xorl %eax, %eax
movzbl %al, %eax
xorq %r15, %rax
imulq %r13, %rax
movq %rax, %r15
jmp 0x1026a
leaq 0x9a100(%rip), %rsi     # 0xaa55d
jmp 0x10466
leaq 0x9a0dc(%rip), %rsi     # 0xaa542
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd7c4
movq %r15, 0x10(%r14)
xorl %r12d, %r12d
jmp 0x10237