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

```asm
<cmd_mvchgat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x24(%rbp),%eax
  mov    $0x6,%esi
  mov    %eax,%edi
  call   <check_arg_count@plt>
  cmp    $0x1,%eax
  je     L40
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  lea    -0x18(%rbp),%rdx
  lea    D73(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  jne    L34
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L85
L34:
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    -0x14(%rbp),%rdx
  lea    D73(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  jne    L9
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L85
L9:
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  lea    -0x10(%rbp),%rdx
  lea    D73(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  jne    L98
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L85
L98:
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  lea    -0xc(%rbp),%rdx
  lea    D73(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  jne    L94
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L85
L94:
  mov    -0x30(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rax
  lea    -0x1a(%rbp),%rdx
  lea    D30(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  jne    L44
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L85
L44:
  mov    $0x1,%edi
  call   <report_count@plt>
  movzwl -0x1a(%rbp),%eax
  movswl %ax,%edi
  mov    -0xc(%rbp),%ecx
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%esi
  mov    -0x18(%rbp),%eax
  mov    $0x0,%r9d
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <mvchgat@plt>
  mov    %eax,%edi
  call   <report_return@plt>
  jmp    L85
L40:
  nop
L85:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L90
  call   <__stack_chk_fail@plt>
L90:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D73
type: string
name: read_data
arguments: label: D26
type: string
name: read_data
arguments: label: D30
type: string

tool: D73: %d

tool: D26: BAD ARGUMENT

tool: D30: %hd

assistant: ```c
void cmd_mvchgat(int nargs, char **args) {
  int y, x, n, attr;
  short colour;
  if (check_arg_count(nargs, 6) == 1)
    return;
  if (sscanf(args[0], "%d", &y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[1], "%d", &x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[2], "%d", &n) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[3], "%d", &attr) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[4], "%hd", &colour) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(mvchgat(y, x, n, attr, colour, NULL));
}
```