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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x68,%rsp
  mov    0x8(%rsi),%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  cmp    $0x3,%edi
  je     L61
  call   <usage@plt>
L61:
  movzbl (%r14),%eax
  mov    %eax,%edx
  and    $0xffffffef,%edx
  cmp    $0x2d,%dl
  je     L54
  cmp    $0x2b,%al
  jne    L84
L54:
  lea    0x1(%r14),%r12
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,%ebp
  cmp    $0xfff0,%eax
  ja     L71
L182:
  mov    0x10(%rbx),%rdi
  mov    $0x2,%esi
  xor    %eax,%eax
  call   <open@plt>
  mov    %eax,%r15d
  test   %eax,%eax
  js     L206
L89:
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  mov    $0x40,%edx
  mov    %r15d,%edi
  call   <read@plt>
  cmp    $0x40,%eax
  je     L44
  mov    0x10(%rbx),%rsi
  lea    D57(%rip),%rdx
  lea    D88(%rip),%rdi
  xor    %eax,%eax
  call   <stderr3@plt>
L44:
  mov    0x10(%rsp),%rax
  cmp    $0x301,%ax
  je     L39
  mov    0x10(%rbx),%rsi
  lea    D100(%rip),%rdx
  lea    D88(%rip),%rdi
  xor    %eax,%eax
  call   <stderr3@plt>
  mov    0x10(%rsp),%rax
L39:
  sar    $0x15,%rax
  mov    0x40(%rsp),%r12
  movzbl (%r14),%ecx
  mov    %rax,%rdx
  sub    0x28(%rsp),%r12
  mov    0x28(%rsp),%rax
  sub    0x30(%rsp),%r12
  add    0x30(%rsp),%rax
  and    $0x1,%edx
  jne    L190
  sub    0x20(%rsp),%r12
  cmp    $0x3d,%cl
  je     L154
L160:
  cmp    $0x2b,%cl
  je     L11
  cmp    $0x2d,%cl
  jne    L172
  mov    %r12,%r13
  sub    %rbp,%r13
  jmp    L172
L190:
  cmp    $0x3d,%cl
  jne    L160
  add    %rbp,%rax
  mov    $0x10000,%edx
  cmp    %rdx,%rax
  cmovge %rax,%rdx
  sub    $0x10000,%rdx
  sub    %rdx,%rbp
  sub    %rdx,%rax
  mov    %rax,0x8(%rsp)
  mov    %rbp,%r13
  jmp    L104
L84:
  xor    %eax,%eax
  call   <usage@plt>
  jmp    L54
L11:
  lea    0x0(%rbp,%r12,1),%r13
L172:
  add    %r13,%rax
  mov    $0x10000,%ecx
  cmp    %rcx,%rax
  cmovge %rax,%rcx
  sub    $0x10000,%rcx
  sub    %rcx,%rax
  sub    %rcx,%r13
  mov    %rax,0x8(%rsp)
  test   %edx,%edx
  jne    L104
L128:
  add    0x20(%rsp),%rax
  mov    %rax,0x8(%rsp)
L104:
  xor    %edx,%edx
  mov    $0x18,%esi
  mov    %r15d,%edi
  xor    %eax,%eax
  call   <lseek@plt>
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  mov    %r15d,%edi
  mov    $0x4,%edx
  call   <write@plt>
  test   %eax,%eax
  js     L69
L19:
  mov    0x10(%rbx),%rsi
  lea    D0(%rip),%rdi
  mov    %r13,%rcx
  xor    %eax,%eax
  mov    %r12,%rdx
  call   <printf@plt>
  xor    %edi,%edi
  call   <exit@plt>
L71:
  lea    D62(%rip),%rdx
  mov    %r12,%rsi
  lea    D88(%rip),%rdi
  xor    %eax,%eax
  call   <stderr3@plt>
  jmp    L182
L206:
  mov    0x10(%rbx),%rsi
  lea    D48(%rip),%rdx
  lea    D89(%rip),%rdi
  xor    %eax,%eax
  call   <stderr3@plt>
  jmp    L89
L69:
  mov    0x10(%rbx),%rsi
  lea    D48(%rip),%rdx
  lea    D87(%rip),%rdi
  xor    %eax,%eax
  call   <stderr3@plt>
  jmp    L19
L154:
  add    %rbp,%rax
  mov    $0x10000,%edx
  cmp    %rdx,%rax
  cmovge %rax,%rdx
  sub    $0x10000,%rdx
  sub    %rdx,%rbp
  sub    %rdx,%rax
  mov    %rbp,%r13
  jmp    L128
```

tool_calls: name: disassemble_data
arguments: data_tag: D57
datatype: string
name: disassemble_data
arguments: data_tag: D88
datatype: string
name: disassemble_data
arguments: data_tag: D100
datatype: string
name: disassemble_data
arguments: data_tag: D0
datatype: string
name: disassemble_data
arguments: data_tag: D62
datatype: string
name: disassemble_data
arguments: data_tag: D48
datatype: string
name: disassemble_data
arguments: data_tag: D89
datatype: string
name: disassemble_data
arguments: data_tag: D87
datatype: string

tool: D57: bad header


tool: D88: chmem: 

tool: D100:  not executable


tool: D0: %s: Stack+malloc area changed from %D to %D bytes.


tool: D62:  too large


tool: D48: 


tool: D89: chmem: can't open 

tool: D87: chmem: can't modify 

assistant: ```c
main(argc, argv) int argc;
char *argv[];
{
  char *p;
  unsigned int n;
  int fd, separate;
  long lsize, olddynam, newdynam, newtot, overflow, header[8];
  p = argv[1];
  if (argc != 3)
    usage();
  if (*p != '=' && *p != '+' && *p != '-')
    usage();
  n = atoi(p + 1);
  lsize = n;
  if (n > 65520)
    stderr3("chmem: ", p + 1, " too large\n");
  fd = open(argv[2], 2);
  if (fd < 0)
    stderr3("chmem: can't open ", argv[2], "\n");
  if (read(fd, header, sizeof(header)) != sizeof(header))
    stderr3("chmem: ", argv[2], "bad header\n");
  if ((header[0] & 0xFFFF) != 0x0301)
    stderr3("chmem: ", argv[2], " not executable\n");
  separate = (header[0] & 0x00200000 ? 1 : 0);
  olddynam = header[6] - header[3] - header[4];
  if (separate == 0)
    olddynam -= header[2];
  if (*p == '=')
    newdynam = lsize;
  else if (*p == '+')
    newdynam = olddynam + lsize;
  else if (*p == '-')
    newdynam = olddynam - lsize;
  newtot = header[3] + header[4] + newdynam;
  overflow = (newtot > 65536L ? newtot - 65536L : 0);
  newdynam -= overflow;
  newtot -= overflow;
  if (separate == 0)
    newtot += header[2];
  lseek(fd, (long)24, 0);
  if (write(fd, &newtot, 4) < 0)
    stderr3("chmem: can't modify ", argv[2], "\n");
  printf("%s: Stack+malloc area changed from %D to %D bytes.\n", argv[2], olddynam, newdynam);
  exit(0);
}
```