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

```asm
<DrawlineBmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %r8d,-0x48(%rbp)
  mov    %r9d,%eax
  mov    %ax,-0x4c(%rbp)
  mov    -0x44(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x48(%rbp),%eax
  sub    -0x40(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  js     L169
  mov    $0x1,%eax
  jmp    L128
L169:
  mov    $0xffffffff,%eax
L128:
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  js     L174
  mov    $0x1,%eax
  jmp    L136
L174:
  mov    $0xffffffff,%eax
L136:
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jne    L12
  cmpl   $0x0,-0x14(%rbp)
  jle    L46
  movzwl -0x4c(%rbp),%edi
  mov    -0x14(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edi,%r9d
  mov    %ecx,%r8d
  mov    $0x0,%ecx
  mov    %rax,%rdi
  call   <DrawVlineBmp@plt>
  jmp    L147
L46:
  cmpl   $0x0,-0x14(%rbp)
  jns    L173
  movzwl -0x4c(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  neg    %eax
  mov    %eax,%edi
  mov    -0x48(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %ecx,%r9d
  mov    %edi,%r8d
  mov    $0x0,%ecx
  mov    %rax,%rdi
  call   <DrawVlineBmp@plt>
  jmp    L147
L173:
  mov    -0x40(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x7,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  movzwl -0x4c(%rbp),%eax
  mov    %ax,(%rdx)
  jmp    L147
L12:
  cmpl   $0x0,-0x14(%rbp)
  jne    L112
  cmpl   $0x0,-0x18(%rbp)
  jle    L115
  movzwl -0x4c(%rbp),%edi
  mov    -0x18(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edi,%r9d
  mov    $0x0,%r8d
  mov    %rax,%rdi
  call   <DrawHlineBmp@plt>
  jmp    L147
L115:
  cmpl   $0x0,-0x18(%rbp)
  jns    L112
  movzwl -0x4c(%rbp),%edi
  mov    -0x18(%rbp),%eax
  neg    %eax
  mov    %eax,%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x44(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edi,%r9d
  mov    $0x0,%r8d
  mov    %rax,%rdi
  call   <DrawHlineBmp@plt>
  jmp    L147
L112:
  mov    -0xc(%rbp),%eax
  imul   -0x18(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x8(%rbp),%eax
  imul   -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x1,-0x28(%rbp)
  movl   $0x280,-0x24(%rbp)
  mov    -0x28(%rbp),%eax
  imul   -0xc(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jge    L130
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x24(%rbp)
L130:
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x40(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x7,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L109
L171:
  mov    -0x10(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  movzwl -0x4c(%rbp),%eax
  mov    %ax,(%rdx)
  mov    -0x14(%rbp),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L170
  mov    -0x18(%rbp),%eax
  sub    %eax,-0x1c(%rbp)
  mov    -0x24(%rbp),%eax
  add    %eax,-0x10(%rbp)
L170:
  addl   $0x1,-0x20(%rbp)
  mov    -0x28(%rbp),%eax
  add    %eax,-0x10(%rbp)
L109:
  mov    -0x20(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L171
L147:
  leave
  ret
```

assistant: ```c
void DrawlineBmp(unsigned short *buffer, int x1, int y1, int x2, int y2, unsigned short color) {
  int pixx, pixy;
  int x, y;
  int dx, dy;
  int sx, sy;
  int swaptmp;
  int idx;
  dx = x2 - x1;
  dy = y2 - y1;
  sx = (dx >= 0) ? 1 : -1;
  sy = (dy >= 0) ? 1 : -1;
  if (dx == 0) {
    if (dy > 0) {
      DrawVlineBmp(buffer, x1, y1, 0, dy, color);
      return;
    } else if (dy < 0) {
      DrawVlineBmp(buffer, x1, y2, 0, -dy, color);
      return;
    } else {
      idx = x1 + y1 * 640;
      buffer[idx] = color;
      return;
    }
  }
  if (dy == 0) {
    if (dx > 0) {
      DrawHlineBmp(buffer, x1, y1, dx, 0, color);
      return;
    } else if (dx < 0) {
      DrawHlineBmp(buffer, x2, y1, -dx, 0, color);
      return;
    }
  }
  dx = sx * dx + 1;
  dy = sy * dy + 1;
  pixx = 1;
  pixy = 640;
  pixx *= sx;
  pixy *= sy;
  if (dx < dy) {
    swaptmp = dx;
    dx = dy;
    dy = swaptmp;
    swaptmp = pixx;
    pixx = pixy;
    pixy = swaptmp;
  }
  x = 0;
  y = 0;
  idx = x1 + y1 * 640;
  for (; x < dx; x++, idx += pixx) {
    buffer[idx] = color;
    y += dy;
    if (y >= dx) {
      y -= dx;
      idx += pixy;
    }
  }
}
```