// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: bpmnode_create
static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMNode* tail)
{
  unsigned i;
  BPMNode* result;

  /*memory full, so garbage collect*/
  if(lists->nextfree >= lists->numfree)
  {
    /*mark only those that are in use*/
    for(i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0;
    for(i = 0; i != lists->listsize; ++i)
    {
      BPMNode* node;
      for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1;
      for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1;
    }
    /*collect those that are free*/
    lists->numfree = 0;
    for(i = 0; i != lists->memsize; ++i)
    {
      if(!lists->memory[i].in_use) lists->freelist[lists->numfree++] = &lists->memory[i];
    }
    lists->nextfree = 0;
  }

  result = lists->freelist[lists->nextfree++];
  result->weight = weight;
  result->index = index;
  result->tail = tail;
  return result;
}

// Assembly:
pushq %rbx
movl 0x14(%rdi), %eax
cmpl 0x10(%rdi), %eax
jb 0x1995
movl (%rdi), %eax
testq %rax, %rax
je 0x1907
movq 0x8(%rdi), %r8
leaq -0x1(%rax), %r9
movq %r9, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq 0x18(,%rax,8), %r9
andq $-0x20, %r9
leaq (%r9,%r9,2), %r9
movdqa 0xc821(%rip), %xmm1     # 0xe040
movdqa 0xc7e9(%rip), %xmm2     # 0xe010
xorl %r10d, %r10d
movdqa 0xc81e(%rip), %xmm3     # 0xe050
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0xc81e(%rip), %xmm5     # 0xe060
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %r11d
notl %r11d
testb $0x1, %r11b
je 0x1882
movl $0x0, 0x10(%r8,%r10)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %r11d
testb $0x1, %r11b
je 0x189b
movl $0x0, 0x28(%r8,%r10)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %r11d
testb $0x1, %r11b
je 0x18dd
movl $0x0, 0x40(%r8,%r10)
pextrw $0x4, %xmm6, %r11d
testb $0x1, %r11b
je 0x18f2
movl $0x0, 0x58(%r8,%r10)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x60, %r10
cmpq %r10, %r9
jne 0x1842
movl 0x20(%rdi), %r8d
testq %r8, %r8
je 0x194f
movq 0x28(%rdi), %r9
movq 0x30(%rdi), %r10
xorl %r11d, %r11d
movq (%r9,%r11,8), %rbx
testq %rbx, %rbx
je 0x1931
movl $0x1, 0x10(%rbx)
movq 0x8(%rbx), %rbx
jmp 0x191f
movq (%r10,%r11,8), %rbx
testq %rbx, %rbx
je 0x1947
movl $0x1, 0x10(%rbx)
movq 0x8(%rbx), %rbx
jmp 0x1935
incq %r11
cmpq %r8, %r11
jne 0x191b
movl $0x0, 0x10(%rdi)
testq %rax, %rax
je 0x1993
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
xorl %r8d, %r8d
xorl %r9d, %r9d
movq 0x8(%rdi), %r10
cmpl $0x0, 0x10(%r10,%r8)
jne 0x198a
addq %r8, %r10
movq 0x18(%rdi), %r11
movl %r9d, %ebx
incl %r9d
movl %r9d, 0x10(%rdi)
movq %r10, (%r11,%rbx,8)
addq $0x18, %r8
cmpq %r8, %rax
jne 0x1969
xorl %eax, %eax
movq 0x18(%rdi), %r8
leal 0x1(%rax), %r9d
movl %r9d, 0x14(%rdi)
movl %eax, %eax
movq (%r8,%rax,8), %rax
movl %esi, (%rax)
movl %edx, 0x4(%rax)
movq %rcx, 0x8(%rax)
popq %rbx
retq