// File: /workspace/github_c_makefile_star2_O3/imaya[P]zopfli-for-emscripten/katajainen.c
// Function: GetFreeNode
static Node* GetFreeNode(Node* (*lists)[2], int maxbits, NodePool* pool) {
  for (;;) {
    if (pool->next >= &pool->nodes[pool->size]) {
      /* Garbage collection. */
      int i;
      for (i = 0; i < pool->size; i++) {
        pool->nodes[i].inuse = 0;
      }
      if (lists) {
        for (i = 0; i < maxbits * 2; i++) {
          Node* node;
          for (node = lists[i / 2][i % 2]; node; node = node->tail) {
            node->inuse = 1;
          }
        }
      }
      pool->next = &pool->nodes[0];
    }
    if (!pool->next->inuse) break;  /* Found one. */
    pool->next++;
  }
  return pool->next++;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq (%rdx), %rcx
movq 0x8(%rdx), %rbx
movl 0x10(%rdx), %r8d
movslq %r8d, %rax
leaq (%rax,%rax,2), %r9
leaq (%rcx,%r9,8), %r9
testq %rdi, %rdi
sete %r11b
leal (%rsi,%rsi), %ebp
testl %esi, %esi
setle %sil
cmpl $0x2, %ebp
movl $0x1, %r10d
cmovgel %ebp, %r10d
orb %r11b, %sil
addl $0xf, %eax
movq %r8, %r11
decq %r11
movq %r11, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, -0x10(%rsp)
shrl $0x4, %eax
shlq $0x7, %rax
leaq (%rax,%rax,2), %r11
movdqa 0x3f7e(%rip), %xmm9     # 0xa230
pcmpeqd %xmm10, %xmm10
movq %rbx, %rax
cmpq %r9, %rbx
jb 0x680b
testl %r8d, %r8d
jle 0x67d2
xorl %eax, %eax
movdqa 0x3f49(%rip), %xmm12    # 0xa220
movdqa 0x3f30(%rip), %xmm13    # 0xa210
movdqa 0x3f17(%rip), %xmm14    # 0xa200
movdqa 0x3efe(%rip), %xmm15    # 0xa1f0
movdqa 0x46e6(%rip), %xmm4     # 0xa9e0
movdqa 0x46ce(%rip), %xmm3     # 0xa9d0
movdqa 0x46b6(%rip), %xmm2     # 0xa9c0
movdqa 0x469e(%rip), %xmm1     # 0xa9b0
movdqa -0x10(%rsp), %xmm0
pxor %xmm9, %xmm0
movdqa %xmm12, %xmm6
pxor %xmm9, %xmm6
movdqa %xmm6, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm7     # xmm7 = xmm8[0,0,2,2]
pshuflw $0xe8, %xmm7, %xmm5     # xmm5 = xmm7[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
pshuflw $0xe8, %xmm6, %xmm11    # xmm11 = xmm6[0,2,2,3,4,5,6,7]
pand %xmm5, %xmm11
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm5     # xmm5 = xmm8[0,2,2,3,4,5,6,7]
por %xmm11, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
movd %xmm5, %ebx
testb $0x1, %bl
je 0x6378
movb $0x0, 0x14(%rcx,%rax)
pand %xmm7, %xmm6
por %xmm8, %xmm6
packssdw %xmm6, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
packsswb %xmm6, %xmm6
movd %xmm6, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x63a3
movb $0x0, 0x2c(%rcx,%rax)
movdqa %xmm13, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm6     # xmm6 = xmm8[0,0,2,2]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
movdqa %xmm7, %xmm5
pand %xmm6, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
por %xmm8, %xmm5
packssdw %xmm5, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
movd %xmm5, %ebx
shrl $0x10, %ebx
testb $0x1, %bl
je 0x63fb
movb $0x0, 0x44(%rcx,%rax)
pshufhw $0x84, %xmm6, %xmm5     # xmm5 = xmm6[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm7, %xmm6     # xmm6 = xmm7[0,1,2,3,4,5,4,6]
pand %xmm5, %xmm6
pshufhw $0x84, %xmm8, %xmm5     # xmm5 = xmm8[0,1,2,3,4,5,4,6]
por %xmm6, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
movd %xmm5, %ebx
shrl $0x18, %ebx
testb $0x1, %bl
je 0x6431
movb $0x0, 0x5c(%rcx,%rax)
movdqa %xmm14, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm7     # xmm7 = xmm8[0,0,2,2]
pshuflw $0xe8, %xmm7, %xmm11    # xmm11 = xmm7[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm6     # xmm6 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm6, %xmm5     # xmm5 = xmm6[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm11    # xmm11 = xmm8[0,2,2,3,4,5,6,7]
por %xmm5, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x2, %xmm5, %ebx
testb $0x1, %bl
je 0x6492
movb $0x0, 0x74(%rcx,%rax)
pand %xmm7, %xmm6
por %xmm8, %xmm6
packssdw %xmm6, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x2, %xmm5, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x64c1
movb $0x0, 0x8c(%rcx,%rax)
movdqa %xmm15, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm6     # xmm6 = xmm8[0,0,2,2]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
movdqa %xmm7, %xmm5
pand %xmm6, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
por %xmm8, %xmm5
packssdw %xmm5, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x3, %xmm5, %ebx
testb $0x1, %bl
je 0x651a
movb $0x0, 0xa4(%rcx,%rax)
pshufhw $0x84, %xmm6, %xmm5     # xmm5 = xmm6[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm7, %xmm6     # xmm6 = xmm7[0,1,2,3,4,5,4,6]
pand %xmm5, %xmm6
pshufhw $0x84, %xmm8, %xmm5     # xmm5 = xmm8[0,1,2,3,4,5,4,6]
por %xmm6, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x3, %xmm5, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x6554
movb $0x0, 0xbc(%rcx,%rax)
movdqa %xmm4, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm7     # xmm7 = xmm8[0,0,2,2]
pshuflw $0xe8, %xmm7, %xmm11    # xmm11 = xmm7[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm6     # xmm6 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm6, %xmm5     # xmm5 = xmm6[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm11    # xmm11 = xmm8[0,2,2,3,4,5,6,7]
por %xmm5, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm11
packsswb %xmm11, %xmm5
pextrw $0x4, %xmm5, %ebx
testb $0x1, %bl
je 0x65b8
movb $0x0, 0xd4(%rcx,%rax)
pand %xmm7, %xmm6
por %xmm8, %xmm6
packssdw %xmm6, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
packsswb %xmm6, %xmm5
pextrw $0x4, %xmm5, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x65e7
movb $0x0, 0xec(%rcx,%rax)
movdqa %xmm3, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm6     # xmm6 = xmm8[0,0,2,2]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
movdqa %xmm7, %xmm5
pand %xmm6, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
por %xmm8, %xmm5
packssdw %xmm5, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x5, %xmm5, %ebx
testb $0x1, %bl
je 0x663f
movb $0x0, 0x104(%rcx,%rax)
pshufhw $0x84, %xmm6, %xmm5     # xmm5 = xmm6[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm7, %xmm6     # xmm6 = xmm7[0,1,2,3,4,5,4,6]
pand %xmm5, %xmm6
pshufhw $0x84, %xmm8, %xmm5     # xmm5 = xmm8[0,1,2,3,4,5,4,6]
por %xmm6, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x5, %xmm5, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x6679
movb $0x0, 0x11c(%rcx,%rax)
movdqa %xmm2, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm8
pcmpgtd %xmm0, %xmm8
pshufd $0xa0, %xmm8, %xmm7     # xmm7 = xmm8[0,0,2,2]
pshuflw $0xe8, %xmm7, %xmm11    # xmm11 = xmm7[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm6     # xmm6 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm6, %xmm5     # xmm5 = xmm6[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm5
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm11    # xmm11 = xmm8[0,2,2,3,4,5,6,7]
por %xmm5, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x6, %xmm5, %ebx
testb $0x1, %bl
je 0x66dc
movb $0x0, 0x134(%rcx,%rax)
pand %xmm7, %xmm6
por %xmm8, %xmm6
packssdw %xmm6, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x6, %xmm5, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x670b
movb $0x0, 0x14c(%rcx,%rax)
movdqa %xmm1, %xmm5
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm7
pcmpgtd %xmm0, %xmm7
pshufd $0xa0, %xmm7, %xmm6     # xmm6 = xmm7[0,0,2,2]
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm0     # xmm0 = xmm5[1,1,3,3]
movdqa %xmm0, %xmm5
pand %xmm6, %xmm5
pshufd $0xf5, %xmm7, %xmm7     # xmm7 = xmm7[1,1,3,3]
por %xmm7, %xmm5
packssdw %xmm5, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
packsswb %xmm5, %xmm5
pextrw $0x7, %xmm5, %ebx
testb $0x1, %bl
je 0x675e
movb $0x0, 0x164(%rcx,%rax)
pshufhw $0x84, %xmm6, %xmm5     # xmm5 = xmm6[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,5,4,6]
pand %xmm5, %xmm0
pshufhw $0x84, %xmm7, %xmm5     # xmm5 = xmm7[0,1,2,3,4,5,4,6]
por %xmm0, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x7, %xmm0, %ebx
shrl $0x8, %ebx
testb $0x1, %bl
je 0x6797
movb $0x0, 0x17c(%rcx,%rax)
movdqa 0x4251(%rip), %xmm0     # 0xa9f0
paddq %xmm0, %xmm12
paddq %xmm0, %xmm13
paddq %xmm0, %xmm14
paddq %xmm0, %xmm15
paddq %xmm0, %xmm4
paddq %xmm0, %xmm3
paddq %xmm0, %xmm2
paddq %xmm0, %xmm1
addq $0x180, %rax            # imm = 0x180
cmpq %rax, %r11
jne 0x6312
movq %rcx, %rax
testb %sil, %sil
jne 0x680b
xorl %eax, %eax
movl %eax, %ebx
shrl %ebx
movl %eax, %r14d
andl $0x1, %r14d
shlq $0x4, %rbx
addq %rdi, %rbx
movq (%rbx,%r14,8), %rbx
testq %rbx, %rbx
je 0x6801
movb $0x1, 0x14(%rbx)
movq 0x8(%rbx), %rbx
jmp 0x67f2
incl %eax
cmpl %r10d, %eax
jne 0x67dc
movq %rcx, %rax
leaq 0x18(%rax), %rbx
cmpb $0x0, 0x14(%rax)
movq %rbx, 0x8(%rdx)
jne 0x62b7
popq %rbx
popq %r14
popq %rbp
retq
nop