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

```asm
<checkCmdValidAndGetTotalLen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  cmpl   $0x5,-0x24(%rbp)
  ja     L595
  mov    -0x24(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D25(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D25(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  cmpl   $0x6,-0x2c(%rbp)
  je     L612
  cmpl   $0x7,-0x2c(%rbp)
  je     L612
  mov    $0xffffffff,%eax
  jmp    L608
L612:
  cmpl   $0x7,-0x2c(%rbp)
  jne    L604
  cmpl   $0x0,-0x28(%rbp)
  jne    L451
  mov    -0x38(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  cmp    $0x7,%rax
  jne    L705
  jmp    L837
L451:
  cmpq   $0x0,-0x40(%rbp)
  jne    L394
  mov    -0x38(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x7,%rax
  jne    L705
  jmp    L837
L394:
  mov    -0x40(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rax
  cmp    $0x7,%rax
  jne    L705
L837:
  mov    -0x38(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rax
  mov    $0x7,%edx
  lea    D47(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L604
L705:
  mov    $0xffffffff,%eax
  jmp    L608
L604:
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L371
L90:
  cmpl   $0x0,-0x28(%rbp)
  jne    L573
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x1,%rax
  jmp    L266
L573:
  cmpq   $0x0,-0x40(%rbp)
  jne    L171
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  jmp    L266
L171:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x1,%rax
L266:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  addl   $0x1,-0x14(%rbp)
L371:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L90
  cmpl   $0x0,-0x28(%rbp)
  jne    L441
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x4,%rax
  jmp    L764
L441:
  cmpq   $0x0,-0x40(%rbp)
  jne    L249
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x4,%rax
  jmp    L764
L249:
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x4,%rax
L764:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L596
  cmpl   $0x7,-0x2c(%rbp)
  je     L118
  cmpl   $0x8,-0x2c(%rbp)
  je     L118
  mov    $0xffffffff,%eax
  jmp    L608
L118:
  cmpl   $0x8,-0x2c(%rbp)
  jne    L955
  cmpl   $0x0,-0x28(%rbp)
  jne    L44
  mov    -0x38(%rbp),%rax
  add    $0x30,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  cmp    $0x7,%rax
  jne    L150
  jmp    L219
L44:
  cmpq   $0x0,-0x40(%rbp)
  jne    L564
  mov    -0x38(%rbp),%rax
  add    $0x30,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x7,%rax
  jne    L150
  jmp    L219
L564:
  mov    -0x40(%rbp),%rax
  add    $0x30,%rax
  mov    (%rax),%rax
  cmp    $0x7,%rax
  jne    L150
L219:
  mov    -0x38(%rbp),%rax
  add    $0x30,%rax
  mov    (%rax),%rax
  mov    $0x7,%edx
  lea    D47(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L955
L150:
  mov    $0xffffffff,%eax
  jmp    L608
L955:
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L891
L634:
  cmpl   $0x0,-0x28(%rbp)
  jne    L647
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x1,%rax
  jmp    L345
L647:
  cmpq   $0x0,-0x40(%rbp)
  jne    L163
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  jmp    L345
L163:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x1,%rax
L345:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  addl   $0x1,-0x14(%rbp)
L891:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L634
  cmpl   $0x0,-0x28(%rbp)
  jne    L679
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x4,%rax
  jmp    L550
L679:
  cmpq   $0x0,-0x40(%rbp)
  jne    L375
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x4,%rax
  jmp    L550
L375:
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x4,%rax
L550:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L596
  cmpl   $0x3,-0x2c(%rbp)
  je     L324
  mov    $0xffffffff,%eax
  jmp    L608
L324:
  cmpl   $0x0,-0x28(%rbp)
  jne    L946
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  lea    0x1(%rax),%ebx
  jmp    L334
L946:
  cmpq   $0x0,-0x40(%rbp)
  jne    L140
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%ebx
  jmp    L334
L140:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%ebx
L334:
  cmpl   $0x0,-0x28(%rbp)
  jne    L433
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  jmp    L722
L433:
  cmpq   $0x0,-0x40(%rbp)
  jne    L505
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L722
L505:
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
L722:
  add    %eax,%ebx
  cmpl   $0x0,-0x28(%rbp)
  jne    L695
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  jmp    L304
L695:
  cmpq   $0x0,-0x40(%rbp)
  jne    L185
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L304
L185:
  mov    -0x40(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
L304:
  add    %ebx,%eax
  add    $0x3,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L596
  cmpl   $0x1,-0x2c(%rbp)
  jg     L404
  mov    $0xffffffff,%eax
  jmp    L608
L404:
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L889
L378:
  cmpl   $0x0,-0x28(%rbp)
  jne    L566
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x1,%rax
  jmp    L664
L566:
  cmpq   $0x0,-0x40(%rbp)
  jne    L494
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  jmp    L664
L494:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x1,%rax
L664:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  addl   $0x1,-0x14(%rbp)
L889:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L378
  cmpl   $0x0,-0x28(%rbp)
  jne    L584
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x2,%rax
  jmp    L498
L584:
  cmpq   $0x0,-0x40(%rbp)
  jne    L42
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x2,%rax
  jmp    L498
L42:
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x2,%rax
L498:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L596
  cmpl   $0x2,-0x2c(%rbp)
  je     L111
  cmpl   $0x3,-0x2c(%rbp)
  je     L111
  mov    $0xffffffff,%eax
  jmp    L608
L111:
  cmpl   $0x0,-0x28(%rbp)
  jne    L865
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  lea    0x1(%rax),%ebx
  jmp    L788
L865:
  cmpq   $0x0,-0x40(%rbp)
  jne    L173
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%ebx
  jmp    L788
L173:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%ebx
L788:
  cmpl   $0x0,-0x28(%rbp)
  jne    L414
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  jmp    L250
L414:
  cmpq   $0x0,-0x40(%rbp)
  jne    L803
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L250
L803:
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
L250:
  add    %ebx,%eax
  mov    %eax,-0x18(%rbp)
  cmpl   $0x3,-0x2c(%rbp)
  jne    L27
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    $0x7,%edx
  lea    D47(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L753
  mov    $0xffffffff,%eax
  jmp    L608
L753:
  cmpl   $0x0,-0x28(%rbp)
  jne    L737
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <sdslen@plt>
  add    $0x1,%rax
  jmp    L20
L737:
  cmpq   $0x0,-0x40(%rbp)
  jne    L493
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  jmp    L20
L493:
  mov    -0x40(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  add    $0x1,%rax
L20:
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
L27:
  addl   $0x2,-0x18(%rbp)
  jmp    L596
L595:
  movl   $0xffffffff,-0x18(%rbp)
  nop
L596:
  mov    -0x18(%rbp),%eax
L608:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D47
type_guessed: string

tool: D47: noreply

assistant: ```c
int checkCmdValidAndGetTotalLen(int cmdtype, int argtype, int argc, char **argv, size_t *argvlen) {
  size_t len;
  int totlen, j;
  switch (cmdtype) {
  case 1:
    if (argc != 6 && argc != 7) {
      return -1;
    }
    if (argc == 7 && ((argtype == 0 ? sdslen(argv[5]) : (argvlen == NULL ? strlen(argv[5]) : argvlen[5])) != 7 || strncasecmp(argv[5], "noreply", 7))) {
      return -1;
    }
    totlen = 0;
    for (j = 0; j < argc - 1; j++) {
      totlen += (argtype == 0 ? sdslen(argv[j]) : (argvlen == NULL ? strlen(argv[j]) : argvlen[j])) + 1;
    }
    totlen += 2 + (argtype == 0 ? sdslen(argv[argc - 1]) : (argvlen == NULL ? strlen(argv[argc - 1]) : argvlen[argc - 1])) + 2;
    break;
  case 2:
    if (argc != 7 && argc != 8) {
      return -1;
    }
    if (argc == 8 && ((argtype == 0 ? sdslen(argv[6]) : (argvlen == NULL ? strlen(argv[6]) : argvlen[6])) != 7 || strncasecmp(argv[6], "noreply", 7))) {
      return -1;
    }
    totlen = 0;
    for (j = 0; j < argc - 1; j++) {
      totlen += (argtype == 0 ? sdslen(argv[j]) : (argvlen == NULL ? strlen(argv[j]) : argvlen[j])) + 1;
    }
    totlen += 2 + (argtype == 0 ? sdslen(argv[argc - 1]) : (argvlen == NULL ? strlen(argv[argc - 1]) : argvlen[argc - 1])) + 2;
    break;
  case 4:
    if (argc != 3) {
      return -1;
    }
    totlen = (argtype == 0 ? sdslen(argv[0]) : (argvlen == NULL ? strlen(argv[0]) : argvlen[0])) + 1 + (argtype == 0 ? sdslen(argv[1]) : (argvlen == NULL ? strlen(argv[1]) : argvlen[1])) + 1 + (argtype == 0 ? sdslen(argv[2]) : (argvlen == NULL ? strlen(argv[2]) : argvlen[2])) + 2;
    break;
  case 3:
    if (argc <= 1) {
      return -1;
    }
    totlen = 0;
    for (j = 0; j < argc - 1; j++) {
      totlen += (argtype == 0 ? sdslen(argv[j]) : (argvlen == NULL ? strlen(argv[j]) : argvlen[j])) + 1;
    }
    totlen += (argtype == 0 ? sdslen(argv[argc - 1]) : (argvlen == NULL ? strlen(argv[argc - 1]) : argvlen[argc - 1])) + 2;
    break;
  case 5:
    if (argc != 2 && argc != 3) {
      return -1;
    }
    totlen = (argtype == 0 ? sdslen(argv[0]) : (argvlen == NULL ? strlen(argv[0]) : argvlen[0])) + 1 + (argtype == 0 ? sdslen(argv[1]) : (argvlen == NULL ? strlen(argv[1]) : argvlen[1]));
    if (argc == 3) {
      if (strncasecmp(argv[2], "noreply", 7)) {
        return -1;
      }
      totlen += 1 + (argtype == 0 ? sdslen(argv[2]) : (argvlen == NULL ? strlen(argv[2]) : argvlen[2]));
    }
    totlen += 2;
    break;
  default:
    totlen = -1;
    break;
  }
  return totlen;
}
```