LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fgDisplayMenu
void fgDisplayMenu( void )
{
    SFG_Window* window = fgStructure.CurrentWindow;
    SFG_Menu* menu = NULL;

    FREEGLUT_INTERNAL_ERROR_EXIT ( fgStructure.CurrentWindow, "Displaying menu in nonexistent window",
                                   "fgDisplayMenu" );

    /* Check if there is an active menu attached to this window... */
    menu = window->ActiveMenu;
    freeglut_return_if_fail( menu );

    fgSetWindow( menu->Window );

    glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_TEXTURE_BIT | GL_LIGHTING_BIT |
                  GL_POLYGON_BIT );

    glDisable( GL_DEPTH_TEST );
    glDisable( GL_TEXTURE_2D );
    glDisable( GL_LIGHTING   );
    glDisable( GL_CULL_FACE  );

    glMatrixMode( GL_PROJECTION );
    glPushMatrix( );
    glLoadIdentity( );
    glOrtho(
         0, glutGet( GLUT_WINDOW_WIDTH  ),
         glutGet( GLUT_WINDOW_HEIGHT ), 0,
        -1, 1
    );

    glMatrixMode( GL_MODELVIEW );
    glPushMatrix( );
    glLoadIdentity( );

    fghDisplayMenuBox( menu );

    glPopAttrib( );

    glMatrixMode( GL_PROJECTION );
    glPopMatrix( );
    glMatrixMode( GL_MODELVIEW );
    glPopMatrix( );

    glutSwapBuffers( );

    fgSetWindow ( window );
}

