user: 请从给定的汇编指令推导出C源代码:

```asm
<lcd_draw_rectangle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %ecx,-0x20(%rbp)
  mov    %r8d,%eax
  mov    %r9d,-0x28(%rbp)
  mov    %al,-0x24(%rbp)
  cmpb   $0x0,-0x24(%rbp)
  je     L29
  mov    $0x20,%edi
  call   <lcd_write_index_register@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x21,%edi
  call   <lcd_write_index_register@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x50,%edi
  call   <lcd_write_index_register@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x51,%edi
  call   <lcd_write_index_register@plt>
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x52,%edi
  call   <lcd_write_index_register@plt>
  mov    $0xef,%eax
  sub    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x53,%edi
  call   <lcd_write_index_register@plt>
  mov    $0xef,%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  mov    $0x22,%edi
  call   <lcd_write_index_register@plt>
  mov    -0x18(%rbp),%eax
  mov    %al,-0x5(%rbp)
  jmp    L21
L47:
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L15
L50:
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <lcd_write_wdr@plt>
  addl   $0x1,-0x4(%rbp)
L15:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jbe    L50
  movzbl -0x5(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x5(%rbp)
L21:
  movzbl -0x5(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jae    L47
  jmp    L40
L29:
  mov    -0x28(%rbp),%edi
  mov    -0x18(%rbp),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%esi
  mov    -0x14(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <lcd_draw_line@plt>
  mov    -0x28(%rbp),%edi
  mov    -0x20(%rbp),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%esi
  mov    -0x1c(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <lcd_draw_line@plt>
  mov    -0x28(%rbp),%edi
  mov    -0x20(%rbp),%ecx
  mov    -0x14(%rbp),%edx
  mov    -0x20(%rbp),%esi
  mov    -0x1c(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <lcd_draw_line@plt>
  mov    -0x28(%rbp),%edi
  mov    -0x18(%rbp),%ecx
  mov    -0x14(%rbp),%edx
  mov    -0x20(%rbp),%esi
  mov    -0x14(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <lcd_draw_line@plt>
L40:
  nop
  leave
  ret
```

assistant: ```c
void lcd_draw_rectangle(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, char fill, int color) {
  if (fill) {
    unsigned int counter_x;
    unsigned char counter_y;
    lcd_write_index_register(0x20);
    lcd_write_wdr(x0);
    lcd_write_index_register(0x21);
    lcd_write_wdr(y0);
    lcd_write_index_register(0x50);
    lcd_write_wdr(x0);
    lcd_write_index_register(0x51);
    lcd_write_wdr(x1);
    lcd_write_index_register(0x52);
    lcd_write_wdr(239 - y1);
    lcd_write_index_register(0x53);
    lcd_write_wdr(239 - y0);
    lcd_write_index_register(0x22);
    for (counter_y = y0; counter_y <= y1; counter_y++) {
      for (counter_x = x0; counter_x <= x1; counter_x++)
        lcd_write_wdr(color);
    }
  } else {
    lcd_draw_line(x0, y0, x1, y0, color);
    lcd_draw_line(x1, y0, x1, y1, color);
    lcd_draw_line(x1, y1, x0, y1, color);
    lcd_draw_line(x0, y1, x0, y0, color);
  }
}
```