user: Converte this assembly snippet into its equivalent C code:

```asm
<display>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,0xc(%rsp)
  mov    %esi,%ebx
  mov    %rdx,(%rsp)
  lea    -0x3(%rsi),%r13d
  test   %r13d,%r13d
  jle    L4
  mov    %r13d,%edx
  mov    $0x0,%eax
L22:
  add    $0x1,%eax
  cmp    %edx,%eax
  jne    L22
  lea    -0x4(%rbx),%eax
  add    $0x1,%rax
  lea    (%rax,%rax,4),%rdx
  lea    (%rax,%rdx,8),%rax
  add    %rax,(%rsp)
L4:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <move@plt>
  lea    D18(%rip),%rbp
  mov    %rbp,%rdi
  call   <addstr@plt>
  mov    $0x0,%esi
  mov    $0xf,%edi
  call   <move@plt>
  mov    %rbp,%rdi
  call   <addstr@plt>
  lea    0x3(%rbx),%eax
  mov    %eax,0x8(%rsp)
  mov    $0x1,%r12d
  jmp    L61
L7:
  mov    $0x0,%esi
  mov    %r12d,%edi
  call   <move@plt>
  mov    $0x7c,%edi
  call   <addch@plt>
  mov    $0x22,%esi
  mov    %r12d,%edi
  call   <move@plt>
  mov    $0x7c,%edi
  call   <addch@plt>
  lea    0x1(%r12),%ebx
  mov    $0x0,%esi
  mov    %ebx,%edi
  call   <move@plt>
  mov    $0x7c,%edi
  call   <addch@plt>
  mov    $0x22,%esi
  mov    %ebx,%edi
  call   <move@plt>
  mov    $0x7c,%edi
  call   <addch@plt>
  mov    0xc(%rsp),%eax
  lea    0x5(%rax),%r15d
  lea    -0x5(%rax),%ebx
  movslq %ebx,%rbx
  mov    $0x0,%ebp
  jmp    L18
L43:
  mov    (%rsp),%rax
  movsbl (%rax,%rbx,1),%edx
  mov    %r14d,%esi
  mov    %ebp,%edi
  call   <draw_symbol@plt>
L83:
  add    $0x1,%rbx
  add    $0x3,%ebp
  cmp    %ebx,%r15d
  jl     L34
L18:
  cmp    $0x27,%ebx
  jbe    L43
  mov    $0x23,%edx
  mov    %r14d,%esi
  mov    %ebp,%edi
  call   <draw_symbol@plt>
  jmp    L83
L34:
  addq   $0x29,(%rsp)
L49:
  add    $0x1,%r13d
  add    $0x2,%r12d
  cmp    0x8(%rsp),%r13d
  jg     L80
L61:
  lea    -0x1(%r12),%r14d
  cmp    $0xf,%r13d
  jbe    L7
  mov    $0x0,%esi
  mov    %r12d,%edi
  call   <move@plt>
  lea    D24(%rip),%rdi
  call   <addstr@plt>
  lea    0x1(%r12),%edi
  mov    $0x0,%esi
  call   <move@plt>
  lea    D24(%rip),%rdi
  call   <addstr@plt>
  jmp    L49
L80:
  mov    $0x0,%esi
  mov    $0x10,%edi
  call   <move@plt>
  mov    $0x0,%eax
  call   <refresh@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D18
data_type: string
name: read_data
arguments: data_label: D24
data_type: string

tool: D18: +---------------------------------+

tool: D24: |#################################|

assistant: ```c
void display(int cx, int cy, char (*row_ptr)[40 + 1]) {
  int x, y = 0, x_coord, y_coord;
  char ch;
  while (y < (cy - 3)) {
    y++;
    row_ptr++;
  };
  move(0, 0);
  addstr("+---------------------------------+");
  move(15, 0);
  addstr("+---------------------------------+");
  for (y = (cy - 3); y <= (cy + 3); y++) {
    y_coord = (y + 3 - cy) * 2;
    if ((y < 0) || (y >= 16)) {
      move(y_coord + 1, 0);
      addstr("|#################################|");
      move(y_coord + 2, 0);
      addstr("|#################################|");
    } else {
      move(y_coord + 1, 0);
      addch('|');
      move(y_coord + 1, 34);
      addch('|');
      move(y_coord + 2, 0);
      addch('|');
      move(y_coord + 2, 34);
      addch('|');
      for (x = (cx - 5); x <= (cx + 5); x++) {
        x_coord = (x + 5 - cx) * 3;
        if ((x < 0) || (x > 40 - 1))
          draw_symbol(x_coord, y_coord, '#');
        else {
          ch = (*row_ptr)[x];
          draw_symbol(x_coord, y_coord, ch);
        }
      };
      row_ptr++;
    }
  }
  move(16, 0);
  refresh();
}
```