user: Translate the below assembly code into C programming language:

```asm
<append>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x138,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x128(%rsp)
  xor    %eax,%eax
  lea    D53(%rip),%rdi
  call   <puts0@plt>
  lea    0x20(%rsp),%r12
  lea    0x30(%rsp),%rdx
  mov    %r12,%rax
L89:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L89
  lea    0x20(%rsp),%rdi
  mov    $0x100,%esi
  mov    $0x0,%eax
  call   <getsn@plt>
  mov    $0x0,%eax
L2:
  movzbl 0x20(%rsp,%rax,1),%edx
  mov    %dl,(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    $0x10,%rax
  jne    L2
  movb   $0x0,0x10(%rsp)
  lea    D25(%rip),%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  mov    %rsp,%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  lea    D66(%rip),%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  mov    $0x3,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <open_@plt>
  cmp    $0x1,%ax
  jne    L118
  lea    D21(%rip),%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  mov    $0x1,%r13d
  lea    D46(%rip),%r15
  lea    0x100(%r12),%rbx
  lea    D25(%rip),%r14
  jmp    L23
L118:
  lea    D76(%rip),%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
L122:
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L102
  add    $0x138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L52:
  mov    $0x0,%r13d
L23:
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  mov    %r12,%rax
L69:
  movb   $0x0,(%rax)
  add    $0x1,%rax
  cmp    %rbx,%rax
  jne    L69
  lea    0x20(%rsp),%rbp
  mov    $0x100,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <getsn@plt>
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  lea    D66(%rip),%rdi
  mov    $0x0,%eax
  call   <puts0@plt>
  cmpb   $0x5d,0x20(%rsp)
  je     L31
  test   %r13d,%r13d
  je     L125
L93:
  mov    %r12,%rbp
L45:
  movzbl 0x0(%rbp),%esi
  test   %sil,%sil
  je     L52
  movzbl %sil,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <writec@plt>
  movzbl 0x0(%rbp),%edi
  mov    $0x0,%eax
  call   <putch@plt>
  add    $0x1,%rbp
  cmp    %rbx,%rbp
  jne    L45
  jmp    L52
L125:
  mov    $0xa,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <writec@plt>
  jmp    L93
L31:
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <close_@plt>
  jmp    L122
L102:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D53
datatype: string
name: disassemble_data
arguments: data_tag: D25
datatype: string
name: disassemble_data
arguments: data_tag: D66
datatype: string
name: disassemble_data
arguments: data_tag: D21
datatype: string
name: disassemble_data
arguments: data_tag: D46
datatype: string
name: disassemble_data
arguments: data_tag: D76
datatype: string

tool: D53: file ? 

tool: D25: 
'

tool: D66: '


tool: D21: open OK


tool: D46: data to file (] - end of text) ? 

tool: D76: open not ok


assistant: ```c
void append(void) {
  unsigned short int i;
  unsigned short int j;
  unsigned short int equal;
  unsigned char device;
  unsigned char filename[16 + 2];
  unsigned char str[256];
  int first_line;
  puts0("file ? ");
  for (i = 0; i < 16; i++)
    str[i] = 0;
  getsn(str, 256);
  for (i = 0; i < 16; i++)
    filename[i] = str[i];
  filename[16] = 0;
  puts0("\r\n'");
  puts0(filename);
  puts0("'\r\n");
  i = open_(filename, 3);
  if (i == 1) {
    puts0("open OK\r\n");
  } else {
    puts0("open not ok\r\n");
    return;
  }
  first_line = 1;
  while (1) {
    puts0("data to file (] - end of text) ? ");
    for (i = 0; i < 256; i++)
      str[i] = 0;
    getsn(str, 256);
    puts0("\r\n'");
    puts0(str);
    puts0("'\r\n");
    if (str[0] == ']')
      break;
    if (first_line == 0)
      writec(0, '\n');
    else
      first_line = 0;
    for (i = 0; i < 256; i++)
      if (str[i]) {
        writec(0, str[i]);
        putch(str[i]);
      } else
        break;
  }
  close_(0);
}
```