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

```asm
<drawline>:
  endbr64
  push   %r15
  mov    %r8d,%eax
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %edx,%r12d
  mov    %ecx,%edx
  push   %rbp
  sub    %r9d,%edx
  push   %rbx
  mov    %edx,%edi
  mov    %r8d,%ebx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%esi
  sub    %esi,%eax
  or     %eax,%edi
  je     L23
  mov    %r9d,%edi
  mov    %r9d,%ebp
  sub    %ecx,%edi
  test   %edx,%edx
  cmovs  %edi,%edx
  mov    %esi,%edi
  sub    %r8d,%edi
  test   %eax,%eax
  cmovs  %edi,%eax
  cmp    %eax,%edx
  jge    L49
  cmp    %esi,%r8d
  jg     L128
  jne    L80
  test   %r8d,%r8d
  jle    L144
  lea    -0x1(%r8),%esi
L90:
  mov    %ebp,%eax
  mov    %ecx,%ebp
  mov    %eax,%ecx
L128:
  test   %r12d,%r12d
  jle    L59
  mov    %ebx,%eax
  mov    %esi,%r9d
  sub    %ebp,%ecx
  xor    %r8d,%r8d
  sub    %esi,%eax
  imul   %r13d,%r9d
  mov    %ecx,0x18(%rsp)
  movslq %r12d,%r15
  mov    %eax,0x1c(%rsp)
  mov    %esi,%ecx
  nopl   (%rax)
L135:
  mov    %r8d,%eax
  mov    $0xff,%esi
  mov    %ecx,0x14(%rsp)
  cltd
  mov    %r8d,0x10(%rsp)
  idivl  0x1c(%rsp)
  mov    %r9d,0xc(%rsp)
  mov    %r15,%rdx
  lea    (%rax,%rbp,1),%edi
  imul   %r12d,%edi
  add    %r9d,%edi
  movslq %edi,%rdi
  add    %r14,%rdi
  call   <memset@plt>
  mov    0x14(%rsp),%ecx
  mov    0xc(%rsp),%r9d
  mov    0x10(%rsp),%r8d
  add    0x18(%rsp),%r8d
  add    $0x1,%ecx
  add    %r13d,%r9d
  cmp    %ebx,%ecx
  jle    L135
L59:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L49:
  cmp    %r9d,%ecx
  jg     L13
L131:
  test   %r12d,%r12d
  jle    L59
  mov    %ebp,%eax
  sub    %ebx,%esi
  mov    %ecx,%r9d
  xor    %r8d,%r8d
  sub    %ecx,%eax
  mov    %esi,0x18(%rsp)
  imul   %r12d,%r9d
  movslq %r12d,%r15
  mov    %eax,0x1c(%rsp)
  nopl   0x0(%rax)
L62:
  mov    %r8d,%eax
  mov    $0xff,%esi
  mov    %ecx,0x14(%rsp)
  cltd
  mov    %r8d,0x10(%rsp)
  idivl  0x1c(%rsp)
  mov    %r9d,0xc(%rsp)
  mov    %r15,%rdx
  lea    (%rax,%rbx,1),%edi
  imul   %r13d,%edi
  add    %r9d,%edi
  movslq %edi,%rdi
  add    %r14,%rdi
  call   <memset@plt>
  mov    0x14(%rsp),%ecx
  mov    0xc(%rsp),%r9d
  mov    0x10(%rsp),%r8d
  add    0x18(%rsp),%r8d
  add    $0x1,%ecx
  add    %r12d,%r9d
  cmp    %ecx,%ebp
  jge    L62
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L23:
  test   %r12d,%r12d
  jle    L59
  imul   %r13d,%ebx
  add    $0x28,%rsp
  movslq %r12d,%rdx
  mov    $0xff,%esi
  imul   %r12d,%ecx
  lea    (%rbx,%rcx,1),%edi
  pop    %rbx
  pop    %rbp
  movslq %edi,%rdi
  pop    %r12
  pop    %r13
  add    %r14,%rdi
  pop    %r14
  pop    %r15
  jmp    1050 <memset@plt>
L13:
  mov    %ecx,%eax
  mov    %esi,%ebx
  mov    %r9d,%ecx
  mov    %r8d,%esi
  mov    %eax,%ebp
  jmp    L131
L80:
  mov    %esi,%eax
  mov    %ecx,%ebp
  mov    %r8d,%esi
  mov    %r9d,%ecx
  mov    %eax,%ebx
  jmp    L128
L144:
  lea    0x1(%r8),%eax
  cmp    %eax,%r8d
  jg     L59
  mov    %eax,%ebx
  jmp    L90
```

assistant: ```c
void drawline(unsigned char *buffer, int rowstride, int bpp, int x1, int y1, int x2, int y2) {
  int i, j;
  i = x1 - x2;
  j = y1 - y2;
  if (i == 0 && j == 0) {
    for (i = 0; i < bpp; i++)
      buffer[y1 * rowstride + x1 * bpp + i] = 0xff;
    return;
  }
  if (i < 0)
    i = -i;
  if (j < 0)
    j = -j;
  if (i < j) {
    if (y1 > y2) {
      i = y2;
      y2 = y1;
      y1 = i;
      i = x2;
      x2 = x1;
      x1 = i;
    }
    if (y2 == y1) {
      if (y2 > 0)
        y1--;
      else
        y2++;
    }
    for (j = y1; j <= y2; j++)
      for (i = 0; i < bpp; i++)
        buffer[j * rowstride + (x1 + (j - y1) * (x2 - x1) / (y2 - y1)) * bpp + i] = 0xff;
  } else {
    if (x1 > x2) {
      i = y2;
      y2 = y1;
      y1 = i;
      i = x2;
      x2 = x1;
      x1 = i;
    }
    for (i = x1; i <= x2; i++)
      for (j = 0; j < bpp; j++)
        buffer[(y1 + (i - x1) * (y2 - y1) / (x2 - x1)) * rowstride + i * bpp + j] = 0xff;
  }
}
```