// File: /workspace/github_cpp_makefile_star2_O1/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 0x6cc7f(%rip), %r14     # 0x1441c0
cmpb $0x0, 0x1c(%r14)
jne 0xd755d
leaq 0x14017(%rip), %rdi     # 0xeb566
leaq 0x25bbe(%rip), %rsi     # 0xfd114
xorl %eax, %eax
callq 0xd1cf7
leaq 0x25ce8(%rip), %rsi     # 0xfd24c
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 0xd7664
leaq 0x25cc6(%rip), %rsi     # 0xfd258
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xd7664
leaq 0x25ca6(%rip), %rsi     # 0xfd261
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x3, %eax
je 0xd7664
leaq 0x25c86(%rip), %rsi     # 0xfd26a
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xd7664
leaq 0x25c4d(%rip), %rsi     # 0xfd251
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x2, %eax
je 0xd7664
leaq 0x25c39(%rip), %rsi     # 0xfd25d
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xd7664
leaq 0x25c15(%rip), %rsi     # 0xfd254
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21890
cmpl $0x1, %eax
je 0xd7664
leaq 0x25c16(%rip), %rdi     # 0xfd270
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22aab
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