// File: /workspace/github_c_makefile_star2_O2/yui0[P]img2vec/./potracelib.h
// Function: bm_to_pathlist
int bm_to_pathlist(const potrace_bitmap_t *bm, path_t **plistp, const potrace_param_t *param, progress_t *progress) {
  int x;
  int y;
  path_t *p;
  path_t *plist = NULL;  /* linked list of path objects */
  path_t **plist_hook = &plist;  /* used to speed up appending to linked list */
  potrace_bitmap_t *bm1 = NULL;
  int sign;
  bm1 = bm_dup(bm);
  if (!bm1) {
    goto error;
  }
  /* be sure the byte padding on the right is set to 0, as the fast
     pixel search below relies on it */
  bm_clearexcess(bm1);
  /* iterate through components */
  x = 0;
  y = bm1->h - 1;
  while (findnext(bm1, &x, &y) == 0) { 
    /* calculate the sign by looking at the original */
    sign = BM_GET(bm, x, y) ? '+' : '-';
    /* calculate the path */
    p = findpath(bm1, x, y+1, sign, param->turnpolicy);
    if (p==NULL) {
      goto error;
    }
    /* update buffered image */
    xor_path(bm1, p);
    /* if it's a turd, eliminate it, else append it to the list */
    if (p->area <= param->turdsize) {
      path_free(p);
    } else {
      list_insert_beforehook(p, plist_hook);
    }
    if (bm1->h > 0) { /* to be sure */
      progress_update(1-y/(double)bm1->h, progress);
    }
  }
  pathlist_to_tree(plist, bm1);
  bm_free(bm1);
  *plistp = plist;
  progress_update(1.0, progress);
  return 0;
 error:
  bm_free(bm1);
  list_forall_unlink(p, plist) {
    path_free(p);
  }
  return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x50(%rsp)
movq %rdx, %r15
andq $0x0, 0x28(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
movl (%rdi), %edi
movl 0x4(%r12), %esi
callq 0xb876
movq %rax, %r14
testq %rax, %rax
je 0xa7f2
movq %rbx, 0x78(%rsp)
xorl %ebx, %ebx
movslq 0x4(%r12), %rax
cmpq %rax, %rbx
jge 0xa7a4
movslq 0x8(%r14), %rdx
movq %rbx, %rdi
imulq %rdx, %rdi
shlq $0x3, %rdi
addq 0x10(%r14), %rdi
movslq 0x8(%r12), %rsi
imulq %rbx, %rsi
shlq $0x3, %rsi
addq 0x10(%r12), %rsi
shlq $0x3, %rdx
callq 0x1170
incq %rbx
jmp 0xa767
movl (%r14), %ecx
pushq $0x40
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %edx
shll $0x6, %edx
subl %edx, %ecx
je 0xa7f9
negb %cl
pushq $-0x1
popq %rdx
shlq %cl, %rdx
movl 0x4(%r14), %r13d
cltq
xorl %ecx, %ecx
testl %r13d, %r13d
movl $0x0, %esi
cmovgl %r13d, %esi
cmpq %rcx, %rsi
je 0xa7fd
movslq 0x8(%r14), %rdi
imulq %rcx, %rdi
shlq $0x3, %rdi
addq 0x10(%r14), %rdi
andq %rdx, (%rdi,%rax,8)
incq %rcx
jmp 0xa7d4
xorl %ebx, %ebx
jmp 0xaff5
movl 0x4(%r14), %r13d
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
decl %r13d
leaq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
xorl %ebp, %ebp
pushq $0x2
popq %r9
movq %r15, 0x80(%rsp)
movq %r12, 0x48(%rsp)
andl $-0x40, %ebp
testl %r13d, %r13d
js 0xaccd
movl (%r14), %edx
movl %r13d, %eax
movq %rbp, %rcx
shrq $0x6, %rcx
testl %ebp, %ebp
js 0xa86f
cmpl %ebp, %edx
jle 0xa86f
movslq 0x8(%r14), %rsi
imulq %rax, %rsi
shlq $0x3, %rsi
addq 0x10(%r14), %rsi
movl %ecx, %edi
andl $0x1ffffff, %edi        # imm = 0x1FFFFFF
incq %rcx
addl $0x40, %ebp
cmpq $0x0, (%rsi,%rdi,8)
je 0xa840
jmp 0xa876
decl %r13d
xorl %ebp, %ebp
jmp 0xa82a
addl $-0x40, %ebp
cmpl %edx, %ebp
jge 0xa896
cmpl 0x4(%r14), %r13d
jge 0xa896
movq %rbx, %rdi
movl %ebp, %ecx
shrq %cl, %rdi
movl %ebp, %ecx
shrl $0x6, %ecx
testq %rdi, (%rsi,%rcx,8)
jne 0xa89a
incl %ebp
jmp 0xa879
pushq $0x2d
popq %rdx
movl %edx, %esi
testl %ebp, %ebp
js 0xa8d6
movl %edx, %esi
cmpl (%r12), %ebp
jge 0xa8d6
movl %edx, %esi
cmpl 0x4(%r12), %r13d
jge 0xa8d6
movslq 0x8(%r12), %rdx
imulq %rax, %rdx
shlq $0x3, %rdx
addq 0x10(%r12), %rdx
xorl %eax, %eax
testq %rdi, (%rdx,%rcx,8)
sete %al
leal 0x2b(,%rax,2), %esi
movq %r13, 0x58(%rsp)
leal 0x1(%r13), %edi
movl 0x4(%r15), %edx
cmpl $0x3, %edx
sete %al
movl %esi, %ecx
xorl $0x2b, %ecx
orl %edx, %ecx
sete %r8b
movl %edx, 0x38(%rsp)
movl %edx, %ecx
xorl $0x1, %ecx
movl %esi, 0x34(%rsp)
movl %esi, %edx
xorl $0x2d, %edx
orl %ecx, %edx
sete %cl
orb %al, %r8b
orb %cl, %r8b
movb %r8b, 0x7(%rsp)
xorl %r10d, %r10d
pushq $0x8
popq %r11
xorl %edx, %edx
pushq $-0x1
popq %rax
xorl %ecx, %ecx
movq $0x0, 0x60(%rsp)
movl %edi, 0x3c(%rsp)
movl %edi, %r12d
movl %ebp, %r8d
xorl %ebx, %ebx
movq %rax, 0x20(%rsp)
movslq %ecx, %rax
cmpq %rax, %r10
jge 0xa94f
movl %ecx, 0x8(%rsp)
movq %rbx, %rax
jmp 0xa9ab
addl $0x64, %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0x11192(%rip), %xmm0    # 0x1baf0
cvttsd2si %xmm0, %eax
movl %eax, 0x8(%rsp)
movq %rbx, %r15
movq %rdx, %rbx
movslq %eax, %rsi
shlq $0x4, %rsi
movq %r15, %rdi
movq %r12, 0x18(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, %r13
movq %r8, %r12
callq 0x11b0
movq %rbx, %rdx
movq %r12, %r8
movq %r13, %r10
movq 0x10(%rsp), %r11
movq 0x18(%rsp), %r12
pushq $0x2
popq %r9
testq %rax, %rax
je 0xafe8
movq %rax, %rbx
movslq %r8d, %r8
movq %r8, -0x8(%rax,%r11)
movslq %r12d, %r12
movq %r12, (%rax,%r11)
addl %edx, %r8d
movq 0x20(%rsp), %r15
addl %r15d, %r12d
movl %r8d, %eax
imull %r15d, %eax
cltq
addq %rax, 0x60(%rsp)
cmpl %ebp, %r8d
jne 0xa9e6
cmpl 0x3c(%rsp), %r12d
je 0xac02
movq %rdx, %r13
leal (%rdx,%r15), %eax
decl %eax
cltd
idivl %r9d
movl %eax, %esi
movl %r8d, %ecx
addl %eax, %ecx
movb $0x1, %dil
js 0xaa47
cmpl (%r14), %ecx
jge 0xaa47
movl %r13d, %eax
notl %eax
addl %r15d, %eax
cltd
idivl %r9d
addl %r12d, %eax
js 0xaa47
cmpl 0x4(%r14), %eax
jge 0xaa47
movl %eax, %eax
movslq 0x8(%r14), %rdx
imulq %rax, %rdx
shlq $0x3, %rdx
addq 0x10(%r14), %rdx
movl %ecx, %eax
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
shrq %cl, %rdi
shrl $0x6, %eax
testq %rdi, (%rdx,%rax,8)
sete %dil
movl %r15d, %eax
notl %eax
addl %r13d, %eax
cltd
idivl %r9d
addl %r8d, %eax
js 0xaaa2
cmpl (%r14), %eax
jge 0xaaa2
addl %r12d, %esi
js 0xaaa2
cmpl 0x4(%r14), %esi
jge 0xaaa2
movl %esi, %ecx
movslq 0x8(%r14), %rdx
imulq %rcx, %rdx
shlq $0x3, %rdx
addq 0x10(%r14), %rdx
movl %eax, %esi
movq %r8, %r15
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
movl %eax, %ecx
shrq %cl, %r8
shrl $0x6, %esi
testq %r8, (%rdx,%rsi,8)
movq %r15, %r8
movq 0x20(%rsp), %r15
setne %al
jmp 0xaaa4
xorl %eax, %eax
movl %edi, %ecx
orb %al, %cl
testb $0x1, %cl
movq %r13, %rsi
je 0xaac9
testb %dil, %dil
movl 0x8(%rsp), %ecx
je 0xaad4
testb %al, %al
jne 0xab41
negl %r15d
movl %r15d, %eax
jmp 0xab46
cmpb $0x0, 0x7(%rsp)
movl 0x8(%rsp), %ecx
je 0xaadb
negl %esi
jmp 0xabf1
movl 0x38(%rsp), %eax
cmpl $0x4, %eax
je 0xab9f
cmpl $0x5, %eax
je 0xab4e
cmpl $0x6, %eax
jne 0xabee
imull $0x4b3e375, %r8d, %eax  # imm = 0x4B3E375
xorl %r12d, %eax
imull $0x5a8ef93, %eax, %eax  # imm = 0x5A8EF93
movl %eax, %ecx
movl $0xff, %esi
andl %esi, %ecx
movl %eax, %edx
shrl $0x8, %edx
andl %esi, %edx
leaq 0x10e43(%rip), %rdi     # 0x1b960
movb (%rdx,%rdi), %dl
xorb (%rcx,%rdi), %dl
movl %eax, %ecx
shrl $0x10, %ecx
andl %esi, %ecx
movq %r13, %rsi
xorb (%rcx,%rdi), %dl
movl 0x8(%rsp), %ecx
shrl $0x18, %eax
cmpb (%rax,%rdi), %dl
jne 0xaad4
jmp 0xabee
movl %esi, %eax
movl %r15d, %esi
movl %eax, %r15d
jmp 0xabf1
movq %r14, %rdi
movl %r8d, %esi
movl %r12d, %edx
movq %r12, 0x18(%rsp)
movq %r11, 0x10(%rsp)
movq %rbx, %r15
movq %r10, %rbx
movq %r8, %r12
callq 0x18a99
movq %r13, %rsi
movl 0x8(%rsp), %ecx
movq %r12, %r8
movq %r15, %rdx
movq 0x20(%rsp), %r15
movq %rbx, %r10
movq %rdx, %rbx
movq 0x10(%rsp), %r11
movq 0x18(%rsp), %r12
pushq $0x2
popq %r9
testl %eax, %eax
jne 0xaad4
jmp 0xabee
movq %r14, %rdi
movl %r8d, %esi
movl %r12d, %edx
movq %r12, 0x18(%rsp)
movq %r11, 0x10(%rsp)
movq %rbx, %r15
movq %r10, %rbx
movq %r8, %r12
callq 0x18a99
movq %r13, %rsi
movl 0x8(%rsp), %ecx
movq %r12, %r8
movq %r15, %rdx
movq 0x20(%rsp), %r15
movq %rbx, %r10
movq %rdx, %rbx
movq 0x10(%rsp), %r11
movq 0x18(%rsp), %r12
pushq $0x2
popq %r9
testl %eax, %eax
je 0xaad4
negl %r15d
movl %esi, %eax
addq $0x10, %r11
incq %r10
movl %r15d, %edx
jmp 0xa939
movq %rbx, %r12
movq %r10, %r15
callq 0x75c9
testq %rax, %rax
je 0xafe5
movq %rax, %rbx
incl %r15d
movq 0x38(%rax), %rax
movq %r12, 0x8(%rax)
movl %r15d, (%rax)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x60(%rsp), %rcx
cmpq %rax, %rcx
cmovaeq %rax, %rcx
movl %ecx, (%rbx)
movl 0x34(%rsp), %eax
movl %eax, 0x4(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb01b
movl (%rbx), %eax
movq 0x80(%rsp), %r15
cmpl (%r15), %eax
jle 0xac75
movq 0x40(%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x20(%rbx)
movq %rbx, (%rcx)
addq $0x20, %rbx
movq %rbx, 0x40(%rsp)
jmp 0xac7d
movq %rbx, %rdi
callq 0x7604
movq 0x48(%rsp), %r12
movq 0x58(%rsp), %r13
pushq $0x2
popq %r9
movl 0x4(%r14), %eax
testl %eax, %eax
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
jle 0xa827
cvtsi2sd %r13d, %xmm1
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd 0x10df2(%rip), %xmm0    # 0x1baa8
subsd %xmm1, %xmm0
movq 0x50(%rsp), %rdi
callq 0xa6bb
pushq $0x2
popq %r9
jmp 0xa827
movq 0x28(%rsp), %r15
movq %r15, 0x70(%rsp)
movl 0x4(%r14), %esi
movl 0x8(%r14), %edi
callq 0x18d32
movq %rax, %rbx
movq %r14, %rdi
callq 0x18d0b
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x10e0
movq %r15, 0x10(%rsp)
movq %r15, %rax
testq %rax, %rax
je 0xad1b
movq 0x20(%rax), %rcx
movq %rcx, 0x30(%rax)
andq $0x0, 0x28(%rax)
movq %rcx, %rax
jmp 0xad04
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0xaf01
leaq 0x28(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x20(%rbx), %rax
movq %rax, 0x8(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb01b
movq 0x38(%rbx), %rax
movl (%rax), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
shlq $0x4, %rcx
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r8d, %r8d
xorl %esi, %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq %rdx, %rcx
je 0xadd1
movq 0x8(%rax), %r15
movl (%r15,%rdx), %r13d
cmpl %r13d, %ebp
cmovgl %r13d, %edi
cmovgel %r13d, %ebp
cmpl %r13d, %ebx
cmovll %r13d, %esi
movl 0x8(%r15,%rdx), %r15d
cmovlel %r13d, %ebx
cmpl %r15d, %r11d
cmovgl %r15d, %r9d
cmovgel %r15d, %r11d
cmpl %r15d, %r10d
cmovll %r15d, %r8d
cmovlel %r15d, %r10d
addq $0x10, %rdx
jmp 0xad8d
movslq %r9d, %r9
movq 0x20(%rsp), %r11
movq 0x8(%rsp), %r10
testq %r12, %r12
je 0xae79
movq 0x20(%r12), %rbx
movq 0x38(%r12), %rax
andq $0x0, 0x20(%r12)
movq 0x8(%rax), %rax
movq 0x8(%rax), %r15
cmpq %r9, %r15
jle 0xae71
leaq 0x20(%r12), %rbp
movq (%rax), %rax
testl %eax, %eax
js 0xae58
cmpl %eax, (%r14)
jle 0xae58
decq %r15
testl %r15d, %r15d
js 0xae58
cmpl %r15d, 0x4(%r14)
jle 0xae58
movslq 0x8(%r14), %rcx
imulq %rcx, %r15
shlq $0x3, %r15
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
movl %eax, %ecx
shrq %cl, %r13
addq 0x10(%r14), %r15
cqto
pushq $0x40
popq %rcx
idivq %rcx
testq %r13, (%r15,%rax,8)
je 0xae58
movq %r11, %rax
movq %rbp, %r11
jmp 0xae5e
movq %r10, %rax
movq %rbp, %r10
movq (%rax), %rcx
movq %rcx, 0x20(%r12)
movq %r12, (%rax)
movq %rbx, %r12
jmp 0xadde
movq %r12, (%r10)
movq %rbx, 0x20(%r12)
movl %edi, %eax
cltd
pushq $0x40
popq %rdi
idivl %edi
movl %eax, %ecx
addl $0x3f, %esi
movl %esi, %eax
cltd
idivl %edi
movslq %ecx, %rcx
cltq
movslq %r8d, %rdx
leaq (,%r9,8), %rsi
cmpq %rdx, %r9
jge 0xaec7
movq %rcx, %rdi
cmpq %rax, %rdi
jge 0xaebe
movslq 0x8(%r14), %r8
imulq %rsi, %r8
addq 0x10(%r14), %r8
andq $0x0, (%r8,%rdi,8)
incq %rdi
jmp 0xaea3
incq %r9
addq $0x8, %rsi
jmp 0xae9b
movq 0x8(%rsp), %rax
movq (%rax), %rbx
testq %rbx, %rbx
je 0xaedf
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rbx)
jmp 0xaee4
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %rcx
movq (%rcx), %rax
testq %rax, %rax
je 0xad20
movq %rbx, 0x28(%rax)
movq (%rcx), %rbx
jmp 0xad20
movq 0x70(%rsp), %rax
movq %rax, %rcx
movq 0x78(%rsp), %rbx
testq %rcx, %rcx
je 0xaf24
movq 0x20(%rcx), %rdx
movq 0x30(%rcx), %rsi
movq %rdx, 0x30(%rcx)
movq %rsi, %rcx
jmp 0xaf0e
testq %rax, %rax
je 0xaf2e
andq $0x0, 0x20(%rax)
leaq 0x70(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x68(%rsp), %rcx
testq %rax, %rax
je 0xafad
movq 0x20(%rax), %rsi
movq %rsi, 0x68(%rsp)
testq %rax, %rax
je 0xafa6
movq (%rdx), %rsi
movq %rsi, 0x20(%rax)
movq %rax, (%rdx)
leaq 0x20(%rax), %rdx
leaq 0x28(%rax), %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
je 0xafa0
movq (%rdx), %rdi
movq %rdi, 0x20(%rsi)
movq %rsi, (%rdx)
movq 0x28(%rsi), %rdx
testq %rdx, %rdx
je 0xaf96
movq %rcx, %r8
movq %r8, %rdi
movq (%r8), %r9
leaq 0x20(%r9), %r8
testq %r9, %r9
jne 0xaf7f
andq $0x0, 0x20(%rdx)
movq %rdx, (%rdi)
leaq 0x20(%rsi), %rdx
addq $0x30, %rsi
jmp 0xaf61
movq 0x30(%rax), %rax
jmp 0xaf4a
movq 0x68(%rsp), %rax
jmp 0xaf3c
movq %r14, %rdi
callq 0xb115
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
movsd 0x10ae3(%rip), %xmm0    # 0x1baa8
movq 0x50(%rsp), %rdi
callq 0xa6bb
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %r15
movq %r15, %rdi
callq 0x1030
movq 0x28(%rsp), %rbx
movq %r14, %rdi
callq 0xb115
pushq $-0x1
popq %rbp
testq %rbx, %rbx
je 0xafd1
movq 0x20(%rbx), %r14
andq $0x0, 0x20(%rbx)
movq %rbx, %rdi
callq 0x7604
movq %r14, %rbx
jmp 0xb000