// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_state.c
// Function: glutSetOption
void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" );

    /*
     * XXX In chronological code add order.  (WHY in that order?)
     */
    switch( eWhat )
    {
    case GLUT_INIT_WINDOW_X:
        fgState.Position.X = (GLint)value;
        break;

    case GLUT_INIT_WINDOW_Y:
        fgState.Position.Y = (GLint)value;
        break;

    case GLUT_INIT_WINDOW_WIDTH:
        fgState.Size.X = (GLint)value;
        break;

    case GLUT_INIT_WINDOW_HEIGHT:
        fgState.Size.Y = (GLint)value;
        break;

    case GLUT_INIT_DISPLAY_MODE:
        fgState.DisplayMode = (unsigned int)value;
        break;

    case GLUT_ACTION_ON_WINDOW_CLOSE:
        fgState.ActionOnWindowClose = value;
        break;

    case GLUT_RENDERING_CONTEXT:
        fgState.UseCurrentContext =
            ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE;
        break;

    case GLUT_DIRECT_RENDERING:
        fgState.DirectContext = value;
        break;

    case GLUT_WINDOW_CURSOR:
        if( fgStructure.CurrentWindow != NULL )
            fgStructure.CurrentWindow->State.Cursor = value;
        break;

    case GLUT_AUX:
      fgState.AuxiliaryBufferNumber = value;
      break;

    case GLUT_MULTISAMPLE:
      fgState.SampleNumber = value;
      break;

    default:
        fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
        break;
    }
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x14(%rsp)
movl %esi, 0x10(%rsp)
leaq 0x7915d(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x18124e
leaq 0x1c692(%rip), %rdi     # 0x19d8d2
leaq 0x2d919(%rip), %rsi     # 0x1aeb60
movb $0x0, %al
callq 0x17de70
movl 0x14(%rsp), %eax
movl %eax, 0xc(%rsp)
subl $0x7a, %eax
je 0x1813b1
jmp 0x181261
movl 0xc(%rsp), %eax
subl $0x80, %eax
je 0x1813e6
jmp 0x181272
movl 0xc(%rsp), %eax
subl $0x1f4, %eax            # imm = 0x1F4
je 0x18130e
jmp 0x181283
movl 0xc(%rsp), %eax
subl $0x1f5, %eax            # imm = 0x1F5
je 0x181320
jmp 0x181294
movl 0xc(%rsp), %eax
subl $0x1f6, %eax            # imm = 0x1F6
je 0x181333
jmp 0x1812a5
movl 0xc(%rsp), %eax
subl $0x1f7, %eax            # imm = 0x1F7
je 0x181346
jmp 0x1812b6
movl 0xc(%rsp), %eax
subl $0x1f8, %eax            # imm = 0x1F8
je 0x181359
jmp 0x1812c7
movl 0xc(%rsp), %eax
subl $0x1f9, %eax            # imm = 0x1F9
je 0x18136c
jmp 0x1812d8
movl 0xc(%rsp), %eax
subl $0x1fd, %eax            # imm = 0x1FD
je 0x181382
jmp 0x1812e9
movl 0xc(%rsp), %eax
subl $0x1fe, %eax            # imm = 0x1FE
je 0x1813a1
jmp 0x1812fa
movl 0xc(%rsp), %eax
subl $0x1000, %eax           # imm = 0x1000
je 0x1813d3
jmp 0x1813f9
movl 0x10(%rsp), %ecx
leaq 0x79077(%rip), %rax     # 0x1fa390
movl %ecx, (%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x79065(%rip), %rax     # 0x1fa390
movl %ecx, 0x4(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x79052(%rip), %rax     # 0x1fa390
movl %ecx, 0xc(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x7903f(%rip), %rax     # 0x1fa390
movl %ecx, 0x10(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x7902c(%rip), %rax     # 0x1fa390
movl %ecx, 0x18(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x79019(%rip), %rax     # 0x1fa390
movl %ecx, 0x9c(%rax)
jmp 0x18140b
movl 0x10(%rsp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, %cl
leaq 0x78ff4(%rip), %rax     # 0x1fa390
movb %cl, 0x25(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x78fe4(%rip), %rax     # 0x1fa390
movl %ecx, 0x20(%rax)
jmp 0x18140b
leaq 0x7eb28(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
je 0x1813d1
movl 0x10(%rsp), %ecx
leaq 0x7eb16(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movl %ecx, 0x4c(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x78fb2(%rip), %rax     # 0x1fa390
movl %ecx, 0xb4(%rax)
jmp 0x18140b
movl 0x10(%rsp), %ecx
leaq 0x78f9f(%rip), %rax     # 0x1fa390
movl %ecx, 0xb8(%rax)
jmp 0x18140b
movl 0x14(%rsp), %esi
leaq 0x2d76a(%rip), %rdi     # 0x1aeb6e
movb $0x0, %al
callq 0x17dfa0
addq $0x18, %rsp
retq