// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/alsa.cpp
// Function: ALSA::handle(EventHandler&)
void ALSA::handle(EventHandler &handler)
{
   if (!pcm)
      return;

   for (auto &fd : fds)
      fd.revents = 0;

   if (poll(fds.data(), fds.size(), 0) < 0)
      throw std::runtime_error("ALSA poll failed.");

   unsigned short revents;
   if (snd_pcm_poll_descriptors_revents(pcm, fds.data(),
            fds.size(), &revents) < 0)
      throw std::runtime_error("ALSA revents failed.\n");

   if (!(revents & POLLOUT))
      return;

   Audio::handle(handler);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x30(%rdi)
je 0x6399
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x40(%r14), %rsi
cmpq %rsi, %rdi
je 0x6354
movq %rsi, %rax
subq %rdi, %rax
addq $-0x8, %rax
movq %rax, %xmm0
shrq $0x3, %rax
addq $0x8, %rax
andq $-0x8, %rax
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x3, %xmm0
xorl %ecx, %ecx
movdqa 0x8f47(%rip), %xmm1     # 0xf010
movdqa 0x8f4f(%rip), %xmm2     # 0xf020
movdqa 0x8f57(%rip), %xmm3     # 0xf030
movdqa 0x8f5f(%rip), %xmm4     # 0xf040
movdqa 0x8f67(%rip), %xmm5     # 0xf050
pxor %xmm5, %xmm0
pcmpeqd %xmm6, %xmm6
movq %rcx, %xmm7
pshufd $0x44, %xmm7, %xmm7     # xmm7 = xmm7[0,1,0,1]
movdqa %xmm7, %xmm8
por %xmm4, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %edx
testb $0x1, %dl
je 0x6162
movw $0x0, 0x6(%rdi,%rcx,8)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %edx
shrl $0x10, %edx
testb $0x1, %dl
je 0x618f
movw $0x0, 0xe(%rdi,%rcx,8)
movdqa %xmm7, %xmm9
por %xmm3, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %edx
testb $0x1, %dl
je 0x61ef
movw $0x0, 0x16(%rdi,%rcx,8)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %edx
testb $0x1, %dl
je 0x6227
movw $0x0, 0x1e(%rdi,%rcx,8)
movdqa %xmm7, %xmm8
por %xmm2, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %edx
testb $0x1, %dl
je 0x628f
movw $0x0, 0x26(%rdi,%rcx,8)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %edx
testb $0x1, %dl
je 0x62ba
movw $0x0, 0x2e(%rdi,%rcx,8)
por %xmm1, %xmm7
pxor %xmm5, %xmm7
movdqa %xmm7, %xmm9
pcmpgtd %xmm0, %xmm9
pshufd $0xa0, %xmm9, %xmm8     # xmm8 = xmm9[0,0,2,2]
pcmpeqd %xmm0, %xmm7
pshufd $0xf5, %xmm7, %xmm7     # xmm7 = xmm7[1,1,3,3]
movdqa %xmm7, %xmm10
pand %xmm8, %xmm10
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
por %xmm9, %xmm10
packssdw %xmm10, %xmm10
pxor %xmm6, %xmm10
packssdw %xmm10, %xmm10
pextrw $0x6, %xmm10, %edx
testb $0x1, %dl
je 0x6311
movw $0x0, 0x36(%rdi,%rcx,8)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm7, %xmm7     # xmm7 = xmm7[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm7
pshufhw $0x84, %xmm9, %xmm8     # xmm8 = xmm9[0,1,2,3,4,5,4,6]
por %xmm7, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm7
pextrw $0x7, %xmm7, %edx
testb $0x1, %dl
je 0x6347
movw $0x0, 0x3e(%rdi,%rcx,8)
addq $0x8, %rcx
cmpq %rcx, %rax
jne 0x60f1
subq %rdi, %rsi
sarq $0x3, %rsi
xorl %edx, %edx
callq 0x53f0
testl %eax, %eax
js 0x63a1
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
movq 0x40(%r14), %rdx
subq %rsi, %rdx
shrq $0x3, %rdx
leaq 0x6(%rsp), %rcx
callq 0x5650
testl %eax, %eax
js 0x63bf
testb $0x4, 0x6(%rsp)
je 0x6399
movq %r14, %rdi
movq %rbx, %rsi
callq 0x683a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x8de2(%rip), %rsi      # 0xf197
movq %rax, %rdi
callq 0x50d0
jmp 0x63db
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x8dd6(%rip), %rsi      # 0xf1a9
movq %rax, %rdi
callq 0x50d0
movq 0xfbb6(%rip), %rsi      # 0x15f98
movq 0xfbf7(%rip), %rdx      # 0x15fe0
movq %rbx, %rdi
callq 0x51c0
jmp 0x63f3
movq %rax, %r14
movq %rbx, %rdi
callq 0x55f0
movq %r14, %rdi
callq 0x5200