// File: /workspace/github_cpp_makefile_star2_O2/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:
testq %rdi, %rdi
je 0xba8e3
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r13
cmpq $0x0, 0xd8(%rdi)
je 0xba8d2
leaq 0x7d26a(%rip), %rsi     # 0x137880
pushq $0x8
popq %r14
movaps 0xc67f(%rip), %xmm5     # 0xc6ca0
movss 0xc7c7(%rip), %xmm6     # 0xc6df0
movss 0xa9d3(%rip), %xmm7     # 0xc5004
xorl %r15d, %r15d
movq %r13, 0x8(%rsp)
cmpq $0x2, %r15
je 0xba8d2
movq (%rsi,%r15,8), %rbp
testq %rbp, %rbp
je 0xba8ca
movb 0xd4(%rbp), %al
movl 0x158(%rbp), %ebx
testl %ebx, %ebx
movl $0x0, %ecx
cmovgl %ebx, %ecx
testb %al, %al
je 0xba67b
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xba67b
andl $0x0, 0x10(%rsp,%rdx,4)
incq %rdx
jmp 0xba66c
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xba68f
movl $0x44bb8000, 0x50(%rsp,%rdx,4) # imm = 0x44BB8000
incq %rdx
jmp 0xba67d
xorl %r12d, %r12d
testb %al, %al
jne 0xba789
leaq 0xc(%rbp), %r13
xorl %r12d, %r12d
pushq $0x1
popq %rbx
movl 0xcc(%rbp), %edi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x21de0
cmpl $0x8, %eax
jne 0xba718
movzbl 0x6(%rbp), %eax
andl $0x7f, %eax
cmpl $0x2, %eax
je 0xba6de
cmpl $0x1, %eax
jne 0xba739
movb 0x7(%rbp), %cl
movl %ebx, %eax
shll %cl, %eax
cmpw $0x0, 0x4(%rbp)
je 0xba70d
orl %eax, 0x8(%rbp)
jmp 0xba712
movzbl 0x7(%rbp), %eax
movl 0x158(%rbp), %edx
cmpl %eax, %edx
jle 0xba712
movswl 0x4(%rbp), %ecx
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0xc(%rbp,%rax,4)
shlq $0x2, %rdx
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x21720
jmp 0xba712
notl %eax
andl %eax, 0x8(%rbp)
movl 0x8(%rbp), %r12d
jmp 0xba6a4
leaq 0x4c(%rbp), %rsi
leaq 0x2a538(%rip), %rdi     # 0xe4c5b
xorl %eax, %eax
callq 0xbae63
movb $0x1, 0xd4(%rbp)
movl 0x158(%rbp), %ebx
jmp 0xba766
leaq 0x2a962(%rip), %rdi     # 0xe50a2
xorl %eax, %eax
callq 0xbae63
movl 0x8(%rbp), %r12d
movslq 0x158(%rbp), %rbx
movq %rbx, %rdx
shlq $0x2, %rdx
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x21720
movq 0x8(%rsp), %r13
leaq 0x7d10e(%rip), %rsi     # 0x137880
movaps 0xc527(%rip), %xmm5     # 0xc6ca0
movss 0xc66f(%rip), %xmm6     # 0xc6df0
movss 0xa87b(%rip), %xmm7     # 0xc5004
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
xorl %eax, %eax
cmpq %rax, %rbx
je 0xba851
movss 0x50(%rsp,%rax,4), %xmm0
movss 0x1a0(%rbp,%rax,4), %xmm1
movss 0x1e0(%rbp,%rax,4), %xmm2
ucomiss %xmm0, %xmm2
subss %xmm2, %xmm0
jbe 0xba806
subss 0x260(%rbp,%rax,4), %xmm2
divss %xmm2, %xmm0
movaps %xmm1, %xmm2
xorps %xmm5, %xmm2
ucomiss %xmm0, %xmm2
movaps %xmm6, %xmm2
ja 0xba843
movss 0x160(%rbp,%rax,4), %xmm3
movaps %xmm3, %xmm4
xorps %xmm5, %xmm4
xorps %xmm2, %xmm2
ucomiss %xmm4, %xmm0
ja 0xba843
addss %xmm3, %xmm0
subss %xmm3, %xmm1
divss %xmm1, %xmm0
movaps %xmm6, %xmm2
maxss %xmm0, %xmm2
jmp 0xba843
movss 0x220(%rbp,%rax,4), %xmm3
subss %xmm2, %xmm3
divss %xmm3, %xmm0
ucomiss %xmm1, %xmm0
movaps %xmm7, %xmm2
ja 0xba843
movss 0x160(%rbp,%rax,4), %xmm3
xorps %xmm2, %xmm2
ucomiss %xmm0, %xmm3
ja 0xba843
subss %xmm3, %xmm0
subss %xmm3, %xmm1
divss %xmm1, %xmm0
movaps %xmm7, %xmm2
minss %xmm0, %xmm2
movss %xmm2, 0x10(%rsp,%rax,4)
incq %rax
jmp 0xba795
movq (%rsi,%r15,8), %rax
cmpb $0x0, 0xd4(%rax)
jne 0xba8ca
cmpq $0x0, 0xd8(%r13)
je 0xba8ca
movq %r13, %rdi
callq 0xbde17
movss 0x10(%rsp), %xmm0
movss 0x2a69a(%rip), %xmm1    # 0xe4f18
mulss %xmm1, %xmm0
cvttss2si %xmm0, %esi
movss 0x14(%rsp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %edx
movss 0x18(%rsp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movl %r12d, %edi
callq *0xd8(%r13)
movss 0xa750(%rip), %xmm7     # 0xc5004
movss 0xc534(%rip), %xmm6     # 0xc6df0
movaps 0xc3dd(%rip), %xmm5     # 0xc6ca0
leaq 0x7cfb6(%rip), %rsi     # 0x137880
incq %r15
jmp 0xba639
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq