// File: /workspace/github_c_makefile_star2_O1/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
addl $0xf, %eax
movq %r8, %r14
decq %r14
movq %r14, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, -0x10(%rsp)
orb %r11b, %sil
shrl $0x4, %eax
shlq $0x7, %rax
leaq (%rax,%rax,2), %r11
movdqa 0x4120(%rip), %xmm9     # 0xa230
pcmpeqd %xmm10, %xmm10
movq %rbx, %rax
cmpq %r9, %rbx
jb 0x666a
testl %r8d, %r8d
jle 0x6630
xorl %eax, %eax
movdqa 0x40eb(%rip), %xmm12    # 0xa220
movdqa 0x40d2(%rip), %xmm13    # 0xa210
movdqa 0x40b9(%rip), %xmm14    # 0xa200
movdqa 0x40a0(%rip), %xmm15    # 0xa1f0
movdqa 0x4898(%rip), %xmm4     # 0xa9f0
movdqa 0x4880(%rip), %xmm3     # 0xa9e0
movdqa 0x4868(%rip), %xmm2     # 0xa9d0
movdqa 0x4850(%rip), %xmm1     # 0xa9c0
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 0x61d6
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 0x6201
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 0x6259
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 0x628f
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 0x62f0
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 0x631f
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 0x6378
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 0x63b2
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 0x6416
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 0x6445
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 0x649d
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 0x64d7
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 0x653a
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 0x6569
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 0x65bc
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 0x65f5
movb $0x0, 0x17c(%rcx,%rax)
movdqa 0x4403(%rip), %xmm0     # 0xaa00
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 0x6170
testb %sil, %sil
jne 0x6663
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 0x665c
movb $0x1, 0x14(%rbx)
movq 0x8(%rbx), %rbx
jmp 0x664d
incl %eax
cmpl %r10d, %eax
jne 0x6637
movq %rcx, 0x8(%rdx)
movq %rcx, %rax
leaq 0x18(%rax), %rbx
cmpb $0x0, 0x14(%rax)
movq %rbx, 0x8(%rdx)
jne 0x6115
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)