// File: /workspace/github_cpp_makefile_star2_O1/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 0xd1827
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
cmpq $0x0, 0xd8(%rdi)
je 0xd1816
leaq 0x77439(%rip), %r13     # 0x148860
movdqa 0xc8c1(%rip), %xmm6     # 0xddcf0
pcmpeqd %xmm7, %xmm7
movdqa 0x109b4(%rip), %xmm8    # 0xe1df0
movss 0xc9fb(%rip), %xmm9     # 0xdde40
movss 0xabb6(%rip), %xmm10    # 0xdc004
xorl %r14d, %r14d
movq (%r13,%r14,8), %rbp
testq %rbp, %rbp
je 0xd17d7
movb 0xd4(%rbp), %r12b
testb %r12b, %r12b
je 0xd14ae
movslq 0x158(%rbp), %rdx
testq %rdx, %rdx
jle 0xd14ae
shlq $0x2, %rdx
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0x21490
movss 0xab74(%rip), %xmm10    # 0xdc004
movss 0xc9a7(%rip), %xmm9     # 0xdde40
movdqa 0x1094e(%rip), %xmm8    # 0xe1df0
pcmpeqd %xmm7, %xmm7
movdqa 0xc842(%rip), %xmm6     # 0xddcf0
movslq 0x158(%rbp), %rcx
testq %rcx, %rcx
jle 0xd159e
leal 0x3(%rcx), %eax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
pxor %xmm6, %xmm0
xorl %ecx, %ecx
movdqa 0xcb5d(%rip), %xmm1     # 0xde040
movdqa 0x102d5(%rip), %xmm2    # 0xe17c0
movdqa %xmm1, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
pcmpeqd %xmm0, %xmm3
pshufd $0xf5, %xmm3, %xmm5     # xmm5 = xmm3[1,1,3,3]
pand %xmm4, %xmm5
pshufd $0xf5, %xmm4, %xmm3     # xmm3 = xmm4[1,1,3,3]
por %xmm5, %xmm3
movd %xmm3, %edx
notl %edx
testb $0x1, %dl
je 0xd1523
movl $0x44bb8000, (%rsp,%rcx) # imm = 0x44BB8000
pxor %xmm7, %xmm3
pextrw $0x4, %xmm3, %edx
testb $0x1, %dl
je 0xd1539
movl $0x44bb8000, 0x4(%rsp,%rcx) # imm = 0x44BB8000
movdqa %xmm2, %xmm3
pxor %xmm6, %xmm3
movdqa %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
pcmpeqd %xmm0, %xmm3
pshufd $0xf5, %xmm3, %xmm5     # xmm5 = xmm3[1,1,3,3]
pand %xmm4, %xmm5
pshufd $0xf5, %xmm4, %xmm3     # xmm3 = xmm4[1,1,3,3]
por %xmm5, %xmm3
pxor %xmm7, %xmm3
pextrw $0x0, %xmm3, %edx
testb $0x1, %dl
je 0xd1575
movl $0x44bb8000, 0x8(%rsp,%rcx) # imm = 0x44BB8000
pextrw $0x4, %xmm3, %edx
testb $0x1, %dl
je 0xd1587
movl $0x44bb8000, 0xc(%rsp,%rcx) # imm = 0x44BB8000
paddq %xmm8, %xmm1
paddq %xmm8, %xmm2
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0xd14eb
xorl %r15d, %r15d
testb %r12b, %r12b
jne 0xd168a
movl 0xcc(%rbp), %edi
movl $0x8, %edx
movq %rbp, %rsi
callq 0x21dd0
xorl %r15d, %r15d
cmpl $0x8, %eax
jne 0xd164a
leaq 0xc(%rbp), %r12
movzbl 0x6(%rbp), %eax
andl $0x7f, %eax
cmpl $0x2, %eax
je 0xd15f8
cmpl $0x1, %eax
jne 0xd17e9
movb 0x7(%rbp), %cl
movl $0x1, %eax
shll %cl, %eax
cmpw $0x0, 0x4(%rbp)
je 0xd1629
orl %eax, 0x8(%rbp)
jmp 0xd162e
movzbl 0x7(%rbp), %eax
movslq 0x158(%rbp), %rdx
cmpl %eax, %edx
jle 0xd162e
movswl 0x4(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0xc(%rbp,%rax,4)
shlq $0x2, %rdx
movq %rsp, %rdi
movq %r12, %rsi
callq 0x21720
jmp 0xd162e
notl %eax
andl %eax, 0x8(%rbp)
movl 0x8(%rbp), %r15d
movl 0xcc(%rbp), %edi
movl $0x8, %edx
movq %rbp, %rsi
callq 0x21dd0
cmpl $0x8, %eax
je 0xd15cd
leaq 0x4c(%rbp), %rsi
leaq 0x2a906(%rip), %rdi     # 0xfbf5b
xorl %eax, %eax
callq 0x22aab
movb $0x1, 0xd4(%rbp)
movdqa 0xc685(%rip), %xmm6     # 0xddcf0
pcmpeqd %xmm7, %xmm7
movdqa 0x10778(%rip), %xmm8    # 0xe1df0
movss 0xc7bf(%rip), %xmm9     # 0xdde40
movss 0xa97a(%rip), %xmm10    # 0xdc004
movslq 0x158(%rbp), %rax
testq %rax, %rax
jle 0xd1756
xorl %ecx, %ecx
movss (%rsp,%rcx,4), %xmm0
movss 0x1a0(%rbp,%rcx,4), %xmm1
movss 0x1e0(%rbp,%rcx,4), %xmm2
ucomiss %xmm0, %xmm2
subss %xmm2, %xmm0
jbe 0xd1705
subss 0x260(%rbp,%rcx,4), %xmm2
divss %xmm2, %xmm0
movaps %xmm1, %xmm2
xorps %xmm6, %xmm2
ucomiss %xmm0, %xmm2
movaps %xmm9, %xmm2
ja 0xd1744
movss 0x160(%rbp,%rcx,4), %xmm3
movaps %xmm3, %xmm4
xorps %xmm6, %xmm4
xorps %xmm2, %xmm2
ucomiss %xmm4, %xmm0
ja 0xd1744
addss %xmm3, %xmm0
subss %xmm3, %xmm1
divss %xmm1, %xmm0
movaps %xmm9, %xmm2
maxss %xmm0, %xmm2
jmp 0xd1744
movss 0x220(%rbp,%rcx,4), %xmm3
subss %xmm2, %xmm3
divss %xmm3, %xmm0
ucomiss %xmm1, %xmm0
movaps %xmm10, %xmm2
ja 0xd1744
movss 0x160(%rbp,%rcx,4), %xmm3
xorps %xmm2, %xmm2
ucomiss %xmm0, %xmm3
ja 0xd1744
subss %xmm3, %xmm0
subss %xmm3, %xmm1
divss %xmm1, %xmm0
movaps %xmm10, %xmm2
minss %xmm0, %xmm2
movss %xmm2, 0x40(%rsp,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0xd169c
movq (%r13,%r14,8), %rax
cmpb $0x0, 0xd4(%rax)
jne 0xd17d7
cmpq $0x0, 0xd8(%rbx)
je 0xd17d7
movq %rbx, %rdi
callq 0xd5037
movss 0x40(%rsp), %xmm0
movss 0x2aacc(%rip), %xmm1    # 0xfc250
mulss %xmm1, %xmm0
cvttss2si %xmm0, %esi
movss 0x44(%rsp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %edx
movss 0x48(%rsp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movl %r15d, %edi
callq *0xd8(%rbx)
movss 0xa84a(%rip), %xmm10    # 0xdc004
movss 0xc67d(%rip), %xmm9     # 0xdde40
movdqa 0x10624(%rip), %xmm8    # 0xe1df0
pcmpeqd %xmm7, %xmm7
movaps 0xc519(%rip), %xmm6     # 0xddcf0
leaq 0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
je 0xd1451
jmp 0xd1816
leaq 0x2abea(%rip), %rdi     # 0xfc3da
xorl %eax, %eax
callq 0x22aab
movl 0x8(%rbp), %r15d
movslq 0x158(%rbp), %rdx
shlq $0x2, %rdx
movq %rsp, %rdi
movq %r12, %rsi
callq 0x21720
jmp 0xd1663
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq