// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/sissm.c
// Function: sissm_main
int sissm_main( int argc, char *argv[] )
{
    int errCode = 0;
    char configFileName[ 256 ];

    // Check the arguments
    //
    switch ( argc ) {
    case 1:              // no parameter, check if default exists, else show help  
       if ( isReadable( SISSM_DEFAULT_CONFIG_NAME ) )  {
           strlcpy( configFileName, SISSM_DEFAULT_CONFIG_NAME, 256 );
           printf("\n%s. Using %s\n\n", VERSION, SISSM_DEFAULT_CONFIG_NAME);
       }
       else
           errCode = 1;
       break;
    case 2:              // single parameter, assume operator specified  sissm.cfg
        strlcpy( configFileName, argv[1], 256 );
        break;
    default:             // all other cases show help and do not run
        errCode = 1;
    }
    if ( errCode )
        printf("\n%s\nSyntax: sissm config-file / sissm -t hostname rconport rconpass\n%s\n", VERSION, COPYRIGHT);

#ifndef _WIN32 
#if SISSM_CRASHREPORT
    // Initialize Linux-only segfault trap with built-in backtrace dump.
    // This will create a "sissm.cfg.crashereporter" file.
    //
    if ( !errCode ) errCode = sissmSegfaultInstall( configFileName );
#endif
#endif

    // Initialize the Config reader, ^C handler, Log Systems, then the Plugins
    //
    if ( !errCode ) errCode = sissmInitLogAndConfig( configFileName );  
    if ( !errCode ) sissmSplash();
    if ( !errCode ) errCode = sissmInitInternal();
    if ( !errCode ) errCode = sissmInitPlugins(); 
 
    // Run quick diagnostics for minimal parameters required to run
    //
    if ( !errCode ) sissmDiagnostics();

    // Optinoally install a SIGTERM handler to intercept ^C user
    // input - this allows individual plugins to take action to leave the server in
    // a playable state in the absense of SISSM.
    //
    if ( sissmConfig.gracefulExit ) sissmSigInstall();

    // Initialize the system, plugins, then spin the main loop
    //
    if ( !errCode ) errCode = sissmMainLoop();

    return( errCode );
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpl $0x2, %edi
je 0x8e96
cmpl $0x1, %edi
jne 0x8e73
leaq 0x11526(%rip), %rdi     # 0x1a360
callq 0xf026
testl %eax, %eax
je 0x8e73
movups 0x11516(%rip), %xmm0    # 0x1a360
movaps %xmm0, (%rsp)
movw $0x67, 0x10(%rsp)
leaq 0x11504(%rip), %rdx     # 0x1a360
leaq 0x1150f(%rip), %rdi     # 0x1a372
leaq 0x1131a(%rip), %rsi     # 0x1a184
xorl %eax, %eax
callq 0x8180
jmp 0x8ea7
leaq 0x11508(%rip), %rdi     # 0x1a382
leaq 0x11303(%rip), %rsi     # 0x1a184
leaq 0x11322(%rip), %rdx     # 0x1a1aa
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x8180
pushq $0x1
popq %rbx
jmp 0x8edb
movq 0x8(%rsi), %rsi
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0xe97a
movq %rsp, %rdi
callq 0x8652
xorl %ebx, %ebx
testl %eax, %eax
je 0x8ebc
pushq $0x1
popq %rbx
xorl %ebp, %ebp
jmp 0x8edb
movq %rsp, %rdi
callq 0x8766
callq 0x8a5e
callq 0x8a02
callq 0x8994
callq 0x8ab6
movb $0x1, %bpl
cmpl $0x0, 0x22c3e(%rip)     # 0x2bb20
je 0x8ee9
callq 0x8527
testb %bpl, %bpl
je 0x8ef5
callq 0x8bac
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq