// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_main_main
s2_t xoico_main_main( const bcore_arr_st_s* args )
{
    // xoico_main.x:40:1
    BLM_INIT_LEVEL(0);
    xoico_builder_main_s builder_main;BLM_T_INIT_SPUSH(xoico_builder_main_s, &builder_main);;
    er_t er = 0;
    
    sz_t arg_idx = 1;
    
    if( args->size > 1 )
    {
        if( st_s_equal_sc(args->data[ arg_idx ],"--help" ) )
        {
            xoico_main_help(x_sink_stdout() );
        }
        else
        {
            while( arg_idx < args->size && args->data[ arg_idx ]->sc[ 0 ] == '-' )
            {
                if( st_s_equal_sc(args->data[ arg_idx ],"-d" ) )
                {
                    BLM_TRY_EXIT(xoico_builder_main_s_set_dry_run(&(builder_main),true ))
                }
                else if( st_s_equal_sc(args->data[ arg_idx ],"-e" ) )
                {
                    BLM_TRY_EXIT(xoico_builder_main_s_set_always_expand(&(builder_main),true ))
                }
                else if( st_s_equal_sc(args->data[ arg_idx ],"-f" ) )
                {
                    BLM_TRY_EXIT(xoico_builder_main_s_set_overwrite_unsigned_target_files(&(builder_main),true ))
                }
                else if( st_s_equal_sc(args->data[ arg_idx ],"-O" ) )
                {
                    arg_idx++;
                    if( args->size == arg_idx ) ERR_fa( "Output folder expected.\n" );
                    st_s_attach( &(builder_main.output_folder ),  st_s_clone(args->data[ arg_idx ]));
                }
                else
                {
                    ERR_fa( "Invalid option: #<sc_t>\n", args->data[ arg_idx ]->sc );
                }
                arg_idx++;
            }
    
            if( xoico_builder_main_s_get_dry_run(&(builder_main)) )
            {
                x_sink_push_fa(x_sink_stdout(),"Dry run ...\n" );
            }
    
            if( xoico_builder_main_s_get_always_expand(&(builder_main)) )
            {
                x_sink_push_fa(x_sink_stdout(),"Expanding all ...\n" );
            }
    
            if( arg_idx >= args->size ) xoico_main_help(x_sink_stdout() );
            clock_t time = clock();
    
            for(sz_t i = arg_idx; i < args->size; i++ )
            {
                if( ( er = xoico_builder_main_s_build_from_file(&(builder_main),args->data[ i ]->sc ) ) ) break;
            }
    
            if( !er && xoico_builder_main_s_update_required(&(builder_main)) )
            {
                er = xoico_builder_main_s_update(&(builder_main));
            }
    
            if( !er )
            {
                f3_t time_var = clock() - time;
                time_var /= CLOCKS_PER_SEC;
                x_sink_push_st_d(x_sink_stdout(),st_s_createf("Finished after %.3f seconds.\n", time_var ) );
            }
        }
    }
    else
    {BLM_INIT_LEVEL(1);
        er = 1;
        st_s st;BLM_T_INIT_SPUSH(st_s, &st);;
        xoico_main_help(((x_sink*)(&(st ))));
        BLM_TRY_EXIT(bcore_error_push_sc(er, st.sc ))
    BLM_DOWN();}
    
    if( er ) bcore_error_pop_all_to_stderr();
    
    BLM_RETURNV(s2_t, ( er > 0 ) ? 1 : 0)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
leaq 0x1787ca(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x10(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xbfe80
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
leaq -0x68(%rbp), %rdi
callq 0x396e0
movq -0x10(%rbp), %rdi
movabsq $0x10b2ebc3a7c03bbd, %rsi # imm = 0x10B2EBC3A7C03BBD
leaq -0x68(%rbp), %rdx
callq 0xc0220
movq $0x0, -0x70(%rbp)
movq $0x1, -0x78(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x1, 0x10(%rax)
jbe 0x39fa5
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xfe882(%rip), %rsi     # 0x13846e
callq 0x1c810
testb $0x1, %al
jne 0x39bf7
jmp 0x39c09
callq 0x2b5c0
movq %rax, %rdi
callq 0x39b20
jmp 0x39fa0
jmp 0x39c0b
movq -0x78(%rbp), %rcx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq 0x10(%rdx), %rcx
movb %al, -0x115(%rbp)
jae 0x39c44
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
sete %al
movb %al, -0x115(%rbp)
movb -0x115(%rbp), %al
testb $0x1, %al
jne 0x39c53
jmp 0x39e3f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xfe80b(%rip), %rsi     # 0x138475
callq 0x1c810
testb $0x1, %al
jne 0x39c75
jmp 0x39ca7
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x39810
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x39ca2
movq -0x48(%rbp), %rdi
callq 0xc0720
movq -0x80(%rbp), %rax
movl %eax, %edi
callq 0x425e0
jmp 0x39e2e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xfe7ba(%rip), %rsi     # 0x138478
callq 0x1c810
testb $0x1, %al
jne 0x39cc9
jmp 0x39d04
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x39860
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x39cff
movq -0x48(%rbp), %rdi
callq 0xc0720
movq -0x88(%rbp), %rax
movl %eax, %edi
callq 0x425e0
jmp 0x39e2c
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xfe760(%rip), %rsi     # 0x13847b
callq 0x1c810
testb $0x1, %al
jne 0x39d26
jmp 0x39d61
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x398b0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x39d5c
movq -0x48(%rbp), %rdi
callq 0xc0720
movq -0x90(%rbp), %rax
movl %eax, %edi
callq 0x425e0
jmp 0x39e2a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xfe706(%rip), %rsi     # 0x13847e
callq 0x1c810
testb $0x1, %al
jne 0x39d83
jmp 0x39df3
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x78(%rbp), %rax
jne 0x39dbe
leaq 0xfe6dd(%rip), %rdi     # 0x138481
leaq 0xf983d(%rip), %rsi     # 0x1335e8
movl $0x2a7d, %edx           # imm = 0x2A7D
leaq 0xfe6da(%rip), %rcx     # 0x138491
movb $0x0, %al
callq 0x9d0f0
leaq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x120(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xff990
movq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x1aea0
jmp 0x39e28
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %r8
leaq 0xfe673(%rip), %rdi     # 0x138481
leaq 0xf97d3(%rip), %rsi     # 0x1335e8
movl $0x2a82, %edx           # imm = 0x2A82
leaq 0xfe689(%rip), %rcx     # 0x1384aa
movb $0x0, %al
callq 0x9d0f0
jmp 0x39e2a
jmp 0x39e2c
jmp 0x39e2e
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x39c0b
leaq -0x68(%rbp), %rdi
callq 0x39840
testb $0x1, %al
jne 0x39e4e
jmp 0x39e64
callq 0x2b5c0
movq %rax, %rdi
leaq 0xfe666(%rip), %rsi     # 0x1384c3
movb $0x0, %al
callq 0x56e0
leaq -0x68(%rbp), %rdi
callq 0x39890
testb $0x1, %al
jne 0x39e73
jmp 0x39e89
callq 0x2b5c0
movq %rax, %rdi
leaq 0xfe64e(%rip), %rsi     # 0x1384d0
movb $0x0, %al
callq 0x56e0
movq -0x78(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x39ea4
callq 0x2b5c0
movq %rax, %rdi
callq 0x39b20
callq 0x4300
movq %rax, -0x98(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x39f0e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rsi
leaq -0x68(%rbp), %rdi
callq 0x39900
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
je 0x39ef8
jmp 0x39f0e
jmp 0x39efa
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x39ebb
cmpq $0x0, -0x70(%rbp)
jne 0x39f31
leaq -0x68(%rbp), %rdi
callq 0x3a0b0
testb $0x1, %al
jne 0x39f24
jmp 0x39f31
leaq -0x68(%rbp), %rdi
callq 0x39aa0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x39f9e
callq 0x4300
subq -0x98(%rbp), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd 0xf9467(%rip), %xmm1    # 0x1333c8
divsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
callq 0x2b5c0
movq %rax, -0x128(%rbp)
movsd -0xa8(%rbp), %xmm0
leaq 0xfe55b(%rip), %rdi     # 0x1384e3
movb $0x1, %al
callq 0xff350
movq -0x128(%rbp), %rdi
movq %rax, %rsi
callq 0x3a0e0
jmp 0x39fa0
jmp 0x3a072
movq -0x48(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0xbfe80
movq -0xe8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq $0x1, 0x10(%rax)
movq $0x1, -0x70(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xfe150
movq -0xb0(%rbp), %rdi
movabsq $-0x503db0e6e1c2e704, %rsi # imm = 0xAFC24F191E3D18FC
leaq -0x108(%rbp), %rdx
callq 0xc0220
leaq -0x108(%rbp), %rdi
callq 0x39b20
movq -0x70(%rbp), %rdi
movq -0x100(%rbp), %rsi
callq 0x9df70
movq %rax, -0x110(%rbp)
cmpq $0x0, -0x110(%rbp)
je 0x3a066
movq -0xe8(%rbp), %rdi
callq 0xc0720
movq -0x110(%rbp), %rax
movl %eax, %edi
callq 0x425e0
leaq -0xe8(%rbp), %rdi
callq 0xc06e0
cmpq $0x0, -0x70(%rbp)
je 0x3a07e
callq 0x9e620
movq -0x70(%rbp), %rdx
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x0, %rdx
cmoval %ecx, %eax
movl %eax, -0x114(%rbp)
movq -0x48(%rbp), %rdi
callq 0xc0720
movl -0x114(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nop