user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<trace_edge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    %r8d,-0x28(%rbp)
  mov    %r9d,-0x2c(%rbp)
  mov    0x48(%rbp),%rax
  movl   $0x0,(%rax)
  movl   $0x1,-0x10(%rbp)
  jmp    L37
L291:
  movl   $0x0,-0x10(%rbp)
  cmpl   $0x0,0x30(%rbp)
  je     L352
  cmpl   $0x0,0x30(%rbp)
  je     L37
  mov    -0x24(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L37
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x2c(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jg     L37
  mov    -0x28(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L37
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x2c(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jg     L37
L352:
  mov    -0x28(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0xff,(%rax)
  mov    0x48(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,0x38(%rbp)
  jle    L78
  mov    0x48(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,(%rdx)
  mov    0x48(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  mov    %eax,(%rdx)
  mov    0x48(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x48(%rbp),%rax
  mov    %edx,(%rax)
L78:
  mov    0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jge    L147
  mov    0x10(%rbp),%rax
  mov    -0x24(%rbp),%edx
  mov    %edx,(%rax)
  jmp    L354
L147:
  mov    0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jle    L354
  mov    0x20(%rbp),%rax
  mov    -0x24(%rbp),%edx
  mov    %edx,(%rax)
L354:
  mov    0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x28(%rbp)
  jge    L81
  mov    0x18(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  jmp    L336
L81:
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x28(%rbp)
  jle    L336
  mov    0x28(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
L336:
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  js     L116
  mov    -0x8(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  js     L74
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L74
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L74:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L221
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L221
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L221:
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L116
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L116
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L116
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L116:
  cmpl   $0x0,-0x10(%rbp)
  jne    L121
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jle    L226
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L226
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L226:
  cmpl   $0x0,-0x10(%rbp)
  jne    L121
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x24(%rbp)
  jge    L121
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L121
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L121:
  cmpl   $0x0,-0x10(%rbp)
  jne    L37
  mov    -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jge    L37
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  js     L264
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L264
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L264:
  cmpl   $0x0,-0x10(%rbp)
  jne    L64
  addl   $0x1,-0xc(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L64
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L64:
  cmpl   $0x0,-0x10(%rbp)
  jne    L37
  addl   $0x1,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L37
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L37
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x1,-0x10(%rbp)
L37:
  cmpl   $0x0,-0x10(%rbp)
  jne    L291
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void trace_edge(unsigned char *edgesImage, int width, int height, int x, int y, int image_border, int *perimeter_tx, int *perimeter_ty, int *perimeter_bx, int *perimeter_by, int ignore_periphery, int max_members, int *members, int *no_of_members) {
  int following, n, xx, yy;
  *no_of_members = 0;
  following = 1;
  while (following != 0) {
    following = 0;
    if ((ignore_periphery == 0) || ((ignore_periphery != 0) && ((x >= image_border) && (x <= width - 1 - image_border) && (y >= image_border) && (y <= height - 1 - image_border)))) {
      edgesImage[(y * width) + x] = 255;
      if (*no_of_members < max_members) {
        members[*no_of_members * 2] = x;
        members[*no_of_members * 2 + 1] = y;
        *no_of_members = *no_of_members + 1;
      }
      if (x < *perimeter_tx) {
        *perimeter_tx = x;
      } else {
        if (x > *perimeter_bx)
          *perimeter_bx = x;
      }
      if (y < *perimeter_ty) {
        *perimeter_ty = y;
      } else {
        if (y > *perimeter_by)
          *perimeter_by = y;
      }
      yy = y - 1;
      xx = x - 1;
      if (yy > -1) {
        n = yy * width;
        if (xx > -1) {
          if (edgesImage[n + xx] == 0) {
            x = xx;
            y = yy;
            following = 1;
          }
        }
        xx = x;
        if ((following == 0) && (edgesImage[n + xx] == 0)) {
          x = xx;
          y = yy;
          following = 1;
        }
        xx = x + 1;
        if ((following == 0) && (xx < width)) {
          if (edgesImage[n + xx] == 0) {
            x = xx;
            y = yy;
            following = 1;
          }
        }
      }
      if (following == 0) {
        yy = y;
        n = yy * width;
        if (x > 0) {
          xx = x - 1;
          if (edgesImage[n + xx] == 0) {
            x = xx;
            y = yy;
            following = 1;
          }
        }
        if ((following == 0) && (x < width - 1)) {
          xx = x + 1;
          if (edgesImage[n + xx] == 0) {
            x = xx;
            y = yy;
            following = 1;
          }
        }
      }
      if (following == 0) {
        yy = y + 1;
        n = yy * width;
        if (yy < height) {
          xx = x - 1;
          if (xx > -1) {
            if (edgesImage[n + xx] == 0) {
              x = xx;
              y = yy;
              following = 1;
            }
          }
          if (following == 0) {
            xx++;
            if (edgesImage[n + xx] == 0) {
              x = xx;
              y = yy;
              following = 1;
            }
          }
          if (following == 0) {
            xx++;
            if (xx < width) {
              if (edgesImage[n + xx] == 0) {
                x = xx;
                y = yy;
                following = 1;
              }
            }
          }
        }
      }
    }
  }
}
```