// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0xc150
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xbf09
jmp 0xc0d9
movq -0x50(%rbp), %rdi
callq 0xc210
movl $0x0, -0x2c(%rbp)
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xc2d0
cmpl $0x0, %eax
jne 0xc09e
cmpl $0x0, -0x2c(%rbp)
jl 0xbfce
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xbfce
cmpl $0x0, -0x30(%rbp)
jl 0xbfce
movl -0x30(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xbfce
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movl -0x2c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl -0x2c(%rbp), %ecx
andl $0x3f, %ecx
movl %ecx, %ecx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
shrq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x58(%rbp)
jmp 0xbfd5
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0xbfd5
movl -0x58(%rbp), %edx
movl $0x2d, %eax
movl $0x2b, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
addl $0x1, %edx
movl -0x54(%rbp), %ecx
movq -0x20(%rbp), %rax
movl 0x4(%rax), %r8d
callq 0xc470
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xc018
jmp 0xc0d9
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xca40
movq -0x38(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jg 0xc03e
movq -0x38(%rbp), %rdi
callq 0x86a0
jmp 0xc068
jmp 0xc040
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x48(%rbp)
jmp 0xc068
movq -0x50(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jle 0xc099
cvtsi2sdl -0x30(%rbp), %xmm1
movq -0x50(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm0
divsd %xmm0, %xmm1
movsd 0x25f8c(%rip), %xmm0    # 0x32018
subsd %xmm1, %xmm0
movq -0x28(%rbp), %rdi
callq 0xbdd0
jmp 0xbf26
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0xcb60
movq -0x50(%rbp), %rdi
callq 0xd020
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rdi
movsd 0x25f4d(%rip), %xmm0    # 0x32018
callq 0xbdd0
movl $0x0, -0x4(%rbp)
jmp 0xc13c
movq -0x50(%rbp), %rdi
callq 0xd020
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xc113
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, 0x20(%rax)
movl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xc11a
xorl %eax, %eax
movl %eax, -0x64(%rbp)
jmp 0xc11a
movl -0x64(%rbp), %eax
cmpl $0x0, %eax
je 0xc135
movq -0x38(%rbp), %rdi
callq 0x86a0
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0xc0ea
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)