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

```asm
<DrawBoxBmp>:
  endbr64
  movslq %esi,%r10
  movslq %edx,%rsi
  movslq %ecx,%rdx
  push   %r15
  push   %r14
  mov    %r9d,%eax
  lea    (%rsi,%r8,1),%r15d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    (%r10,%rdx,1),%ebx
  cmp    %ebx,%r10d
  jge    L82
  lea    (%rsi,%rsi,4),%ecx
  movslq %esi,%r12
  movslq %r8d,%r11
  mov    %edx,%ebp
  shl    $0x7,%ecx
  add    %r12,%r11
  lea    (%r12,%r12,4),%r13
  mov    %ecx,-0xc(%rsp)
  lea    (%r15,%r15,4),%ecx
  lea    (%r11,%r11,4),%r11
  shl    $0x7,%r13
  shl    $0x7,%ecx
  shl    $0x7,%r11
  mov    %ecx,-0x10(%rsp)
  lea    -0x1(%rdx),%ecx
  mov    %ecx,-0x1c(%rsp)
  movslq %r10d,%rcx
  lea    (%r11,%rcx,1),%r14
  mov    %rcx,-0x28(%rsp)
  add    -0x28(%rsp),%r13
  lea    (%r14,%r14,1),%r11
  mov    %r11,%rcx
  lea    0x2(%r13,%r13,1),%r11
  mov    %rcx,-0x18(%rsp)
  sub    %r11,%rcx
  cmp    $0xc,%rcx
  jbe    L146
  mov    -0x1c(%rsp),%ecx
  cmp    $0x2,%ecx
  jbe    L146
  cmp    $0x6,%ecx
  jbe    L76
  movd   %r9d,%xmm0
  lea    -0x2(%rdi,%r11,1),%r12
  mov    -0x18(%rsp),%r11
  xor    %ecx,%ecx
  punpcklwd %xmm0,%xmm0
  shr    $0x3,%ebp
  pshufd $0x0,%xmm0,%xmm0
  add    %rdi,%r11
  shl    $0x4,%rbp
  nopl   0x0(%rax,%rax,1)
L78:
  movups %xmm0,(%r12,%rcx,1)
  movups %xmm0,(%r11,%rcx,1)
  add    $0x10,%rcx
  cmp    %rcx,%rbp
  jne    L78
  mov    %edx,%r11d
  and    $0xfffffff8,%r11d
  lea    (%r11,%r10,1),%ecx
  cmp    %r11d,%edx
  je     L82
  mov    %edx,%ebp
  sub    %r11d,%ebp
  lea    -0x1(%rbp),%r12d
  cmp    $0x2,%r12d
  jbe    L124
L40:
  movd   %r9d,%xmm2
  lea    0x0(%r13,%r11,1),%r12
  add    %r14,%r11
  pshuflw $0x0,%xmm2,%xmm1
  movq   %xmm1,(%rdi,%r12,2)
  movq   %xmm1,(%rdi,%r11,2)
  mov    %ebp,%r11d
  and    $0xfffffffc,%r11d
  add    %r11d,%ecx
  cmp    %r11d,%ebp
  je     L82
L124:
  mov    -0xc(%rsp),%r14d
  mov    -0x10(%rsp),%r13d
  lea    (%r14,%rcx,1),%r11d
  movslq %r11d,%r11
  mov    %r9w,(%rdi,%r11,2)
  lea    0x0(%r13,%rcx,1),%r11d
  movslq %r11d,%r11
  mov    %r9w,(%rdi,%r11,2)
  lea    0x1(%rcx),%r11d
  cmp    %r11d,%ebx
  jle    L82
  lea    (%r14,%r11,1),%ebp
  add    %r13d,%r11d
  add    $0x2,%ecx
  movslq %ebp,%rbp
  movslq %r11d,%r11
  mov    %r9w,(%rdi,%rbp,2)
  mov    %r9w,(%rdi,%r11,2)
  cmp    %ecx,%ebx
  jle    L82
  add    %ecx,%r14d
  add    %r13d,%ecx
  movslq %r14d,%r11
  movslq %ecx,%rcx
  mov    %r9w,(%rdi,%r11,2)
  mov    %r9w,(%rdi,%rcx,2)
L82:
  cmp    %r15d,%esi
  jge    L43
  sub    $0x1,%r8d
  lea    (%rsi,%rsi,4),%ecx
  add    %r8,%rsi
  shl    $0x7,%ecx
  lea    (%rsi,%rsi,4),%rsi
  movslq %ecx,%rcx
  shl    $0x7,%rsi
  add    %r10,%rcx
  add    %r10,%rsi
  lea    (%rdi,%rcx,2),%rcx
  lea    0x500(%rdi,%rsi,2),%rsi
  nopw   0x0(%rax,%rax,1)
L145:
  mov    %ax,(%rcx)
  mov    %ax,(%rcx,%rdx,2)
  add    $0x500,%rcx
  cmp    %rsi,%rcx
  jne    L145
L43:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L146:
  movslq -0x10(%rsp),%r9
  lea    (%r12,%r12,4),%r11
  mov    -0x28(%rsp),%rcx
  shl    $0x8,%r11
  add    %rdi,%r11
  lea    (%rdi,%r9,2),%r9
  nopl   0x0(%rax)
L136:
  mov    %ax,(%r11,%rcx,2)
  mov    %ax,(%r9,%rcx,2)
  add    $0x1,%rcx
  cmp    %ecx,%ebx
  jg     L136
  jmp    L82
L76:
  mov    %r10d,%ecx
  xor    %r11d,%r11d
  jmp    L40
```

assistant: ```c
void DrawBoxBmp(unsigned short *buffer, int x, int y, int dx, int dy, unsigned short color) {
  int i, j, idx;
  for (i = x; i < x + dx; i++) {
    idx = i + y * 640;
    buffer[idx] = color;
    idx = i + (y + dy) * 640;
    buffer[idx] = color;
  }
  for (j = y; j < y + dy; j++) {
    idx = x + j * 640;
    buffer[idx] = color;
    idx = (x + dx) + j * 640;
    buffer[idx] = color;
  }
}
```