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

```asm
<alcon2009_draw_rectangle>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%r10d
  mov    %edx,%r11d
  mov    %ecx,-0x18(%rsp)
  mov    %r8d,-0xc(%rsp)
  mov    %r9d,%esi
  mov    %r9d,-0x14(%rsp)
  movzbl 0x40(%rsp),%r9d
  movzbl 0x48(%rsp),%ebx
  movzbl 0x50(%rsp),%ebp
  cmp    0x38(%rsp),%r8d
  jg     L169
  mov    %r8d,%edx
  mov    %r8d,%r15d
  imul   %r10d,%r15d
  lea    (%r10,%r10,2),%eax
  add    %eax,%eax
  mov    %eax,-0x8(%rsp)
  mov    %ecx,%eax
  add    %esi,%eax
  lea    (%rax,%r15,2),%eax
  lea    (%rax,%rax,2),%r14d
  mov    0x38(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,-0x10(%rsp)
  mov    %r8d,%r13d
  lea    0x4(%rsi),%r12d
  not    %r8d
  shr    $0x1f,%r8d
  mov    %r15d,-0x1c(%rsp)
  mov    %edx,%r15d
  jmp    L173
L174:
  movslq %ecx,%rsi
  mov    %r9b,(%rdi,%rsi,1)
  mov    %bl,0x1(%rdi,%rsi,1)
  mov    %bpl,0x2(%rdi,%rsi,1)
L88:
  add    $0x3,%ecx
  add    $0x1,%eax
  sub    $0x1,%edx
  cmp    %r12d,%eax
  je     L33
L215:
  test   %r8b,%r8b
  je     L88
  cmp    %r11d,%r15d
  jge    L88
  test   %edx,%edx
  js     L221
  cmp    %edx,%r10d
  jle    L221
  mov    %r14d,%esi
  sub    %ecx,%esi
  movslq %esi,%rsi
  mov    %r9b,(%rdi,%rsi,1)
  mov    %bl,0x1(%rdi,%rsi,1)
  mov    %bpl,0x2(%rdi,%rsi,1)
L221:
  test   %eax,%eax
  js     L88
  cmp    %eax,%r10d
  jg     L174
  jmp    L88
L33:
  add    $0x1,%r13d
  add    %r10d,-0x1c(%rsp)
  add    -0x8(%rsp),%r14d
  cmp    -0x10(%rsp),%r13d
  je     L169
L173:
  mov    -0x1c(%rsp),%eax
  mov    -0x14(%rsp),%esi
  add    %esi,%eax
  lea    (%rax,%rax,2),%ecx
  mov    -0x18(%rsp),%edx
  mov    %esi,%eax
  jmp    L215
L169:
  mov    -0x18(%rsp),%r14d
  lea    -0x3(%r14),%r15d
  mov    -0x14(%rsp),%edx
  lea    0x3(%rdx),%eax
  cmp    %eax,%r15d
  jg     L166
  mov    %r10d,%eax
  imul   0x38(%rsp),%eax
  add    %r14d,%eax
  lea    -0x9(%rax,%rax,2),%r13d
  add    $0x4,%edx
  mov    %edx,-0x8(%rsp)
  lea    (%r10,%r10,2),%edx
  mov    %edx,-0x18(%rsp)
  mov    %edx,%eax
  neg    %eax
  mov    %eax,-0x1c(%rsp)
  mov    -0xc(%rsp),%eax
  sub    0x38(%rsp),%eax
  imul   %edx,%eax
  mov    %eax,-0x4(%rsp)
  mov    0x38(%rsp),%eax
  lea    0x4(%rax),%r12d
  mov    %r14d,%r8d
  not    %r8d
  shr    $0x1f,%r8d
  mov    %r9b,-0x14(%rsp)
  jmp    L203
L189:
  movslq %ecx,%r9
  movzbl -0x14(%rsp),%r13d
  mov    %r13b,(%rdi,%r9,1)
  mov    %bl,0x1(%rdi,%r9,1)
  mov    %bpl,0x2(%rdi,%r9,1)
L79:
  add    -0x18(%rsp),%ecx
  add    $0x1,%eax
  add    -0x1c(%rsp),%esi
  sub    $0x1,%edx
  cmp    %r12d,%eax
  je     L60
L162:
  test   %r8b,%r8b
  je     L79
  cmp    %r10d,%r14d
  jge    L79
  test   %edx,%edx
  js     L13
  cmp    %edx,%r11d
  jle    L13
  movslq %esi,%r9
  movzbl -0x14(%rsp),%r13d
  mov    %r13b,(%rdi,%r9,1)
  mov    %bl,0x1(%rdi,%r9,1)
  mov    %bpl,0x2(%rdi,%r9,1)
L13:
  test   %eax,%eax
  js     L79
  cmp    %eax,%r11d
  jg     L189
  jmp    L79
L60:
  mov    -0x10(%rsp),%r13d
  add    $0x1,%r15d
  add    $0x3,%r13d
  cmp    -0x8(%rsp),%r15d
  je     L166
L203:
  mov    -0x4(%rsp),%eax
  lea    0x0(%r13,%rax,1),%esi
  mov    -0xc(%rsp),%edx
  mov    0x38(%rsp),%eax
  mov    %r13d,%ecx
  mov    %r13d,-0x10(%rsp)
  jmp    L162
L166:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void alcon2009_draw_rectangle(unsigned char *image, int width, int height, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b) {
  int i, w;
  for (i = y1; i <= y2; i++) {
    for (w = 0; w < 4; w++) {
      int xx1 = x1 - w;
      int xx2 = x2 + w;
      if (y1 >= 0 && y1 < height) {
        if (xx1 >= 0 && xx1 < width) {
          image[(xx1 + i * width) * 3 + 0] = r;
          image[(xx1 + i * width) * 3 + 1] = g;
          image[(xx1 + i * width) * 3 + 2] = b;
        }
        if (xx2 >= 0 && xx2 < width) {
          image[(xx2 + i * width) * 3 + 0] = r;
          image[(xx2 + i * width) * 3 + 1] = g;
          image[(xx2 + i * width) * 3 + 2] = b;
        }
      }
    }
  }
  for (i = x1 - 4 + 1; i <= x2 + 4 - 1; i++) {
    for (w = 0; w < 4; w++) {
      int yy1 = y1 - w;
      int yy2 = y2 + w;
      if (x1 >= 0 && x1 < width) {
        if (yy1 >= 0 && yy1 < height) {
          image[(i + yy1 * width) * 3 + 0] = r;
          image[(i + yy1 * width) * 3 + 1] = g;
          image[(i + yy1 * width) * 3 + 2] = b;
        }
        if (yy2 >= 0 && yy2 < height) {
          image[(i + yy2 * width) * 3 + 0] = r;
          image[(i + yy2 * width) * 3 + 1] = g;
          image[(i + yy2 * width) * 3 + 2] = b;
        }
      }
    }
  }
}
```