// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpl $0x2, %edi
je 0x8ece
cmpl $0x1, %edi
jne 0x8eab
leaq 0x124ee(%rip), %rdi     # 0x1b360
callq 0xf7b0
testl %eax, %eax
je 0x8eab
movups 0x124de(%rip), %xmm0    # 0x1b360
movaps %xmm0, (%rsp)
movw $0x67, 0x10(%rsp)
leaq 0x124cc(%rip), %rdx     # 0x1b360
leaq 0x124d7(%rip), %rdi     # 0x1b372
leaq 0x122e2(%rip), %rsi     # 0x1b184
xorl %eax, %eax
callq 0x8180
jmp 0x8edf
leaq 0x124d0(%rip), %rdi     # 0x1b382
leaq 0x122cb(%rip), %rsi     # 0x1b184
leaq 0x122ea(%rip), %rdx     # 0x1b1aa
xorl %eax, %eax
callq 0x8180
movl $0x1, %ebx
jmp 0x8ee9
movq 0x8(%rsi), %rsi
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0xf038
movq %rsp, %rdi
callq 0x8647
movl %eax, %ebx
testl %ebx, %ebx
jne 0x8ef7
movq %rsp, %rdi
callq 0x875c
xorl %ebx, %ebx
testl %ebx, %ebx
jne 0x8f0c
callq 0x8a56
callq 0xf8c4
callq 0xd074
xorl %ebx, %ebx
testl %ebx, %ebx
jne 0x8f17
callq 0x898a
xorl %ebx, %ebx
testl %ebx, %ebx
jne 0x8f20
callq 0x8ab7
cmpl $0x0, 0x22bf9(%rip)     # 0x2bb20
je 0x8f4a
leaq -0xa24(%rip), %r14      # 0x850c
movl $0x2, %edi
movq %r14, %rsi
callq 0x8230
movl $0xf, %edi
movq %r14, %rsi
callq 0x8230
testl %ebx, %ebx
jne 0x8f55
callq 0x8bb5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq