LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_init.c
// Function: fghNetWMSupported
static int fghNetWMSupported(void)
{
  Atom wm_check;
  Window ** window_ptr_1;

  int number_of_windows;
  int net_wm_supported;


  net_wm_supported = 0;

  wm_check = fghGetAtom("_NET_SUPPORTING_WM_CHECK");
  window_ptr_1 = malloc(sizeof(Window *));

  /*
   * Check that the window manager has set this property on the root window.
   * The property must be the ID of a child window.
   */
  number_of_windows = fghGetWindowProperty(fgDisplay.RootWindow,
                                           wm_check,
                                           XA_WINDOW,
                                           (unsigned char **) window_ptr_1);
  if (number_of_windows == 1)
    {
      Window ** window_ptr_2;

      window_ptr_2 = malloc(sizeof(Window *));

      /* Check that the window has the same property set to the same value. */
      number_of_windows = fghGetWindowProperty(**window_ptr_1,
                                               wm_check,
                                               XA_WINDOW,
                                               (unsigned char **) window_ptr_2);
      if ((number_of_windows == 1) && (**window_ptr_1 == **window_ptr_2))
      {
        /* NET WM compliant */
        net_wm_supported = 1;
      }

      XFree(*window_ptr_2);
      free(window_ptr_2);
    }

        XFree(*window_ptr_1);
        free(window_ptr_1);

        return net_wm_supported;
}

