// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
cmpl $0x2, %edi
je 0x8ee8
cmpl $0x1, %edi
jne 0x8ec3
leaq 0x124d6(%rip), %rdi     # 0x1b360
callq 0xfafc
testl %eax, %eax
je 0x8ec3
movups 0x124c6(%rip), %xmm0    # 0x1b360
movaps %xmm0, (%rsp)
movw $0x67, 0x10(%rsp)
leaq 0x124b4(%rip), %rdx     # 0x1b360
leaq 0x124bf(%rip), %rdi     # 0x1b372
leaq 0x122ca(%rip), %rsi     # 0x1b184
xorl %eax, %eax
callq 0x8180
jmp 0x8ef9
leaq 0x124b8(%rip), %rdi     # 0x1b382
leaq 0x122b3(%rip), %rsi     # 0x1b184
leaq 0x122d2(%rip), %rdx     # 0x1b1aa
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x8180
movl $0x1, %ebx
jmp 0x8f34
movq 0x8(%rsi), %rsi
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0xf384
movq %rsp, %rdi
callq 0x8647
xorl %ebx, %ebx
testl %eax, %eax
je 0x8f10
movl $0x1, %ebx
xorl %ebp, %ebp
jmp 0x8f34
movq %rsp, %rdi
callq 0x8763
callq 0x8a5d
callq 0xfc10
callq 0xd3f4
callq 0x8991
callq 0x8abe
movb $0x1, %bpl
cmpl $0x0, 0x22be5(%rip)     # 0x2bb20
je 0x8f5e
leaq -0xa38(%rip), %r14      # 0x850c
movl $0x2, %edi
movq %r14, %rsi
callq 0x8230
movl $0xf, %edi
movq %r14, %rsi
callq 0x8230
testb %bpl, %bpl
je 0x8f6a
callq 0x8bc9
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq