// File: /workspace/github_cpp_makefile_star2_O2/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 0x72f07(%rip), %r14     # 0x1331e0
cmpb $0x0, 0x1c(%r14)
jne 0xc02f5
leaq 0x13f7f(%rip), %rdi     # 0xd4266
leaq 0x25ae6(%rip), %rsi     # 0xe5dd4
xorl %eax, %eax
callq 0xbad73
leaq 0x25c10(%rip), %rsi     # 0xe5f0c
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 0xc03fc
leaq 0x25bee(%rip), %rsi     # 0xe5f18
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xc03fc
leaq 0x25bce(%rip), %rsi     # 0xe5f21
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xc03fc
leaq 0x25bae(%rip), %rsi     # 0xe5f2a
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xc03fc
leaq 0x25b75(%rip), %rsi     # 0xe5f11
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xc03fc
leaq 0x25b61(%rip), %rsi     # 0xe5f1d
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xc03fc
leaq 0x25b3d(%rip), %rsi     # 0xe5f14
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xc03fc
leaq 0x25b3e(%rip), %rdi     # 0xe5f30
movq %rbx, %rsi
xorl %eax, %eax
callq 0xbae63
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