// Assembly:
subq $0x28, %rsp
movl $0x0, 0x10(%rsp)
leaq 0x32679(%rip), %rdi     # 0x1ae33c
callq 0x17bc90
movq %rax, 0x20(%rsp)
movl $0x8, %edi
callq 0x22df0
movq %rax, 0x18(%rsp)
movq 0x8415d(%rip), %rdi     # 0x1ffe40
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rcx
movl $0x21, %edx
callq 0x17aea0
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jne 0x17bd72
movl $0x8, %edi
callq 0x22df0
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rcx
movl $0x21, %edx
callq 0x17aea0
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jne 0x17bd5b
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
cmpq (%rcx), %rax
jne 0x17bd5b
movl $0x1, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x22d60
movq 0x8(%rsp), %rdi
callq 0x22c30
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x22d60
movq 0x18(%rsp), %rdi
callq 0x22c30
movl 0x10(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_input_devices.c
// Function: fgInputDeviceDetect
int fgInputDeviceDetect( void )
{
    fgInitialiseInputDevices ();

    if ( !dialbox_port )
        return 0;

    if ( !fgState.InputDevsInitialised )
        return 0;

    return 1;
}

// Assembly:
pushq %rax
callq 0x17bdf0
cmpq $0x0, 0x840ca(%rip)     # 0x1ffe78
jne 0x17bdba
movl $0x0, 0x4(%rsp)
jmp 0x17bddc
leaq 0x7e5cf(%rip), %rax     # 0x1fa390
cmpb $0x0, 0xb1(%rax)
jne 0x17bdd4
movl $0x0, 0x4(%rsp)
jmp 0x17bddc
movl $0x1, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_input_devices.c
// Function: serial_open
static SERIALPORT *serial_open ( const char *device )
{
    int fd;
    struct termios termio;
    SERIALPORT *port;

    fd = open(device, O_RDWR | O_NONBLOCK );
    if (fd <0) {
        perror(device);
        return NULL;
    }

    port = malloc(sizeof(SERIALPORT));
    memset(port, 0, sizeof(SERIALPORT));
    port->fd = fd;

    /* save current port settings */
    tcgetattr(fd,&port->termio_save);

    memset(&termio, 0, sizeof(termio));
    termio.c_cflag = CS8 | CREAD | HUPCL ;
    termio.c_iflag = IGNPAR | IGNBRK ;
    termio.c_cc[VTIME]    = 0;   /* inter-character timer */
    termio.c_cc[VMIN]     = 1;   /* block read until 1 chars received, when blocking I/O */

    cfsetispeed(&termio, B9600);
    cfsetospeed(&termio, B9600);
    tcsetattr(fd,TCSANOW,&termio);

    serial_flush(port);
    return port;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movl $0x802, %esi            # imm = 0x802
movb $0x0, %al
callq 0x22730
movl %eax, 0x44(%rsp)
cmpl $0x0, 0x44(%rsp)
jge 0x17bead
movq 0x48(%rsp), %rdi
callq 0x22840
movq $0x0, 0x50(%rsp)
jmp 0x17bf51
movl $0x7c, %edi
callq 0x22df0
movq %rax, (%rsp)
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x7c, %edx
callq 0x224f0
movl 0x44(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, (%rax)
movl 0x44(%rsp), %edi
movq (%rsp), %rsi
addq $0x40, %rsi
callq 0x22b40
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movl $0x3c, %edx
callq 0x224f0
movl $0x4b0, 0x10(%rsp)      # imm = 0x4B0
movl $0x5, 0x8(%rsp)
movb $0x0, 0x1e(%rsp)
movb $0x1, 0x1f(%rsp)
leaq 0x8(%rsp), %rdi
movl $0xd, %esi
callq 0x225c0
leaq 0x8(%rsp), %rdi
movl $0xd, %esi
callq 0x22ad0
movl 0x44(%rsp), %edi
xorl %esi, %esi
leaq 0x8(%rsp), %rdx
callq 0x22d70
movq (%rsp), %rdi
callq 0x17c280
movq (%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_input_devices.c
// Function: fgInputDeviceClose
void fgInputDeviceClose( void )
{
    if ( fgState.InputDevsInitialised )
    {
        serial_close ( dialbox_port );
        dialbox_port = NULL;
        fgState.InputDevsInitialised = GL_FALSE;
    }
}

// Assembly:
pushq %rax
leaq 0x7e238(%rip), %rax     # 0x1fa390
cmpb $0x0, 0xb1(%rax)
je 0x17c186
movq 0x83d10(%rip), %rdi     # 0x1ffe78
callq 0x17c190
movq $0x0, 0x83d00(%rip) # 0x1ffe78
leaq 0x7e211(%rip), %rax     # 0x1fa390
movb $0x0, 0xb1(%rax)
popq %rax
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_input_devices.c
// Function: serial_close
static void serial_close(SERIALPORT *port)
{
    if (port)
    {
        /* restore old port settings */
        tcsetattr(port->fd,TCSANOW,&port->termio_save);
        close(port->fd);
        free(port);
    }
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
cmpq $0x0, (%rsp)
je 0x17c1c5
movq (%rsp), %rax
movl (%rax), %edi
movq (%rsp), %rdx
addq $0x40, %rdx
xorl %esi, %esi
callq 0x22d70
movq (%rsp), %rax
movl (%rax), %edi
callq 0x234c0
movq (%rsp), %rdi
callq 0x22c30
popq %rax
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_input_devices.c
// Function: send_dial_event
static void send_dial_event ( int num, int value )
{
    SFG_Enumerator enumerator;
    int data[2];
    data[0] = num;
    data[1] = value;
    enumerator.found = GL_FALSE;
    enumerator.data  =  data;
    fgEnumWindows ( fghcbEnumDialCallbacks, &enumerator );
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movl %esi, 0x20(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0xc(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0x8(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x3e(%rip), %rdi        # 0x17c2a0
leaq 0x10(%rsp), %rsi
callq 0x182ec0
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgInitialiseSpaceball
void fgInitialiseSpaceball(void)
{
    if(sball_initialized) {
        return;
    }

#if TARGET_HOST_POSIX_X11
    {
        Window w;

        if(!fgStructure.CurrentWindow)
            return;

        w = fgStructure.CurrentWindow->Window.Handle;
        if(spnav_x11_open(fgDisplay.Display, w) == -1) {
            return;
        }
    }
#endif

    sball_initialized = 1;
}

// Assembly:
pushq %rax
cmpl $0x0, 0x83b70(%rip)     # 0x1ffe88
je 0x17c31c
jmp 0x17c363
leaq 0x83bbd(%rip), %rax     # 0x1ffee0
cmpq $0x0, 0x30(%rax)
jne 0x17c32c
jmp 0x17c363
leaq 0x83bad(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, (%rsp)
leaq 0x83aea(%rip), %rax     # 0x1ffe30
movq (%rax), %rdi
movq (%rsp), %rsi
callq 0x17c370
cmpl $-0x1, %eax
jne 0x17c359
jmp 0x17c363
movl $0x1, 0x83b25(%rip)     # 0x1ffe88
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: spnav_x11_open
static int spnav_x11_open(Display *display, Window win)
{
  if(IS_OPEN) {
    return -1;
  }

  dpy = display;

  motion_event = XInternAtom(dpy, "MotionEvent", True);
  button_press_event = XInternAtom(dpy, "ButtonPressEvent", True);
  button_release_event = XInternAtom(dpy, "ButtonReleaseEvent", True);
  command_event = XInternAtom(dpy, "CommandEvent", True);

  if(!motion_event || !button_press_event || !button_release_event || !command_event) {
    dpy = 0;
    return -1;  /* daemon not started */
  }

  if(spnav_x11_window(win) == -1) {
    dpy = 0;
    return -1;  /* daemon not started */
  }

  app_win = win;
  return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, (%rsp)
cmpq $0x0, 0x83b13(%rip)     # 0x1ffe98
je 0x17c394
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x17c48f
movq 0x8(%rsp), %rax
movq %rax, 0x83af8(%rip)     # 0x1ffe98
movq 0x83af1(%rip), %rdi     # 0x1ffe98
leaq 0x320ea(%rip), %rsi     # 0x1ae498
movl $0x1, %edx
callq 0x22740
movq %rax, 0x83ae1(%rip)     # 0x1ffea0
movq 0x83ad2(%rip), %rdi     # 0x1ffe98
leaq 0x320d7(%rip), %rsi     # 0x1ae4a4
movl $0x1, %edx
callq 0x22740
movq %rax, 0x83aca(%rip)     # 0x1ffea8
movq 0x83ab3(%rip), %rdi     # 0x1ffe98
leaq 0x320c9(%rip), %rsi     # 0x1ae4b5
movl $0x1, %edx
callq 0x22740
movq %rax, 0x83ab3(%rip)     # 0x1ffeb0
movq 0x83a94(%rip), %rdi     # 0x1ffe98
leaq 0x320bd(%rip), %rsi     # 0x1ae4c8
movl $0x1, %edx
callq 0x22740
movq %rax, 0x83a9c(%rip)     # 0x1ffeb8
cmpq $0x0, 0x83a7c(%rip)     # 0x1ffea0
je 0x17c444
cmpq $0x0, 0x83a7a(%rip)     # 0x1ffea8
je 0x17c444
cmpq $0x0, 0x83a78(%rip)     # 0x1ffeb0
je 0x17c444
cmpq $0x0, 0x83a76(%rip)     # 0x1ffeb8
jne 0x17c459
movq $0x0, 0x83a49(%rip) # 0x1ffe98
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x17c48f
movq (%rsp), %rdi
callq 0x17c630
cmpl $-0x1, %eax
jne 0x17c47c
movq $0x0, 0x83a26(%rip) # 0x1ffe98
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x17c48f
movq (%rsp), %rax
movq %rax, 0x83a39(%rip)     # 0x1ffec0
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: spnav_close
static int spnav_close(void)
{
  if(dpy) {
    spnav_x11_window(DefaultRootWindow(dpy));
    app_win = 0;
    dpy = 0;
    return 0;
  }
  return -1;
}

// Assembly:
pushq %rax
cmpq $0x0, 0x839df(%rip)     # 0x1ffe98
je 0x17c507
movq 0x839d6(%rip), %rax     # 0x1ffe98
movq 0xe8(%rax), %rax
movq 0x839c8(%rip), %rcx     # 0x1ffe98
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x17c630
movq $0x0, 0x839ce(%rip) # 0x1ffec0
movq $0x0, 0x8399b(%rip) # 0x1ffe98
movl $0x0, 0x4(%rsp)
jmp 0x17c50f
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movl 0x4(%rsp), %eax
popq %rcx
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgHasSpaceball
int fgHasSpaceball(void)
{
    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            fgWarning("fgInitialiseSpaceball failed\n");
            return 0;
        }
    }

#if TARGET_HOST_POSIX_X11
    /* XXX this function should somehow query the driver if there's a device
     * plugged in, as opposed to just checking if there's a driver to talk to.
     */
    return spnav_fd() == -1 ? 0 : 1;
#else
    return 0;
#endif
}

// Assembly:
pushq %rax
cmpl $0x0, 0x83960(%rip)     # 0x1ffe88
jne 0x17c552
callq 0x17c310
cmpl $0x0, 0x83952(%rip)     # 0x1ffe88
jne 0x17c550
leaq 0x31f3b(%rip), %rdi     # 0x1ae47a
movb $0x0, %al
callq 0x17dfa0
movl $0x0, 0x4(%rsp)
jmp 0x17c56a
jmp 0x17c552
callq 0x17c570
movl %eax, %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $-0x1, %edx
cmovel %ecx, %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgSpaceballNumButtons
int fgSpaceballNumButtons(void)
{
    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            fgWarning("fgInitialiseSpaceball failed\n");
            return 0;
        }
    }

#if TARGET_HOST_POSIX_X11
    return 2;  /* TODO implement this properly */
#else
    return 0;
#endif
}

// Assembly:
pushq %rax
cmpl $0x0, 0x838e0(%rip)     # 0x1ffe88
jne 0x17c5d2
callq 0x17c310
cmpl $0x0, 0x838d2(%rip)     # 0x1ffe88
jne 0x17c5d0
leaq 0x31ebb(%rip), %rdi     # 0x1ae47a
movb $0x0, %al
callq 0x17dfa0
movl $0x0, 0x4(%rsp)
jmp 0x17c5da
jmp 0x17c5d2
movl $0x2, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgSpaceballSetWindow
void fgSpaceballSetWindow(SFG_Window *window)
{
    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            return;
        }
    }

#if TARGET_HOST_POSIX_X11
    if(spnav_win != window) {
        spnav_x11_window(window->Window.Handle);
        spnav_win = window;
    }
#endif
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
cmpl $0x0, 0x8389c(%rip)     # 0x1ffe88
jne 0x17c600
callq 0x17c310
cmpl $0x0, 0x8388e(%rip)     # 0x1ffe88
jne 0x17c5fe
jmp 0x17c625
jmp 0x17c600
movq 0x83889(%rip), %rax     # 0x1ffe90
cmpq (%rsp), %rax
je 0x17c625
movq (%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x17c630
movq (%rsp), %rax
movq %rax, 0x8386b(%rip)     # 0x1ffe90
popq %rax
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: spnav_x11_window
static int spnav_x11_window(Window win)
{
  int (*prev_xerr_handler)(Display*, XErrorEvent*);
  XEvent xev;
  Window daemon_win;

  if(!IS_OPEN) {
    return -1;
  }

  if(!(daemon_win = get_daemon_window(dpy))) {
    return -1;
  }

  prev_xerr_handler = XSetErrorHandler(catch_badwin);

  xev.type = ClientMessage;
  xev.xclient.send_event = False;
  xev.xclient.display = dpy;
  xev.xclient.window = win;
  xev.xclient.message_type = command_event;
  xev.xclient.format = 16;
  xev.xclient.data.s[0] = ((unsigned int)win & 0xffff0000) >> 16;
  xev.xclient.data.s[1] = (unsigned int)win & 0xffff;
  xev.xclient.data.s[2] = CMD_APP_WINDOW;

  XSendEvent(dpy, daemon_win, False, 0, &xev);
  XSync(dpy, False);

  XSetErrorHandler(prev_xerr_handler);
  return 0;
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xd8(%rsp)
cmpq $0x0, 0x83851(%rip)     # 0x1ffe98
jne 0x17c659
movl $0xffffffff, 0xe4(%rsp) # imm = 0xFFFFFFFF
jmp 0x17c741
movq 0x83838(%rip), %rdi     # 0x1ffe98
callq 0x17cad0
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0x17c680
movl $0xffffffff, 0xe4(%rsp) # imm = 0xFFFFFFFF
jmp 0x17c741
leaq 0x589(%rip), %rdi       # 0x17cc10
callq 0x222c0
movq %rax, 0xd0(%rsp)
movl $0x21, 0x10(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x837ed(%rip), %rax     # 0x1ffe98
movq %rax, 0x28(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x837f4(%rip), %rax     # 0x1ffeb8
movq %rax, 0x38(%rsp)
movl $0x10, 0x40(%rsp)
movq 0xd8(%rsp), %rax
andl $0xffff0000, %eax       # imm = 0xFFFF0000
shrl $0x10, %eax
movw %ax, 0x48(%rsp)
movq 0xd8(%rsp), %rax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, 0x4a(%rsp)
movw $0x6c2f, 0x4c(%rsp)     # imm = 0x6C2F
movq 0x83792(%rip), %rdi     # 0x1ffe98
movq 0x8(%rsp), %rsi
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
leaq 0x10(%rsp), %r8
callq 0x22250
movq 0x83776(%rip), %rdi     # 0x1ffe98
xorl %esi, %esi
callq 0x23440
movq 0xd0(%rsp), %rdi
callq 0x222c0
movl $0x0, 0xe4(%rsp)
movl 0xe4(%rsp), %eax
addq $0xe8, %rsp
retq
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgIsSpaceballXEvent
int fgIsSpaceballXEvent(const XEvent *xev)
{
    spnav_event sev;

    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            return 0;
        }
    }

    return spnav_x11_event(xev, &sev);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
cmpl $0x0, 0x83728(%rip)     # 0x1ffe88
jne 0x17c77c
callq 0x17c310
cmpl $0x0, 0x8371a(%rip)     # 0x1ffe88
jne 0x17c77a
movl $0x0, 0x34(%rsp)
jmp 0x17c78d
jmp 0x17c77c
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x17c7a0
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: spnav_x11_event
static int spnav_x11_event(const XEvent *xev, spnav_event *event)
{
  int i;
  int xmsg_type;

  if(xev->type != ClientMessage) {
    return 0;
  }

  xmsg_type = xev->xclient.message_type;

  if(xmsg_type != motion_event && xmsg_type != button_press_event &&
      xmsg_type != button_release_event) {
    return 0;
  }

  if(xmsg_type == motion_event) {
    event->type = SPNAV_EVENT_MOTION;
    event->motion.data = &event->motion.x;

    for(i=0; i<6; i++) {
      event->motion.data[i] = xev->xclient.data.s[i + 2];
    }
    event->motion.period = xev->xclient.data.s[8];
  } else {
    event->type = SPNAV_EVENT_BUTTON;
    event->button.press = xmsg_type == button_press_event ? 1 : 0;
    event->button.bnum = xev->xclient.data.s[2];
  }
  return event->type;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq -0x10(%rsp), %rax
cmpl $0x21, (%rax)
je 0x17c7c1
movl $0x0, -0x4(%rsp)
jmp 0x17c8cc
movq -0x10(%rsp), %rax
movq 0x28(%rax), %rax
movl %eax, -0x20(%rsp)
movslq -0x20(%rsp), %rax
cmpq 0x836c6(%rip), %rax     # 0x1ffea0
je 0x17c805
movslq -0x20(%rsp), %rax
cmpq 0x836c0(%rip), %rax     # 0x1ffea8
je 0x17c805
movslq -0x20(%rsp), %rax
cmpq 0x836ba(%rip), %rax     # 0x1ffeb0
je 0x17c805
movl $0x0, -0x4(%rsp)
jmp 0x17c8cc
movslq -0x20(%rsp), %rax
cmpq 0x8368f(%rip), %rax     # 0x1ffea0
jne 0x17c884
movq -0x18(%rsp), %rax
movl $0x1, (%rax)
movq -0x18(%rsp), %rcx
addq $0x4, %rcx
movq -0x18(%rsp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x1c(%rsp)
cmpl $0x6, -0x1c(%rsp)
jge 0x17c871
movq -0x10(%rsp), %rax
movl -0x1c(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movswl 0x38(%rax,%rcx,2), %edx
movq -0x18(%rsp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0x17c838
movq -0x10(%rsp), %rax
movswl 0x48(%rax), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x17c8c1
movq -0x18(%rsp), %rax
movl $0x2, (%rax)
movslq -0x20(%rsp), %rdx
movq 0x8360d(%rip), %rsi     # 0x1ffea8
xorl %ecx, %ecx
movl $0x1, %eax
cmpq %rsi, %rdx
cmovel %eax, %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rsp), %rax
movswl 0x3c(%rax), %ecx
movq -0x18(%rsp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: fgSpaceballHandleXEvent
void fgSpaceballHandleXEvent(const XEvent *xev)
{
    spnav_event sev;

    if(!sball_initialized) {
        fgInitialiseSpaceball();
        if(!sball_initialized) {
            return;
        }
    }

    if(spnav_x11_event(xev, &sev)) {
        switch(sev.type) {
        case SPNAV_EVENT_MOTION:
            if(sev.motion.x | sev.motion.y | sev.motion.z) {
                INVOKE_WCB(*spnav_win, SpaceMotion, (sev.motion.x, sev.motion.y, sev.motion.z));
            }
            if(sev.motion.rx | sev.motion.ry | sev.motion.rz) {
                INVOKE_WCB(*spnav_win, SpaceRotation, (sev.motion.rx, sev.motion.ry, sev.motion.rz));
            }
            spnav_remove_events(SPNAV_EVENT_MOTION);
            break;

        case SPNAV_EVENT_BUTTON:
            INVOKE_WCB(*spnav_win, SpaceButton, (sev.button.bnum, sev.button.press ? GLUT_DOWN : GLUT_UP));
            break;

        default:
            break;
        }
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
cmpl $0x0, 0x83598(%rip)     # 0x1ffe88
jne 0x17c907
callq 0x17c310
cmpl $0x0, 0x8358a(%rip)     # 0x1ffe88
jne 0x17c905
jmp 0x17ca38
jmp 0x17c907
movq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x17c7a0
cmpl $0x0, %eax
je 0x17ca38
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rsp)
subl $0x1, %eax
je 0x17c940
jmp 0x17c92e
movl 0x4(%rsp), %eax
subl $0x2, %eax
je 0x17c9ec
jmp 0x17ca34
movl 0xc(%rsp), %eax
orl 0x10(%rsp), %eax
orl 0x14(%rsp), %eax
cmpl $0x0, %eax
je 0x17c990
jmp 0x17c953
movq 0x83536(%rip), %rax     # 0x1ffe90
cmpq $0x0, 0xf8(%rax)
je 0x17c98c
movq 0x83525(%rip), %rdi     # 0x1ffe90
callq 0x1838e0
movq 0x83519(%rip), %rax     # 0x1ffe90
movq 0xf8(%rax), %rax
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
callq *%rax
jmp 0x17c98e
jmp 0x17c990
movl 0x18(%rsp), %eax
orl 0x1c(%rsp), %eax
orl 0x20(%rsp), %eax
cmpl $0x0, %eax
je 0x17c9e0
jmp 0x17c9a3
movq 0x834e6(%rip), %rax     # 0x1ffe90
cmpq $0x0, 0x100(%rax)
je 0x17c9dc
movq 0x834d5(%rip), %rdi     # 0x1ffe90
callq 0x1838e0
movq 0x834c9(%rip), %rax     # 0x1ffe90
movq 0x100(%rax), %rax
movl 0x18(%rsp), %edi
movl 0x1c(%rsp), %esi
movl 0x20(%rsp), %edx
callq *%rax
jmp 0x17c9de
jmp 0x17c9e0
movl $0x1, %edi
callq 0x17ca40
jmp 0x17ca36
jmp 0x17c9ee
movq 0x8349b(%rip), %rax     # 0x1ffe90
cmpq $0x0, 0x108(%rax)
je 0x17ca30
movq 0x8348a(%rip), %rdi     # 0x1ffe90
callq 0x1838e0
movq 0x8347e(%rip), %rax     # 0x1ffe90
movq 0x108(%rax), %rax
movl 0x10(%rsp), %edi
movl 0xc(%rsp), %edx
movl $0x1, %esi
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %esi
callq *%rax
jmp 0x17ca32
jmp 0x17ca36
jmp 0x17ca36
jmp 0x17ca38
addq $0x38, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: spnav_remove_events
static int spnav_remove_events(int type)
{
  int rm_count = 0;

  if(dpy) {
    XEvent xev;

    while(XCheckIfEvent(dpy, &xev, match_events, (char*)&type)) {
      rm_count++;
    }
    return rm_count;
  }
  return 0;
}

// Assembly:
subq $0xd8, %rsp
movl %edi, 0xd0(%rsp)
movl $0x0, 0xcc(%rsp)
cmpq $0x0, 0x83437(%rip)     # 0x1ffe98
je 0x17caad
jmp 0x17ca65
movq 0x8342c(%rip), %rdi     # 0x1ffe98
leaq 0x8(%rsp), %rsi
leaq 0x208(%rip), %rdx       # 0x17cc80
leaq 0xd0(%rsp), %rcx
callq 0x23520
cmpl $0x0, %eax
je 0x17ca9d
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x17ca65
movl 0xcc(%rsp), %eax
movl %eax, 0xd4(%rsp)
jmp 0x17cab8
movl $0x0, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
addq $0xd8, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: get_daemon_window
static Window get_daemon_window(Display *dpy)
{
  Window win, root_win;
  XTextProperty wname;
  Atom type;
  int fmt;
  unsigned long nitems, bytes_after;
  unsigned char *prop;

  root_win = DefaultRootWindow(dpy);

  XGetWindowProperty(dpy, root_win, command_event, 0, 1, False, AnyPropertyType, &type, &fmt, &nitems, &bytes_after, &prop);
  if(!prop) {
    return 0;
  }

  win = *(Window*)prop;
  XFree(prop);

  if(!XGetWMName(dpy, win, &wname) || strcmp("Magellan Window", (char*)wname.value) != 0) {
    return 0;
  }

  return win;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x88(%rsp), %rcx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x88(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x83394(%rip), %rdx     # 0x1ffeb8
xorl %eax, %eax
movl %eax, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
leaq 0x50(%rsp), %r14
leaq 0x4c(%rsp), %rbx
leaq 0x40(%rsp), %r11
leaq 0x38(%rsp), %r10
leaq 0x30(%rsp), %rax
movq $0x0, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x222a0
cmpq $0x0, 0x30(%rsp)
jne 0x17cb86
movq $0x0, 0x90(%rsp)
jmp 0x17cbf3
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x30(%rsp), %rdi
callq 0x22d60
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x22400
cmpl $0x0, %eax
je 0x17cbd5
movq 0x58(%rsp), %rsi
leaq 0x3190a(%rip), %rdi     # 0x1ae4d5
callq 0x22ec0
cmpl $0x0, %eax
je 0x17cbe3
movq $0x0, 0x90(%rsp)
jmp 0x17cbf3
movq 0x80(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r14
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: catch_badwin
static int catch_badwin(Display *dpy, XErrorEvent *err)
{
  char buf[256];

  if(err->error_code == BadWindow) {
    /* do nothing? */
  } else {
    XGetErrorText(dpy, err->error_code, buf, sizeof buf);
    fprintf(stderr, "Caught unexpected X error: %s\n", buf);
  }
  return 0;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq 0x108(%rsp), %rax
movzbl 0x20(%rax), %eax
cmpl $0x3, %eax
jne 0x17cc3a
jmp 0x17cc76
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rax
movzbl 0x20(%rax), %esi
movq %rsp, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x22f60
movq 0x78366(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
movq %rsp, %rdx
leaq 0x31876(%rip), %rsi     # 0x1ae4e5
movb $0x0, %al
callq 0x22f30
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
retq
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_spaceball.c
// Function: match_events
static Bool match_events(Display *dpy, XEvent *xev, char *arg)
{
  int evtype = *(int*)arg;

  if(xev->type != ClientMessage) {
    return False;
  }

  if(xev->xclient.message_type == motion_event) {
    return !evtype || evtype == SPNAV_EVENT_MOTION ? True : False;
  }
  if(xev->xclient.message_type == button_press_event ||
      xev->xclient.message_type == button_release_event) {
    return !evtype || evtype == SPNAV_EVENT_BUTTON ? True : False;
  }
  return False;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq %rdx, -0x20(%rsp)
movq -0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rsp)
movq -0x18(%rsp), %rax
cmpl $0x21, (%rax)
je 0x17ccb1
movl $0x0, -0x4(%rsp)
jmp 0x17cd4f
movq -0x18(%rsp), %rax
movq 0x28(%rax), %rax
cmpq 0x831df(%rip), %rax     # 0x1ffea0
jne 0x17ccf3
movb $0x1, %al
cmpl $0x0, -0x24(%rsp)
movb %al, -0x25(%rsp)
je 0x17ccdc
cmpl $0x1, -0x24(%rsp)
sete %al
movb %al, -0x25(%rsp)
movb -0x25(%rsp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rsp)
jmp 0x17cd4f
movq -0x18(%rsp), %rax
movq 0x28(%rax), %rax
cmpq 0x831a5(%rip), %rax     # 0x1ffea8
je 0x17cd17
movq -0x18(%rsp), %rax
movq 0x28(%rax), %rax
cmpq 0x8319b(%rip), %rax     # 0x1ffeb0
jne 0x17cd47
movb $0x1, %al
cmpl $0x0, -0x24(%rsp)
movb %al, -0x26(%rsp)
je 0x17cd30
cmpl $0x2, -0x24(%rsp)
sete %al
movb %al, -0x26(%rsp)
movb -0x26(%rsp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rsp)
jmp 0x17cd4f
movl $0x0, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_joystick.c
// Function: fgInitialiseJoysticks
void fgInitialiseJoysticks ( void )
{
    if( !fgState.JoysticksInitialised )
    {
        int ident ;
        for ( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ )
            fghJoystickInit( ident );

        fgState.JoysticksInitialised = GL_TRUE;
    }
}

// Assembly:
pushq %rax
leaq 0x7d628(%rip), %rax     # 0x1fa390
cmpb $0x0, 0xb0(%rax)
jne 0x17cda4
movl $0x0, 0x4(%rsp)
cmpl $0x2, 0x4(%rsp)
jge 0x17cd96
movl 0x4(%rsp), %edi
callq 0x17cdb0
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x17cd79
leaq 0x7d5f3(%rip), %rax     # 0x1fa390
movb $0x1, 0xb0(%rax)
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_joystick.c
// Function: fgJoystickPollWindow
void fgJoystickPollWindow( SFG_Window* window )
{
    float axes[ _JS_MAX_AXES ];
    int buttons;
    int ident;

    freeglut_return_if_fail( window );
    freeglut_return_if_fail( FETCH_WCB( *window, Joystick ) );

    for( ident = 0; ident < MAX_NUM_JOYSTICKS; ident++ )
    {
        if( fgJoystick[ident] )
        {
            fghJoystickRead( fgJoystick[ident], &buttons, axes );

            if( !fgJoystick[ident]->error )
                INVOKE_WCB( *window, Joystick,
                            ( buttons,
                              (int) ( axes[ 0 ] * 1000.0f ),
                              (int) ( axes[ 1 ] * 1000.0f ),
                              (int) ( axes[ 2 ] * 1000.0f ) )
                );
        }
    }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x17cfd6
jmp 0x17d0c7
movq 0x50(%rsp), %rax
cmpq $0x0, 0xd8(%rax)
jne 0x17cfea
jmp 0x17d0c7
movl $0x0, 0x8(%rsp)
cmpl $0x2, 0x8(%rsp)
jge 0x17d0c7
movslq 0x8(%rsp), %rcx
leaq 0x82ec7(%rip), %rax     # 0x1ffed0
cmpq $0x0, (%rax,%rcx,8)
je 0x17d0b5
movslq 0x8(%rsp), %rcx
leaq 0x82eb0(%rip), %rax     # 0x1ffed0
movq (%rax,%rcx,8), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rsi
callq 0x17d0d0
movslq 0x8(%rsp), %rcx
leaq 0x82e91(%rip), %rax     # 0x1ffed0
movq (%rax,%rcx,8), %rax
cmpb $0x0, 0xd4(%rax)
jne 0x17d0b3
jmp 0x17d04e
movq 0x50(%rsp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x17d0af
movq 0x50(%rsp), %rdi
callq 0x1838e0
movq 0x50(%rsp), %rax
movq 0xd8(%rax), %rax
movl 0xc(%rsp), %edi
movss 0x31485(%rip), %xmm0    # 0x1ae504
mulss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %esi
movss 0x31473(%rip), %xmm0    # 0x1ae504
mulss 0x14(%rsp), %xmm0
cvttss2si %xmm0, %edx
movss 0x31461(%rip), %xmm0    # 0x1ae504
mulss 0x18(%rsp), %xmm0
cvttss2si %xmm0, %ecx
callq *%rax
jmp 0x17d0b1
jmp 0x17d0b3
jmp 0x17d0b5
jmp 0x17d0b7
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x17cff2
addq $0x58, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_joystick.c
// Function: fghJoystickRead
static void fghJoystickRead( SFG_Joystick* joy, int* buttons, float* axes )
{
    float raw_axes[ _JS_MAX_AXES ];
    int  i;

    if( joy->error )
    {
        if( buttons )
            *buttons = 0;

        if( axes )
            for ( i=0; i<joy->num_axes; i++ )
                axes[ i ] = 0.0f;
    }

    fghJoystickRawRead( joy, buttons, raw_axes );

    if( axes )
        for( i=0; i<joy->num_axes; i++ )
            axes[ i ] = fghJoystickFudgeAxis( joy, raw_axes[ i ], i );
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x60(%rsp), %rax
cmpb $0x0, 0xd4(%rax)
je 0x17d148
cmpq $0x0, 0x58(%rsp)
je 0x17d104
movq 0x58(%rsp), %rax
movl $0x0, (%rax)
cmpq $0x0, 0x50(%rsp)
je 0x17d146
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x158(%rcx), %eax
jge 0x17d144
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x17d114
jmp 0x17d146
jmp 0x17d148
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x17d930
cmpq $0x0, 0x50(%rsp)
je 0x17d1b4
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x158(%rcx), %eax
jge 0x17d1b2
movq 0x60(%rsp), %rdi
movslq 0xc(%rsp), %rax
movss 0x10(%rsp,%rax,4), %xmm0
movl 0xc(%rsp), %esi
callq 0x17db60
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x17d16c
jmp 0x17d1b4
addq $0x68, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_joystick.c
// Function: fgJoystickDetect
int fgJoystickDetect( void )
{
    int ident;

    fgInitialiseJoysticks ();

    if ( !fgState.JoysticksInitialised )
        return 0;

    for( ident=0; ident<MAX_NUM_JOYSTICKS; ident++ )
        if( fgJoystick[ident] && !fgJoystick[ident]->error )
            return 1;

    return 0;
}

// Assembly:
pushq %rax
callq 0x17cd60
leaq 0x7d1c3(%rip), %rax     # 0x1fa390
cmpb $0x0, 0xb0(%rax)
jne 0x17d1e0
movl $0x0, 0x4(%rsp)
jmp 0x17d236
movl $0x0, (%rsp)
cmpl $0x2, (%rsp)
jge 0x17d22e
movslq (%rsp), %rcx
leaq 0x82cd8(%rip), %rax     # 0x1ffed0
cmpq $0x0, (%rax,%rcx,8)
je 0x17d221
movslq (%rsp), %rcx
leaq 0x82cc6(%rip), %rax     # 0x1ffed0
movq (%rax,%rcx,8), %rax
cmpb $0x0, 0xd4(%rax)
jne 0x17d221
movl $0x1, 0x4(%rsp)
jmp 0x17d236
jmp 0x17d223
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x17d1e7
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
popq %rcx
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fgError
void fgError( const char *fmt, ... )
{
    va_list ap;

    va_start( ap, fmt );

    fprintf( stderr, "freeglut ");
    if( fgState.ProgramName )
        fprintf( stderr, "(%s): ", fgState.ProgramName );
    VFPRINTF( stderr, fmt, ap );
    fprintf( stderr, "\n" );

    va_end( ap );

    if ( fgState.Initialised )
        fgDeinitialize ();

    exit( 1 );
}

// Assembly:
subq $0xd8, %rsp
testb %al, %al
je 0x17deac
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm2, 0x50(%rsp)
movaps %xmm3, 0x60(%rsp)
movaps %xmm4, 0x70(%rsp)
movaps %xmm5, 0x80(%rsp)
movaps %xmm6, 0x90(%rsp)
movaps %xmm7, 0xa0(%rsp)
movq %r9, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, 0xd0(%rsp)
leaq 0xb0(%rsp), %rax
movq %rsp, %rcx
movq %rcx, 0x10(%rax)
leaq 0xe0(%rsp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq 0x770cc(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
leaq 0x30a4a(%rip), %rsi     # 0x1ae950
movb $0x0, %al
callq 0x22f30
leaq 0x7c47c(%rip), %rax     # 0x1fa390
cmpq $0x0, 0xa8(%rax)
je 0x17df44
movq 0x770a3(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
leaq 0x7c461(%rip), %rax     # 0x1fa390
movq 0xa8(%rax), %rdx
leaq 0x30a1d(%rip), %rsi     # 0x1ae95a
movb $0x0, %al
callq 0x22f30
movq 0x7707d(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
movq 0xd0(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x22e00
movq 0x7705e(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
leaq 0x176ce(%rip), %rsi     # 0x195642
movb $0x0, %al
callq 0x22f30
leaq 0xb0(%rsp), %rax
leaq 0x7c406(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
je 0x17df95
callq 0x17af70
movl $0x1, %edi
callq 0x22c60
nop
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fgWarning
void fgWarning( const char *fmt, ... )
{
    va_list ap;

    va_start( ap, fmt );

    fprintf( stderr, "freeglut ");
    if( fgState.ProgramName )
        fprintf( stderr, "(%s): ", fgState.ProgramName );
    VFPRINTF( stderr, fmt, ap );
    fprintf( stderr, "\n" );

    va_end( ap );
}

// Assembly:
subq $0xe8, %rsp
testb %al, %al
je 0x17dfdf
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, 0x50(%rsp)
movaps %xmm2, 0x60(%rsp)
movaps %xmm3, 0x70(%rsp)
movaps %xmm4, 0x80(%rsp)
movaps %xmm5, 0x90(%rsp)
movaps %xmm6, 0xa0(%rsp)
movaps %xmm7, 0xb0(%rsp)
movq %r9, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, 0xe0(%rsp)
leaq 0xc0(%rsp), %rax
leaq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0xf0(%rsp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq 0x76f97(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
leaq 0x30915(%rip), %rsi     # 0x1ae950
movb $0x0, %al
callq 0x22f30
leaq 0x7c347(%rip), %rax     # 0x1fa390
cmpq $0x0, 0xa8(%rax)
je 0x17e079
movq 0x76f6e(%rip), %rax     # 0x1f4fc8
movq (%rax), %rdi
leaq 0x7c32c(%rip), %rax     # 0x1fa390
movq 0xa8(%rax), %rdx
leaq 0x308e8(%rip), %rsi     # 0x1ae95a
movb $0x0, %al
callq 0x22f30
movq 0x76f48(%rip), %rax     # 0x1f4fc8
movq %rax, 0x8(%rsp)
movq (%rax), %rdi
movq 0xe0(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x22e00
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x17596(%rip), %rsi     # 0x195642
xorl %eax, %eax
callq 0x22f30
addq $0xe8, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghGetXModifiers
static int fghGetXModifiers( int state )
{
    int ret = 0;

    if( state & ( ShiftMask | LockMask ) )
        ret |= GLUT_ACTIVE_SHIFT;
    if( state & ControlMask )
        ret |= GLUT_ACTIVE_CTRL;
    if( state & Mod1Mask )
        ret |= GLUT_ACTIVE_ALT;

    return ret;
}

// Assembly:
movl %edi, -0x4(%rsp)
movl $0x0, -0x8(%rsp)
movl -0x4(%rsp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x17eec3
movl -0x8(%rsp), %eax
orl $0x1, %eax
movl %eax, -0x8(%rsp)
movl -0x4(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x17eeda
movl -0x8(%rsp), %eax
orl $0x2, %eax
movl %eax, -0x8(%rsp)
movl -0x4(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x17eef1
movl -0x8(%rsp), %eax
orl $0x4, %eax
movl %eax, -0x8(%rsp)
movl -0x8(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghCheckTimers
static void fghCheckTimers( void )
{
    long checkTime = fgElapsedTime( );

    while( fgState.Timers.First )
    {
        SFG_Timer *timer = fgState.Timers.First;

        if( timer->TriggerTime > checkTime )
            break;

        fgListRemove( &fgState.Timers, &timer->Node );
        fgListAppend( &fgState.FreeTimers, &timer->Node );

        timer->Callback( timer->ID );
    }
}

// Assembly:
subq $0x18, %rsp
callq 0x17de50
movq %rax, 0x10(%rsp)
leaq 0x7b47b(%rip), %rax     # 0x1fa390
cmpq $0x0, 0x48(%rax)
je 0x17ef7d
leaq 0x7b46d(%rip), %rax     # 0x1fa390
movq 0x48(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
cmpq 0x10(%rsp), %rax
jle 0x17ef3e
jmp 0x17ef7d
movq 0x8(%rsp), %rsi
leaq 0x7b446(%rip), %rdi     # 0x1fa390
addq $0x48, %rdi
callq 0x182ae0
movq 0x8(%rsp), %rsi
leaq 0x7b431(%rip), %rdi     # 0x1fa390
addq $0x58, %rdi
callq 0x182700
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %edi
callq *%rax
jmp 0x17ef0e
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghSleepForEvents
static void fghSleepForEvents( void )
{
    long msec;

    if( fgState.IdleCallback || fghHavePendingRedisplays( ) )
        return;

    msec = fghNextTimer( );
    /* XXX Use GLUT timers for joysticks... */
    /* XXX Dumb; forces granularity to .01sec */
    if( fghHaveJoystick( ) && ( msec > 10 ) )     
        msec = 10;

#if TARGET_HOST_POSIX_X11
    /*
     * Possibly due to aggressive use of XFlush() and friends,
     * it is possible to have our socket drained but still have
     * unprocessed events.  (Or, this may just be normal with
     * X, anyway?)  We do non-trivial processing of X events
     * after the event-reading loop, in any case, so we
     * need to allow that we may have an empty socket but non-
     * empty event queue.
     */
    if( ! XPending( fgDisplay.Display ) )
    {
        fd_set fdset;
        int socket;
        struct timeval wait;

        socket = ConnectionNumber( fgDisplay.Display );
        FD_ZERO( &fdset );
        FD_SET( socket, &fdset );
        wait.tv_sec = msec / 1000;
        wait.tv_usec = (msec % 1000) * 1000;

#if HAVE_ERRNO
        int err = select( socket+1, &fdset, NULL, NULL, &wait );
        if( ( -1 == err ) && ( errno != EINTR ) )
            fgWarning ( "freeglut select() error: %d", errno );
#else
        // Silence compiler about variable being set but not used
        if (wait.tv_sec == -196) printf("Wow");
#endif
    }
#elif TARGET_HOST_MS_WINDOWS
    MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT );
#endif
}

// Assembly:
subq $0xb8, %rsp
leaq 0x7b272(%rip), %rax     # 0x1fa390
cmpq $0x0, 0x68(%rax)
jne 0x17f12f
callq 0x17f510
cmpl $0x0, %eax
je 0x17f134
jmp 0x17f24a
callq 0x17f550
movq %rax, 0xb0(%rsp)
callq 0x17f5c0
cmpl $0x0, %eax
je 0x17f162
cmpq $0xa, 0xb0(%rsp)
jle 0x17f162
movq $0xa, 0xb0(%rsp)
leaq 0x80cc7(%rip), %rax     # 0x1ffe30
movq (%rax), %rdi
callq 0x228e0
cmpl $0x0, %eax
jne 0x17f24a
leaq 0x80caf(%rip), %rax     # 0x1ffe30
movq (%rax), %rax
movl 0x10(%rax), %eax
movl %eax, 0x2c(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpq $0x10, %rax
jae 0x17f1c5
movq 0x8(%rsp), %rax
movl 0x14(%rsp), %ecx
movq $0x0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x17f19d
jmp 0x17f1c7
movl 0x2c(%rsp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl 0x2c(%rsp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq 0x30(%rsp,%rax,8), %rcx
movq %rcx, 0x30(%rsp,%rax,8)
movq 0xb0(%rsp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, 0x18(%rsp)
movq 0xb0(%rsp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
movq %rax, 0x20(%rsp)
cmpq $-0xc4, 0x18(%rsp)
jne 0x17f248
leaq 0x2f78a(%rip), %rdi     # 0x1ae9cb
movb $0x0, %al
callq 0x22090
jmp 0x17f24a
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghcbCheckJoystickPolls
static void fghcbCheckJoystickPolls( SFG_Window *window,
                                     SFG_Enumerator *enumerator )
{
    long int checkTime = fgElapsedTime( );

    if( window->State.JoystickLastPoll + window->State.JoystickPollRate <=
        checkTime )
    {
#if !defined(_WIN32_WCE)
        fgJoystickPollWindow( window );
#endif /* !defined(_WIN32_WCE) */
        window->State.JoystickLastPoll = checkTime;
    }

    fgEnumSubWindows( window, fghcbCheckJoystickPolls, enumerator );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
callq 0x17de50
movq %rax, (%rsp)
movq 0x10(%rsp), %rax
movq 0x58(%rax), %rax
movq 0x10(%rsp), %rcx
addq 0x50(%rcx), %rax
cmpq (%rsp), %rax
jg 0x17f2e6
movq 0x10(%rsp), %rdi
callq 0x17cfc0
movq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x58(%rax)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq -0x57(%rip), %rsi       # 0x17f2a0
callq 0x182f40
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghcbDisplayWindow
static void fghcbDisplayWindow( SFG_Window *window,
                                SFG_Enumerator *enumerator )
{
    if( window->State.Redisplay &&
        window->State.Visible )
    {
        window->State.Redisplay = GL_FALSE;

#if TARGET_HOST_POSIX_X11
        fghRedrawWindow ( window ) ;
#elif TARGET_HOST_MS_WINDOWS
        RedrawWindow(
            window->Window.Handle, NULL, NULL,
            RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW
        );
#endif
    }

    fgEnumSubWindows( window, fghcbDisplayWindow, enumerator );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rax
movzbl 0x48(%rax), %eax
cmpl $0x0, %eax
je 0x17f34d
movq 0x10(%rsp), %rax
movzbl 0x49(%rax), %eax
cmpl $0x0, %eax
je 0x17f34d
movq 0x10(%rsp), %rax
movb $0x0, 0x48(%rax)
movq 0x10(%rsp), %rdi
callq 0x17f370
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq -0x4e(%rip), %rsi       # 0x17f310
callq 0x182f40
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghRedrawWindow
static void fghRedrawWindow ( SFG_Window *window )
{
    SFG_Window *current_window = fgStructure.CurrentWindow;

    freeglut_return_if_fail( window );
    freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );

    window->State.Redisplay = GL_FALSE;

    freeglut_return_if_fail( window->State.Visible );

    fgSetWindow( window );

    if( window->State.NeedToResize )
    {
        fghReshapeWindow(
            window,
            window->State.Width,
            window->State.Height
        );

        window->State.NeedToResize = GL_FALSE;
    }

    INVOKE_WCB( *window, Display, ( ) );

    fgSetWindow( current_window );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
leaq 0x80b60(%rip), %rax     # 0x1ffee0
movq 0x30(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x17f396
jmp 0x17f41e
movq 0x10(%rsp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x17f3a4
jmp 0x17f41e
movq 0x10(%rsp), %rax
movb $0x0, 0x48(%rax)
movq 0x10(%rsp), %rax
cmpb $0x0, 0x49(%rax)
jne 0x17f3ba
jmp 0x17f41e
movq 0x10(%rsp), %rdi
callq 0x1838e0
movq 0x10(%rsp), %rax
cmpb $0x0, 0x6a(%rax)
je 0x17f3f2
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movl 0x38(%rax), %esi
movq 0x10(%rsp), %rax
movl 0x3c(%rax), %edx
callq 0x17f430
movq 0x10(%rsp), %rax
movb $0x0, 0x6a(%rax)
jmp 0x17f3f4
movq 0x10(%rsp), %rax
cmpq $0x0, 0x70(%rax)
je 0x17f412
movq 0x10(%rsp), %rdi
callq 0x1838e0
movq 0x10(%rsp), %rax
callq *0x70(%rax)
jmp 0x17f414
movq 0x8(%rsp), %rdi
callq 0x1838e0
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghHavePendingRedisplays
static int fghHavePendingRedisplays (void)
{
    SFG_Enumerator enumerator;

    enumerator.found = GL_FALSE;
    enumerator.data = NULL;
    fgEnumWindows( fghHavePendingRedisplaysCallback, &enumerator );
    return !!enumerator.data;
}

// Assembly:
subq $0x18, %rsp
movb $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0xd7(%rip), %rdi        # 0x17f600
leaq 0x8(%rsp), %rsi
callq 0x182ec0
cmpq $0x0, 0x10(%rsp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghNextTimer
static long fghNextTimer( void )
{
    long ret = INT_MAX;
    SFG_Timer *timer = fgState.Timers.First;

    if( timer )
        ret = timer->TriggerTime - fgElapsedTime();
    if( ret < 0 )
        ret = 0;

    return ret;
}

// Assembly:
subq $0x18, %rsp
movq $0x7fffffff, 0x10(%rsp) # imm = 0x7FFFFFFF
leaq 0x7ae2c(%rip), %rax     # 0x1fa390
movq 0x48(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x17f596
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, (%rsp)
callq 0x17de50
movq %rax, %rcx
movq (%rsp), %rax
subq %rcx, %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jge 0x17f5a7
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghHaveJoystick
static int fghHaveJoystick( void )
{
    SFG_Enumerator enumerator;

    enumerator.found = GL_FALSE;
    enumerator.data = NULL;
    fgEnumWindows( fghCheckJoystickCallback, &enumerator );
    return !!enumerator.data;
}

// Assembly:
subq $0x18, %rsp
movb $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x87(%rip), %rdi        # 0x17f660
leaq 0x8(%rsp), %rsi
callq 0x182ec0
cmpq $0x0, 0x10(%rsp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghHavePendingRedisplaysCallback
static void fghHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
{
    if( w->State.Redisplay && w->State.Visible )
    {
        e->found = GL_TRUE;
        e->data = w;
    }
    fgEnumSubWindows( w, fghHavePendingRedisplaysCallback, e );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rax
movzbl 0x48(%rax), %eax
cmpl $0x0, %eax
je 0x17f640
movq 0x10(%rsp), %rax
movzbl 0x49(%rax), %eax
cmpl $0x0, %eax
je 0x17f640
movq 0x8(%rsp), %rax
movb $0x1, (%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq -0x51(%rip), %rsi       # 0x17f600
callq 0x182f40
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fghCheckJoystickCallback
static void fghCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e)
{
    if( FETCH_WCB( *w, Joystick ) )
    {
        e->found = GL_TRUE;
        e->data = w;
    }
    fgEnumSubWindows( w, fghCheckJoystickCallback, e );
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x17f693
movq 0x8(%rsp), %rax
movb $0x1, (%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq -0x44(%rip), %rsi       # 0x17f660
callq 0x182f40
addq $0x18, %rsp
retq
nop