// Assembly:
subq $0x18, %rsp
leaq 0x80825(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x8080c(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
jne 0x17f6f7
leaq 0x2eb68(%rip), %rdi     # 0x1ae24a
leaq 0x2f2e6(%rip), %rsi     # 0x1ae9cf
leaq 0x2f305(%rip), %rdx     # 0x1ae9f5
movb $0x0, %al
callq 0x17de70
movq 0x10(%rsp), %rax
movq 0x150(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x17f715
jmp 0x17f7fa
movq 0x8(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x1838e0
movl $0x40148, %edi          # imm = 0x40148
callq 0x22f00
movl $0xb71, %edi            # imm = 0xB71
callq 0x22230
movl $0xde1, %edi            # imm = 0xDE1
callq 0x22230
movl $0xb50, %edi            # imm = 0xB50
callq 0x22230
movl $0xb44, %edi            # imm = 0xB44
callq 0x22230
movl $0x1701, %edi           # imm = 0x1701
callq 0x22e50
callq 0x23110
callq 0x22dd0
movl $0x66, %edi
callq 0x181410
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rsp)
movl $0x67, %edi
callq 0x181410
movsd (%rsp), %xmm1
cvtsi2sd %eax, %xmm2
xorps %xmm3, %xmm3
movsd 0xee16(%rip), %xmm4     # 0x18e5b0
movsd 0xe86e(%rip), %xmm5     # 0x18e010
movaps %xmm3, %xmm0
callq 0x233c0
movl $0x1700, %edi           # imm = 0x1700
callq 0x22e50
callq 0x23110
callq 0x22dd0
movq 0x8(%rsp), %rdi
callq 0x17f800
callq 0x220a0
movl $0x1701, %edi           # imm = 0x1701
callq 0x22e50
callq 0x233a0
movl $0x1700, %edi           # imm = 0x1700
callq 0x22e50
callq 0x233a0
callq 0x179fe0
movq 0x10(%rsp), %rdi
callq 0x1838e0
addq $0x18, %rsp
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghExecuteMenuCallback
static void fghExecuteMenuCallback( SFG_Menu* menu )
{
    SFG_MenuEntry *menuEntry;

    /* First of all check any of the active sub menus... */
    for( menuEntry = (SFG_MenuEntry *)menu->Entries.First;
         menuEntry;
         menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next)
    {
        if( menuEntry->IsActive )
        {
            if( menuEntry->SubMenu )
                fghExecuteMenuCallback( menuEntry->SubMenu );
            else
                if( menu->Callback )
                {
                    SFG_Menu *save_menu = fgStructure.CurrentMenu;
                    fgStructure.CurrentMenu = menu;
                    menu->Callback( menuEntry->ID );
                    fgStructure.CurrentMenu = save_menu;
                }

            return;
        }
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x1804bf
movq 0x8(%rsp), %rax
cmpb $0x0, 0x28(%rax)
je 0x1804ab
movq 0x8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x18045a
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x180410
jmp 0x1804a9
movq 0x10(%rsp), %rax
cmpq $0x0, 0x30(%rax)
je 0x1804a7
leaq 0x7fa73(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rcx
leaq 0x7fa5f(%rip), %rax     # 0x1ffee0
movq %rcx, 0x38(%rax)
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %edi
callq *%rax
movq (%rsp), %rcx
leaq 0x7fa3d(%rip), %rax     # 0x1ffee0
movq %rcx, 0x38(%rax)
jmp 0x1804a9
jmp 0x1804bf
jmp 0x1804ad
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x180427
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fgDeactivateMenu
void fgDeactivateMenu( SFG_Window *window )
{
    SFG_Window *parent_window = NULL;

    /* Check if there is an active menu attached to this window... */
    SFG_Menu* menu = window->ActiveMenu;
    SFG_MenuEntry *menuEntry;

    /* Did we find an active window? */
    freeglut_return_if_fail( menu );

    parent_window = menu->ParentWindow;

    /* Hide the present menu's window */
    fgSetWindow( menu->Window );
    glutHideWindow( );

    /* Forget about having that menu active anymore, now: */
    menu->Window->ActiveMenu = NULL;
    menu->ParentWindow->ActiveMenu = NULL;
    fghSetMenuParentWindow ( NULL, menu );
    menu->IsActive = GL_FALSE;
    menu->ActiveEntry = NULL;

    fgState.ActiveMenus--;

    /* Hide all submenu windows, and the root menu's window. */
    for ( menuEntry = ( SFG_MenuEntry * )menu->Entries.First;
          menuEntry;
          menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
    {
        menuEntry->IsActive = GL_FALSE;

        /* Is that an active submenu by any case? */
        if( menuEntry->SubMenu )
            fghDeactivateSubMenu( menuEntry );
    }

    fgSetWindow ( parent_window ) ;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x150(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x180500
jmp 0x1805d4
movq 0x10(%rsp), %rax
movq 0x68(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x1838e0
callq 0x1846b0
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rax
movq $0x0, 0x150(%rax)
movq 0x10(%rsp), %rax
movq 0x68(%rax), %rax
movq $0x0, 0x150(%rax)
movq 0x10(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x180820
movq 0x10(%rsp), %rax
movb $0x0, 0x40(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x58(%rax)
leaq 0x79e1c(%rip), %rax     # 0x1fa390
movl 0x70(%rax), %ecx
addl $-0x1, %ecx
leaq 0x79e0f(%rip), %rax     # 0x1fa390
movl %ecx, 0x70(%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x1805ca
movq 0x8(%rsp), %rax
movb $0x0, 0x28(%rax)
movq 0x8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1805b9
movq 0x8(%rsp), %rdi
callq 0x180890
jmp 0x1805bb
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x180592
movq 0x18(%rsp), %rdi
callq 0x1838e0
addq $0x28, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghSetMenuParentWindow
static void fghSetMenuParentWindow( SFG_Window *window, SFG_Menu *menu )
{
    SFG_MenuEntry *menuEntry;

    menu->ParentWindow = window;

    for( menuEntry = ( SFG_MenuEntry * )menu->Entries.First;
         menuEntry;
         menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
        if( menuEntry->SubMenu )
            fghSetMenuParentWindow( window, menuEntry->SubMenu );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
je 0x18087c
movq (%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x18086d
movq 0x10(%rsp), %rdi
movq (%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x180820
jmp 0x18086f
movq (%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
jmp 0x180849
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghDeactivateSubMenu
static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
{
    SFG_MenuEntry *subMenuIter;
    /* Hide the present menu's window */
    fgSetWindow( menuEntry->SubMenu->Window );
    glutHideWindow( );

    /* Forget about having that menu active anymore, now: */
    menuEntry->SubMenu->Window->ActiveMenu = NULL;
    menuEntry->SubMenu->IsActive = GL_FALSE;
    menuEntry->SubMenu->ActiveEntry = NULL;

    /* Hide all submenu windows, and the root menu's window. */
    for ( subMenuIter = (SFG_MenuEntry *)menuEntry->SubMenu->Entries.First;
          subMenuIter;
          subMenuIter = (SFG_MenuEntry *)subMenuIter->Node.Next )
    {
        subMenuIter->IsActive = GL_FALSE;

        /* Is that an active submenu by any case? */
        if( subMenuIter->SubMenu )
            fghDeactivateSubMenu( subMenuIter );
    }

    fgSetWindow ( menuEntry->SubMenu->ParentWindow ) ;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x60(%rax), %rdi
callq 0x1838e0
callq 0x1846b0
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x60(%rax), %rax
movq $0x0, 0x150(%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movb $0x0, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq $0x0, 0x58(%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x180930
movq 0x8(%rsp), %rax
movb $0x0, 0x28(%rax)
movq 0x8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x18091f
movq 0x8(%rsp), %rdi
callq 0x180890
jmp 0x180921
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x1808f8
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x68(%rax), %rdi
callq 0x1838e0
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghCalculateMenuBoxSize
void fghCalculateMenuBoxSize( void )
{
    SFG_MenuEntry* menuEntry;
    int width = 0, height = 0;

    /* Make sure there is a current menu set */
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    /* The menu's box size depends on the menu entries: */
    for( menuEntry = ( SFG_MenuEntry * )fgStructure.CurrentMenu->Entries.First;
         menuEntry;
         menuEntry = ( SFG_MenuEntry * )menuEntry->Node.Next )
    {
        /* Update the menu entry's width value */
        menuEntry->Width = glutBitmapLength(
            FREEGLUT_MENU_FONT,
            (unsigned char *)menuEntry->Text
        );

        /*
         * If the entry is a submenu, then it needs to be wider to
         * accomodate the arrow. JCJ 31 July 2003
         */
        if (menuEntry->SubMenu )
            menuEntry->Width += glutBitmapLength(
                FREEGLUT_MENU_FONT,
                (unsigned char *)"_"
            );

        /* Check if it's the biggest we've found */
        if( menuEntry->Width > width )
            width = menuEntry->Width;

        height += FREEGLUT_MENU_HEIGHT;
    }

    /* Store the menu's box size now: */
    fgStructure.CurrentMenu->Height = height + 2 * FREEGLUT_MENU_BORDER;
    fgStructure.CurrentMenu->Width  = width  + 4 * FREEGLUT_MENU_BORDER;
}

// Assembly:
subq $0x18, %rsp
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
leaq 0x7f575(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180977
jmp 0x180a4f
leaq 0x7f562(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x180a25
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rsi
leaq 0x7f471(%rip), %rdi     # 0x1ffe18
callq 0x17a5f0
movl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x2c(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1809e2
leaq 0x7f44f(%rip), %rdi     # 0x1ffe18
leaq 0x2e033(%rip), %rsi     # 0x1aea03
callq 0x17a5f0
movl %eax, %ecx
movq 0x10(%rsp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
movq 0x10(%rsp), %rax
movl 0x2c(%rax), %eax
cmpl 0xc(%rsp), %eax
jle 0x1809fc
movq 0x10(%rsp), %rax
movl 0x2c(%rax), %eax
movl %eax, 0xc(%rsp)
leaq 0x7f415(%rip), %rdi     # 0x1ffe18
callq 0x17a700
addl $0x2, %eax
addl 0x8(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x18098b
movl 0x8(%rsp), %ecx
addl $0x4, %ecx
leaq 0x7f4ad(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rax
movl %ecx, 0x48(%rax)
movl 0xc(%rsp), %ecx
addl $0x8, %ecx
leaq 0x7f498(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rax
movl %ecx, 0x44(%rax)
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutDestroyMenu
void FGAPIENTRY glutDestroyMenu( int menuID )
{
    SFG_Menu* menu;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDestroyMenu" );
    menu = fgMenuByID( menuID );

    freeglut_return_if_fail( menu );

    /* The menu object destruction code resides in freeglut_structure.c */
    fgDestroyMenu( menu );
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x14(%rsp)
leaq 0x798e1(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180aca
leaq 0x1ce16(%rip), %rdi     # 0x19d8d2
leaq 0x2df51(%rip), %rsi     # 0x1aea14
movb $0x0, %al
callq 0x17de70
movl 0x14(%rsp), %edi
callq 0x183170
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x180ae2
jmp 0x180aec
movq 0x8(%rsp), %rdi
callq 0x182b70
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutGetMenu
int FGAPIENTRY glutGetMenu( void )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetMenu" );

    if( fgStructure.CurrentMenu )
        return fgStructure.CurrentMenu->ID;

    return 0;
}

// Assembly:
pushq %rax
leaq 0x79888(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180b23
leaq 0x1cdbd(%rip), %rdi     # 0x19d8d2
leaq 0x2df08(%rip), %rsi     # 0x1aea24
movb $0x0, %al
callq 0x17de70
leaq 0x7f3b6(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
je 0x180b45
leaq 0x7f3a8(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rax
movl 0x18(%rax), %eax
movl %eax, 0x4(%rsp)
jmp 0x180b4d
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutSetMenu
void FGAPIENTRY glutSetMenu( int menuID )
{
    SFG_Menu* menu;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetMenu" );
    menu = fgMenuByID( menuID );

    freeglut_return_if_fail( menu );

    fgStructure.CurrentMenu = menu;
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x14(%rsp)
leaq 0x79821(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180b8a
leaq 0x1cd56(%rip), %rdi     # 0x19d8d2
leaq 0x2dead(%rip), %rsi     # 0x1aea30
movb $0x0, %al
callq 0x17de70
movl 0x14(%rsp), %edi
callq 0x183170
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x180ba2
jmp 0x180bb2
movq 0x8(%rsp), %rcx
leaq 0x7f332(%rip), %rax     # 0x1ffee0
movq %rcx, 0x38(%rax)
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutAddMenuEntry
void FGAPIENTRY glutAddMenuEntry( const char* label, int value )
{
    SFG_MenuEntry* menuEntry;
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutAddMenuEntry" );
    menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    menuEntry->Text = strdup( label );
    menuEntry->ID   = value;

    /* Have the new menu entry attached to the current menu */
    fgListAppend( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );

    fghCalculateMenuBoxSize( );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
leaq 0x797bc(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180bef
leaq 0x1ccf1(%rip), %rdi     # 0x19d8d2
leaq 0x2de54(%rip), %rsi     # 0x1aea3c
movb $0x0, %al
callq 0x17de70
movl $0x30, %edi
movl $0x1, %esi
callq 0x226a0
movq %rax, (%rsp)
leaq 0x7f2d7(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180c12
jmp 0x180c4f
movq 0x10(%rsp), %rdi
callq 0x23340
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movl 0xc(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x10(%rax)
leaq 0x7f2a7(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
addq $0x20, %rdi
movq (%rsp), %rsi
callq 0x182700
callq 0x180950
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutAddSubMenu
void FGAPIENTRY glutAddSubMenu( const char *label, int subMenuID )
{
    SFG_MenuEntry *menuEntry;
    SFG_Menu *subMenu;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutAddSubMenu" );
    menuEntry = ( SFG_MenuEntry * )calloc( sizeof( SFG_MenuEntry ), 1 );
    subMenu = fgMenuByID( subMenuID );

    freeglut_return_if_fail( fgStructure.CurrentMenu );
    freeglut_return_if_fail( subMenu );

    menuEntry->Text    = strdup( label );
    menuEntry->SubMenu = subMenu;
    menuEntry->ID      = -1;

    fgListAppend( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );
    fghCalculateMenuBoxSize( );
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
leaq 0x7971c(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180c8f
leaq 0x1cc51(%rip), %rdi     # 0x19d8d2
leaq 0x2ddc5(%rip), %rsi     # 0x1aea4d
movb $0x0, %al
callq 0x17de70
movl $0x30, %edi
movl $0x1, %esi
callq 0x226a0
movq %rax, 0x10(%rsp)
movl 0x1c(%rsp), %edi
callq 0x183170
movq %rax, 0x8(%rsp)
leaq 0x7f228(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180cc1
jmp 0x180d19
cmpq $0x0, 0x8(%rsp)
jne 0x180ccb
jmp 0x180d19
movq 0x20(%rsp), %rdi
callq 0x23340
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x10(%rsp), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
leaq 0x7f1de(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
addq $0x20, %rdi
movq 0x10(%rsp), %rsi
callq 0x182700
callq 0x180950
addq $0x28, %rsp
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutChangeToMenuEntry
void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value )
{
    SFG_MenuEntry* menuEntry = NULL;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToMenuEntry" );
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    /* Get n-th menu entry in the current menu, starting from one: */
    menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );

    freeglut_return_if_fail( menuEntry );

    /* We want it to become a normal menu entry, so: */
    if( menuEntry->Text )
        free( menuEntry->Text );

    menuEntry->Text    = strdup( label );
    menuEntry->ID      = value;
    menuEntry->SubMenu = NULL;
    fghCalculateMenuBoxSize( );
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x7964f(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180d5c
leaq 0x1cb84(%rip), %rdi     # 0x19d8d2
leaq 0x2dd07(%rip), %rsi     # 0x1aea5c
movb $0x0, %al
callq 0x17de70
leaq 0x7f17d(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180d6c
jmp 0x180ddd
leaq 0x7f16d(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
movl 0x24(%rsp), %esi
callq 0x180df0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x180d8f
jmp 0x180ddd
movq 0x8(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x180da9
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x22c30
movq 0x18(%rsp), %rdi
callq 0x23340
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rax)
movl 0x14(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x8(%rsp), %rax
movq $0x0, 0x20(%rax)
callq 0x180950
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghFindMenuEntry
static SFG_MenuEntry *fghFindMenuEntry( SFG_Menu* menu, int index )
{
    SFG_MenuEntry *entry;
    int i = 1;

    for( entry = (SFG_MenuEntry *)menu->Entries.First;
         entry;
         entry = (SFG_MenuEntry *)entry->Node.Next )
    {
        if( i == index )
            break;
        ++i;
    }

    return entry;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movl $0x1, -0x1c(%rsp)
movq -0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rsp)
cmpq $0x0, -0x18(%rsp)
je 0x180e3d
movl -0x1c(%rsp), %eax
cmpl -0xc(%rsp), %eax
jne 0x180e23
jmp 0x180e3d
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
movq -0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rsp)
jmp 0x180e0f
movq -0x18(%rsp), %rax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutChangeToSubMenu
void FGAPIENTRY glutChangeToSubMenu( int item, const char* label,
                                     int subMenuID )
{
    SFG_Menu*      subMenu;
    SFG_MenuEntry* menuEntry;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToSubMenu" );
    subMenu = fgMenuByID( subMenuID );
    menuEntry = NULL;

    freeglut_return_if_fail( fgStructure.CurrentMenu );
    freeglut_return_if_fail( subMenu );

    /* Get n-th menu entry in the current menu, starting from one: */
    menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );

    freeglut_return_if_fail( menuEntry );

    /* We want it to become a sub menu entry, so: */
    if( menuEntry->Text )
        free( menuEntry->Text );

    menuEntry->Text    = strdup( label );
    menuEntry->SubMenu = subMenu;
    menuEntry->ID      = -1;
    fghCalculateMenuBoxSize( );
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
leaq 0x79528(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180e83
leaq 0x1ca5d(%rip), %rdi     # 0x19d8d2
leaq 0x2dbf6(%rip), %rsi     # 0x1aea72
movb $0x0, %al
callq 0x17de70
movl 0x14(%rsp), %edi
callq 0x183170
movq %rax, 0x8(%rsp)
movq $0x0, (%rsp)
leaq 0x7f040(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180ea9
jmp 0x180f1e
cmpq $0x0, 0x8(%rsp)
jne 0x180eb3
jmp 0x180f1e
leaq 0x7f026(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
movl 0x24(%rsp), %esi
callq 0x180df0
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x180ed4
jmp 0x180f1e
movq (%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x180eec
movq (%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x22c30
movq 0x18(%rsp), %rdi
callq 0x23340
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x20(%rax)
movq (%rsp), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
callq 0x180950
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutRemoveMenuItem
void FGAPIENTRY glutRemoveMenuItem( int item )
{
    SFG_MenuEntry* menuEntry;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutRemoveMenuItem" );
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    /* Get n-th menu entry in the current menu, starting from one: */
    menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );

    freeglut_return_if_fail( menuEntry );

    fgListRemove( &fgStructure.CurrentMenu->Entries, &menuEntry->Node );
    if ( menuEntry->Text )
      free( menuEntry->Text );

    free( menuEntry );
    fghCalculateMenuBoxSize( );
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x14(%rsp)
leaq 0x79451(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x180f5a
leaq 0x1c986(%rip), %rdi     # 0x19d8d2
leaq 0x2db33(%rip), %rsi     # 0x1aea86
movb $0x0, %al
callq 0x17de70
leaq 0x7ef7f(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x180f6a
jmp 0x180fcf
leaq 0x7ef6f(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
movl 0x14(%rsp), %esi
callq 0x180df0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x180f8d
jmp 0x180fcf
leaq 0x7ef4c(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdi
addq $0x20, %rdi
movq 0x8(%rsp), %rsi
callq 0x182ae0
movq 0x8(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x180fc0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x22c30
movq 0x8(%rsp), %rdi
callq 0x22c30
callq 0x180950
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutAttachMenu
void FGAPIENTRY glutAttachMenu( int button )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutAttachMenu" );

    freeglut_return_if_fail( fgStructure.CurrentWindow );
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    freeglut_return_if_fail( button >= 0 );
    freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );

    fgStructure.CurrentWindow->Menu[ button ] = fgStructure.CurrentMenu;
}

// Assembly:
pushq %rax
movl %edi, 0x4(%rsp)
leaq 0x793a4(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x181007
leaq 0x1c8d9(%rip), %rdi     # 0x19d8d2
leaq 0x2da99(%rip), %rsi     # 0x1aea99
movb $0x0, %al
callq 0x17de70
leaq 0x7eed2(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
jne 0x181017
jmp 0x18105c
leaq 0x7eec2(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x181027
jmp 0x18105c
cmpl $0x0, 0x4(%rsp)
jge 0x181030
jmp 0x18105c
cmpl $0x3, 0x4(%rsp)
jl 0x181039
jmp 0x18105c
leaq 0x7eea0(%rip), %rax     # 0x1ffee0
movq 0x38(%rax), %rdx
leaq 0x7ee95(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movslq 0x4(%rsp), %rcx
movq %rdx, 0x138(%rax,%rcx,8)
popq %rax
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: glutDetachMenu
void FGAPIENTRY glutDetachMenu( int button )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDetachMenu" );

    freeglut_return_if_fail( fgStructure.CurrentWindow );
    freeglut_return_if_fail( fgStructure.CurrentMenu );

    freeglut_return_if_fail( button >= 0 );
    freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );

    fgStructure.CurrentWindow->Menu[ button ] = NULL;
}

// Assembly:
pushq %rax
movl %edi, 0x4(%rsp)
leaq 0x79324(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x181087
leaq 0x1c859(%rip), %rdi     # 0x19d8d2
leaq 0x2da28(%rip), %rsi     # 0x1aeaa8
movb $0x0, %al
callq 0x17de70
leaq 0x7ee52(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
jne 0x181097
jmp 0x1810d5
leaq 0x7ee42(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x38(%rax)
jne 0x1810a7
jmp 0x1810d5
cmpl $0x0, 0x4(%rsp)
jge 0x1810b0
jmp 0x1810d5
cmpl $0x3, 0x4(%rsp)
jl 0x1810b9
jmp 0x1810d5
leaq 0x7ee20(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movslq 0x4(%rsp), %rcx
movq $0x0, 0x138(%rax,%rcx,8)
popq %rax
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_menu.c
// Function: fghGetVMaxExtent
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
{
    if( fgStructure.GameModeWindow )
    {
#if TARGET_HOST_POSIX_X11
        int wx, wy;
        Window w;

        XTranslateCoordinates(
            fgDisplay.Display,
            window->Window.Handle,
            fgDisplay.RootWindow,
            0, 0, &wx, &wy, &w);

        *x = fgState.GameModeSize.X + wx;
        *y = fgState.GameModeSize.Y + wy;
#else
        *x = glutGet ( GLUT_SCREEN_WIDTH );
        *y = glutGet ( GLUT_SCREEN_HEIGHT );
#endif
    }
    else
    {
        *x = fgDisplay.ScreenWidth;
        *y = fgDisplay.ScreenHeight;
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
leaq 0x7ed66(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x48(%rax)
je 0x1811f4
leaq 0x7eca8(%rip), %rax     # 0x1ffe30
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rsi
leaq 0x7ec95(%rip), %rax     # 0x1ffe30
movq 0x10(%rax), %rdx
xorl %r8d, %r8d
leaq 0x1c(%rsp), %r9
leaq 0x18(%rsp), %r10
leaq 0x10(%rsp), %rax
movl %r8d, %ecx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x23170
leaq 0x791c7(%rip), %rax     # 0x1fa390
movl 0x88(%rax), %ecx
addl 0x1c(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
leaq 0x791af(%rip), %rax     # 0x1fa390
movl 0x8c(%rax), %ecx
addl 0x18(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
jmp 0x181216
leaq 0x7ec35(%rip), %rax     # 0x1ffe30
movl 0x38(%rax), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
leaq 0x7ec24(%rip), %rax     # 0x1ffe30
movl 0x3c(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_state.c
// Function: fghGetConfig
static int fghGetConfig( int attribute )
{
  int returnValue = 0;

  if( fgStructure.CurrentWindow )
      glXGetFBConfigAttrib( fgDisplay.Display,
                                     *(fgStructure.CurrentWindow->Window.FBConfig),
                                     attribute,
                                     &returnValue );

  return returnValue;
}

// Assembly:
pushq %rax
movl %edi, 0x4(%rsp)
movl $0x0, (%rsp)
leaq 0x7df6d(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
je 0x181fa2
leaq 0x7deaf(%rip), %rax     # 0x1ffe30
movq (%rax), %rdi
leaq 0x7df55(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rsi
movl 0x4(%rsp), %edx
movq %rsp, %rcx
callq 0x222b0
movl (%rsp), %eax
popq %rcx
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_state.c
// Function: glutGetModifiers
int FGAPIENTRY glutGetModifiers( void )
{
    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
    if( fgState.Modifiers == INVALID_MODIFIERS )
    {
        fgWarning( "glutGetModifiers() called outside an input callback" );
        return 0;
    }

    return fgState.Modifiers;
}

// Assembly:
pushq %rax
leaq 0x781d8(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x1821d3
leaq 0x1b70d(%rip), %rdi     # 0x19d8d2
leaq 0x2ca2a(%rip), %rsi     # 0x1aebf6
movb $0x0, %al
callq 0x17de70
leaq 0x781b6(%rip), %rax     # 0x1fa390
cmpl $-0x1, 0x2c(%rax)
jne 0x1821f8
leaq 0x2ca20(%rip), %rdi     # 0x1aec07
movb $0x0, %al
callq 0x17dfa0
movl $0x0, 0x4(%rsp)
jmp 0x182206
leaq 0x78191(%rip), %rax     # 0x1fa390
movl 0x2c(%rax), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fghClearCallBacks
static void fghClearCallBacks( SFG_Window *window )
{
    if( window )
    {
        int i;
        for( i = 0; i < TOTAL_CALLBACKS; ++i )
            window->CallBacks[ i ] = NULL;
    }
}

// Assembly:
movq %rdi, -0x8(%rsp)
cmpq $0x0, -0x8(%rsp)
je 0x1826de
movl $0x0, -0xc(%rsp)
cmpl $0x18, -0xc(%rsp)
jge 0x1826dc
movq -0x8(%rsp), %rax
movslq -0xc(%rsp), %rcx
movq $0x0, 0x70(%rax,%rcx,8)
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x1826b5
jmp 0x1826de
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgListAppend
void fgListAppend(SFG_List *list, SFG_Node *node)
{
    if ( list->Last )
    {
        SFG_Node *ln = (SFG_Node *) list->Last;
        ln->Next = node;
        node->Prev = ln;
    }
    else
    {
        node->Prev = NULL;
        list->First = node;
    }

    node->Next = NULL;
    list->Last = node;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x182741
movq -0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rcx
movq -0x18(%rsp), %rax
movq %rcx, (%rax)
movq -0x18(%rsp), %rcx
movq -0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x18275b
movq -0x10(%rsp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rsp), %rcx
movq -0x8(%rsp), %rax
movq %rcx, (%rax)
movq -0x10(%rsp), %rax
movq $0x0, (%rax)
movq -0x10(%rsp), %rcx
movq -0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgCreateMenu
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{
    int x = 100, y = 100, w = 100, h = 100;
    SFG_Window *current_window = fgStructure.CurrentWindow;

    /* Have the menu object created */
    SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );

    menu->ParentWindow = NULL;

    /* Create a window for the menu to reside in. */

    fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h,
                    GL_FALSE, GL_TRUE );
    menu->Window = fgStructure.CurrentWindow;
    glutDisplayFunc( fgDisplayMenu );

    glutHideWindow( );  /* Hide the window for now */
    fgSetWindow( current_window );

    /* Initialize the object properties: */
    menu->ID       = ++fgStructure.MenuID;
    menu->Callback = menuCallback;
    menu->ActiveEntry = NULL;

    fgListInit( &menu->Entries );
    fgListAppend( &fgStructure.Menus, &menu->Node );

    /* Newly created menus implicitly become current ones */
    fgStructure.CurrentMenu = menu;

    return menu;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl $0x64, 0x3c(%rsp)
movl $0x64, 0x38(%rsp)
movl $0x64, 0x34(%rsp)
movl $0x64, 0x30(%rsp)
movq 0x7d760(%rip), %rax     # 0x1fff10
movq %rax, 0x28(%rsp)
movl $0x70, %edi
movl $0x1, %esi
callq 0x226a0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq $0x0, 0x68(%rax)
movl 0x3c(%rsp), %ecx
movl 0x38(%rsp), %r8d
movl 0x34(%rsp), %r10d
movl 0x30(%rsp), %eax
xorl %edx, %edx
movl %edx, %edi
leaq 0x2c48e(%rip), %rsi     # 0x1aec81
movl $0x1, %r9d
xorl %edx, %edx
movl %r9d, %edx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
callq 0x182510
movq 0x7d6ee(%rip), %rcx     # 0x1fff10
movq 0x20(%rsp), %rax
movq %rcx, 0x60(%rax)
leaq -0x3182(%rip), %rdi     # 0x17f6b0
callq 0x179190
callq 0x1846b0
movq 0x28(%rsp), %rdi
callq 0x1838e0
movl 0x7d6e8(%rip), %ecx     # 0x1fff34
addl $0x1, %ecx
movl %ecx, 0x7d6df(%rip)     # 0x1fff34
movq 0x20(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x40(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x58(%rax)
movq 0x20(%rsp), %rdi
addq $0x20, %rdi
callq 0x1826e0
movq 0x20(%rsp), %rsi
leaq 0x7d64e(%rip), %rdi     # 0x1ffee0
addq $0x10, %rdi
callq 0x182700
movq 0x20(%rsp), %rax
movq %rax, 0x7d671(%rip)     # 0x1fff18
movq 0x20(%rsp), %rax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgAddToWindowDestroyList
void fgAddToWindowDestroyList( SFG_Window* window )
{
    SFG_WindowList *new_list_entry =
        ( SFG_WindowList* )malloc( sizeof(SFG_WindowList ) );
    new_list_entry->window = window;
    fgListAppend( &fgStructure.WindowsToDestroy, &new_list_entry->node );

    /* Check if the window is the current one... */
    if( fgStructure.CurrentWindow == window )
        fgStructure.CurrentWindow = NULL;

    /*
     * Clear all window callbacks except Destroy, which will
     * be invoked later.  Right now, we are potentially carrying
     * out a freeglut operation at the behest of a client callback,
     * so we are reluctant to re-enter the client with the Destroy
     * callback, right now.  The others are all wiped out, however,
     * to ensure that they are no longer called after this point.
     */
    {
        FGCBDestroy destroy = (FGCBDestroy)FETCH_WCB( *window, Destroy );
        fghClearCallBacks( window );
        SET_WCB( *window, Destroy, destroy );
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl $0x18, %edi
callq 0x22df0
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x8(%rsp), %rsi
leaq 0x7d5ee(%rip), %rdi     # 0x1ffee0
addq $0x20, %rdi
callq 0x182700
movq 0x7d60e(%rip), %rax     # 0x1fff10
cmpq 0x10(%rsp), %rax
jne 0x182914
movq $0x0, 0x7d5fc(%rip) # 0x1fff10
movq 0x10(%rsp), %rax
movq 0xe0(%rax), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
callq 0x1826a0
movq 0x10(%rsp), %rax
movq 0xe0(%rax), %rax
cmpq (%rsp), %rax
je 0x182950
movq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0xe0(%rax)
jmp 0x182952
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgCloseWindows
void fgCloseWindows( )
{
    while( fgStructure.WindowsToDestroy.First )
    {
        SFG_WindowList *window_ptr = fgStructure.WindowsToDestroy.First;
        fgDestroyWindow( window_ptr->window );
        fgListRemove( &fgStructure.WindowsToDestroy, &window_ptr->node );
        free( window_ptr );
    }
}

// Assembly:
pushq %rax
cmpq $0x0, 0x7d597(%rip)     # 0x1fff00
je 0x1829a2
movq 0x7d58e(%rip), %rax     # 0x1fff00
movq %rax, (%rsp)
movq (%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1829b0
movq (%rsp), %rsi
leaq 0x7d552(%rip), %rdi     # 0x1ffee0
addq $0x20, %rdi
callq 0x182ae0
movq (%rsp), %rdi
callq 0x22c30
jmp 0x182961
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgDestroyWindow
void fgDestroyWindow( SFG_Window* window )
{
    FREEGLUT_INTERNAL_ERROR_EXIT ( window, "Window destroy function called with null window",
                                   "fgDestroyWindow" );

    while( window->Children.First )
        fgDestroyWindow( ( SFG_Window * )window->Children.First );

    {
        SFG_Window *activeWindow = fgStructure.CurrentWindow;
        INVOKE_WCB( *window, Destroy, ( ) );
        fgSetWindow( activeWindow );
    }

    if( window->Parent )
        fgListRemove( &window->Parent->Children, &window->Node );
    else
        fgListRemove( &fgStructure.Windows, &window->Node );

    if( window->ActiveMenu )
      fgDeactivateMenu( window );

    fghClearCallBacks( window );
    fgCloseWindow( window );
    free( window );
    if( fgStructure.CurrentWindow == window )
        fgStructure.CurrentWindow = NULL;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x1829dd
leaq 0x2b882(%rip), %rdi     # 0x1ae24a
leaq 0x2c2c0(%rip), %rsi     # 0x1aec8f
leaq 0x2c2e9(%rip), %rdx     # 0x1aecbf
movb $0x0, %al
callq 0x17de70
jmp 0x1829df
movq 0x10(%rsp), %rax
cmpq $0x0, 0x160(%rax)
je 0x182a01
movq 0x10(%rsp), %rax
movq 0x160(%rax), %rdi
callq 0x1829b0
jmp 0x1829df
movq 0x7d508(%rip), %rax     # 0x1fff10
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
cmpq $0x0, 0xe0(%rax)
je 0x182a31
movq 0x10(%rsp), %rdi
callq 0x1838e0
movq 0x10(%rsp), %rax
callq *0xe0(%rax)
jmp 0x182a33
movq 0x8(%rsp), %rdi
callq 0x1838e0
movq 0x10(%rsp), %rax
cmpq $0x0, 0x158(%rax)
je 0x182a6b
movq 0x10(%rsp), %rax
movq 0x158(%rax), %rdi
addq $0x160, %rdi            # imm = 0x160
movq 0x10(%rsp), %rsi
callq 0x182ae0
jmp 0x182a7c
movq 0x10(%rsp), %rsi
leaq 0x7d469(%rip), %rdi     # 0x1ffee0
callq 0x182ae0
movq 0x10(%rsp), %rax
cmpq $0x0, 0x150(%rax)
je 0x182a95
movq 0x10(%rsp), %rdi
callq 0x1804d0
movq 0x10(%rsp), %rdi
callq 0x1826a0
movq 0x10(%rsp), %rdi
callq 0x1841c0
movq 0x10(%rsp), %rdi
callq 0x22c30
movq 0x7d456(%rip), %rax     # 0x1fff10
cmpq 0x10(%rsp), %rax
jne 0x182acc
movq $0x0, 0x7d444(%rip) # 0x1fff10
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgListRemove
void fgListRemove(SFG_List *list, SFG_Node *node)
{
    if( node->Next )
        ( ( SFG_Node * )node->Next )->Prev = node->Prev;
    if( node->Prev )
        ( ( SFG_Node * )node->Prev )->Next = node->Next;
    if( ( ( SFG_Node * )list->First ) == node )
        list->First = node->Next;
    if( ( ( SFG_Node * )list->Last ) == node )
        list->Last = node->Prev;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x10(%rsp), %rax
cmpq $0x0, (%rax)
je 0x182b0a
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x182b2a
movq -0x10(%rsp), %rax
movq (%rax), %rcx
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
movq (%rax), %rax
cmpq -0x10(%rsp), %rax
jne 0x182b49
movq -0x10(%rsp), %rax
movq (%rax), %rcx
movq -0x8(%rsp), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
movq 0x8(%rax), %rax
cmpq -0x10(%rsp), %rax
jne 0x182b6b
movq -0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fghRemoveMenuFromWindow
static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu )
{
    SFG_Window *subWindow;
    int i;

    /* Check whether this is the active menu in the window */
    if ( menu == window->ActiveMenu )
        window->ActiveMenu = NULL ;

    /*
     * Check if the menu is attached to the current window,
     * if so, have it detached (by overwriting with a NULL):
     */
    for( i = 0; i < FREEGLUT_MAX_MENUS; i++ )
        if( window->Menu[ i ] == menu )
            window->Menu[ i ] = NULL;

    /* Call this function for all of the window's children recursively: */
    for( subWindow = (SFG_Window *)window->Children.First;
         subWindow;
         subWindow = (SFG_Window *)subWindow->Node.Next)
        fghRemoveMenuFromWindow( subWindow, menu );
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x150(%rcx), %rax
jne 0x182d31
movq 0x20(%rsp), %rax
movq $0x0, 0x150(%rax)
movl $0x0, 0xc(%rsp)
cmpl $0x3, 0xc(%rsp)
jge 0x182d7e
movq 0x20(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq 0x138(%rax,%rcx,8), %rax
cmpq 0x18(%rsp), %rax
jne 0x182d6f
movq 0x20(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq $0x0, 0x138(%rax,%rcx,8)
jmp 0x182d71
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x182d39
movq 0x20(%rsp), %rax
movq 0x160(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x182db5
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x182d00
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x182d8f
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fghRemoveMenuFromMenu
static void fghRemoveMenuFromMenu( SFG_Menu* from, SFG_Menu* menu )
{
    SFG_MenuEntry *entry;

    for( entry = (SFG_MenuEntry *)from->Entries.First;
         entry;
         entry = ( SFG_MenuEntry * )entry->Node.Next )
        if( entry->SubMenu == menu )
            entry->SubMenu = NULL;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rsp)
cmpq $0x0, -0x18(%rsp)
je 0x182e0e
movq -0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpq -0x10(%rsp), %rax
jne 0x182dfd
movq -0x18(%rsp), %rax
movq $0x0, 0x20(%rax)
jmp 0x182dff
movq -0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rsp)
jmp 0x182dd8
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgCreateStructure
void fgCreateStructure( void )
{
    /*
     * We will be needing two lists: the first containing windows,
     * and the second containing the user-defined menus.
     * Also, no current window/menu is set, as none has been created yet.
     */

    fgListInit(&fgStructure.Windows);
    fgListInit(&fgStructure.Menus);
    fgListInit(&fgStructure.WindowsToDestroy);

    fgStructure.CurrentWindow = NULL;
    fgStructure.CurrentMenu = NULL;
    fgStructure.MenuContext = NULL;
    fgStructure.GameModeWindow = NULL;
    fgStructure.WindowID = 0;
    fgStructure.MenuID = 0;
}

// Assembly:
pushq %rax
leaq 0x7d0c8(%rip), %rdi     # 0x1ffee0
callq 0x1826e0
leaq 0x7d0bc(%rip), %rdi     # 0x1ffee0
addq $0x10, %rdi
callq 0x1826e0
leaq 0x7d0ac(%rip), %rdi     # 0x1ffee0
addq $0x20, %rdi
callq 0x1826e0
movq $0x0, 0x7d0c8(%rip) # 0x1fff10
movq $0x0, 0x7d0c5(%rip) # 0x1fff18
movq $0x0, 0x7d0c2(%rip) # 0x1fff20
movq $0x0, 0x7d0bf(%rip) # 0x1fff28
movl $0x0, 0x7d0bd(%rip)     # 0x1fff30
movl $0x0, 0x7d0b7(%rip)     # 0x1fff34
popq %rax
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgDestroyStructure
void fgDestroyStructure( void )
{
    /* Clean up the WindowsToDestroy list. */
    fgCloseWindows( );

    /* Make sure all windows and menus have been deallocated */
    while( fgStructure.Menus.First )
        fgDestroyMenu( ( SFG_Menu * )fgStructure.Menus.First );

    while( fgStructure.Windows.First )
        fgDestroyWindow( ( SFG_Window * )fgStructure.Windows.First );
}

// Assembly:
pushq %rax
callq 0x182960
cmpq $0x0, 0x7d062(%rip)     # 0x1ffef0
je 0x182e9e
movq 0x7d059(%rip), %rdi     # 0x1ffef0
callq 0x182b70
jmp 0x182e86
jmp 0x182ea0
cmpq $0x0, 0x7d038(%rip)     # 0x1ffee0
je 0x182eb8
movq 0x7d02f(%rip), %rdi     # 0x1ffee0
callq 0x1829b0
jmp 0x182ea0
popq %rax
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgEnumWindows
void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator )
{
    SFG_Window *window;

    FREEGLUT_INTERNAL_ERROR_EXIT ( enumCallback && enumerator,
                                   "Enumerator or callback missing from window enumerator call",
                                   "fgEnumWindows" );

    /* Check every of the top-level windows */
    for( window = ( SFG_Window * )fgStructure.Windows.First;
         window;
         window = ( SFG_Window * )window->Node.Next )
    {
        enumCallback( window, enumerator );
        if( enumerator->found )
            return;
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x182ede
cmpq $0x0, 0x8(%rsp)
jne 0x182efa
leaq 0x2b365(%rip), %rdi     # 0x1ae24a
leaq 0x2be1d(%rip), %rsi     # 0x1aed09
leaq 0x2be51(%rip), %rdx     # 0x1aed44
movb $0x0, %al
callq 0x17de70
movq 0x7cfdf(%rip), %rax     # 0x1ffee0
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
je 0x182f37
movq 0x10(%rsp), %rax
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq *%rax
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
je 0x182f28
jmp 0x182f37
jmp 0x182f2a
movq (%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
jmp 0x182f05
addq $0x18, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgEnumSubWindows
void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback,
                       SFG_Enumerator* enumerator )
{
    SFG_Window *child;

    FREEGLUT_INTERNAL_ERROR_EXIT ( enumCallback && enumerator,
                                   "Enumerator or callback missing from subwindow enumerator call",
                                   "fgEnumSubWindows" );
    FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Window Enumeration" );

    for( child = ( SFG_Window * )window->Children.First;
         child;
         child = ( SFG_Window * )child->Node.Next )
    {
        enumCallback( child, enumerator );
        if( enumerator->found )
            return;
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x182f63
cmpq $0x0, 0x10(%rsp)
jne 0x182f7f
leaq 0x2b2e0(%rip), %rdi     # 0x1ae24a
leaq 0x2bde1(%rip), %rsi     # 0x1aed52
leaq 0x2be18(%rip), %rdx     # 0x1aed90
movb $0x0, %al
callq 0x17de70
leaq 0x7740a(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x182fa1
leaq 0x1ac24(%rip), %rdi     # 0x19dbb7
leaq 0x2be07(%rip), %rsi     # 0x1aeda1
movb $0x0, %al
callq 0x17de70
movq 0x20(%rsp), %rax
movq 0x160(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x182fe8
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq *%rax
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x182fd7
jmp 0x182fe8
jmp 0x182fd9
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x182fb2
addq $0x28, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fgWindowByHandle
SFG_Window* fgWindowByHandle ( SFG_WindowHandleType hWindow )
{
    SFG_Enumerator enumerator;

    /* This is easy and makes use of the windows enumeration defined above */
    enumerator.found = GL_FALSE;
    enumerator.data = (void *)hWindow;
    fgEnumWindows( fghcbWindowByHandle, &enumerator );

    if( enumerator.found )
        return( SFG_Window *) enumerator.data;
    return NULL;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movb $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x31(%rip), %rdi        # 0x183040
leaq 0x8(%rsp), %rsi
callq 0x182ec0
cmpb $0x0, 0x8(%rsp)
je 0x18302c
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x183035
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_structure.c
// Function: fghcbWindowByHandle
static void fghcbWindowByHandle( SFG_Window *window,
                                 SFG_Enumerator *enumerator )
{
    if ( enumerator->found )
        return;

    /* Check the window's handle. Hope this works. Looks ugly. That's for sure. */
    if( window->Window.Handle == (SFG_WindowHandleType) (enumerator->data) )
    {
        enumerator->found = GL_TRUE;
        enumerator->data = window;

        return;
    }

    /* Otherwise, check this window's children */
    fgEnumSubWindows( window, fghcbWindowByHandle, enumerator );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
je 0x18305a
jmp 0x18309f
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq %rcx, %rax
jne 0x183089
movq 0x8(%rsp), %rax
movb $0x1, (%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x18309f
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq -0x5a(%rip), %rsi       # 0x183040
callq 0x182f40
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)