// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/fglut/freeglut_gamemode.c
// Function: glutGameModeString
void FGAPIENTRY glutGameModeString( const char* string )
{
    int width = 640, height = 480, depth = 16, refresh = 72;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGameModeString" );

    /*
     * This one seems a bit easier than glutInitDisplayString. The bad thing
     * about it that I was unable to find the game mode string definition, so
     * that I assumed it is: "[width]x[height]:[depth]@[refresh rate]", which
     * appears in all GLUT game mode programs I have seen to date.
     */
    if( sscanf( string, "%ix%i:%i@%i", &width, &height, &depth, &refresh ) !=
        4 )
        if( sscanf( string, "%ix%i:%i", &width, &height, &depth ) != 3 )
            if( sscanf( string, "%ix%i@%i", &width, &height, &refresh ) != 3 )
                if( sscanf( string, "%ix%i", &width, &height ) != 2 )
                    if( sscanf( string, ":%i@%i", &depth, &refresh ) != 2 )
                        if( sscanf( string, ":%i", &depth ) != 1 )
                            if( sscanf( string, "@%i", &refresh ) != 1 )
                                fgWarning(
                                    "unable to parse game mode string `%s'",
                                    string
                                );

    /* Hopefully it worked, and if not, we still have the default values */
    fgState.GameModeSize.X  = width;
    fgState.GameModeSize.Y  = height;
    fgState.GameModeDepth   = depth;
    fgState.GameModeRefresh = refresh;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x280, 0x14(%rsp)      # imm = 0x280
movl $0x1e0, 0x10(%rsp)      # imm = 0x1E0
movl $0x10, 0xc(%rsp)
movl $0x48, 0x8(%rsp)
leaq 0x6cb6b(%rip), %r14     # 0x1421c0
cmpb $0x0, 0x1c(%r14)
jne 0xd5671
leaq 0x13f53(%rip), %rdi     # 0xe95b6
leaq 0x25afa(%rip), %rsi     # 0xfb164
xorl %eax, %eax
callq 0xcfe73
leaq 0x25c24(%rip), %rsi     # 0xfb29c
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x8(%rsp), %r9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x4, %eax
je 0xd5778
leaq 0x25c02(%rip), %rsi     # 0xfb2a8
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xd5778
leaq 0x25be2(%rip), %rsi     # 0xfb2b1
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xd5778
leaq 0x25bc2(%rip), %rsi     # 0xfb2ba
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xd5778
leaq 0x25b89(%rip), %rsi     # 0xfb2a1
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xd5778
leaq 0x25b75(%rip), %rsi     # 0xfb2ad
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xd5778
leaq 0x25b51(%rip), %rsi     # 0xfb2a4
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xd5778
leaq 0x25b52(%rip), %rdi     # 0xfb2c0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22a74
movl 0x14(%rsp), %eax
movl %eax, 0x88(%r14)
movl 0x10(%rsp), %eax
movl %eax, 0x8c(%r14)
movl 0xc(%rsp), %eax
movl %eax, 0x94(%r14)
movl 0x8(%rsp), %eax
movl %eax, 0x98(%r14)
addq $0x18, %rsp
popq %rbx
popq %r14
retq