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

```asm
<remove_trailing_zeros>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L254
L139:
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L146
L33:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L137
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L101
L137:
  cmpl   $0x0,-0x8(%rbp)
  je     L34
  mov    -0x1c(%rbp),%eax
  sub    -0x8(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L142
  addl   $0x1,-0x8(%rbp)
L142:
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L45
L215:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%eax
  sub    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x18(%rbp)
L45:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jge    L215
  movl   $0x1,-0x4(%rbp)
  jmp    L254
L34:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L118
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L118
L101:
  movl   $0x1,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jle    L118
  movl   $0x0,-0x8(%rbp)
L118:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L223
  cmpl   $0x0,-0x10(%rbp)
  je     L223
  movl   $0x1,-0xc(%rbp)
L223:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L24
  cmpl   $0x0,-0xc(%rbp)
  je     L24
  addl   $0x1,-0x8(%rbp)
L24:
  addl   $0x1,-0x1c(%rbp)
L146:
  mov    -0x1c(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L33
L254:
  cmpl   $0x0,-0x4(%rbp)
  jne    L139
  cmpl   $0x0,-0x8(%rbp)
  je     L156
  mov    -0x1c(%rbp),%eax
  sub    -0x8(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L234
  addl   $0x1,-0x8(%rbp)
L234:
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L247
L66:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%eax
  sub    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x18(%rbp)
L247:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jge    L66
L156:
  cmpl   $0x1,-0x14(%rbp)
  jle    L199
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x2(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L199
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L199
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L199
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L199:
  nop
  leave
  ret
```

assistant: ```c
void remove_trailing_zeros(char *str) {
  int i, j, len, numberfound, dotfound, decimalzerofound, trailingzerofound = 1;
  while (trailingzerofound) {
    numberfound = 0;
    dotfound = 0;
    decimalzerofound = 0;
    trailingzerofound = 0;
    len = strlen(str);
    for (i = 0; i < len; i++) {
      if ((str[i] < '0') || (str[i] > '9')) {
        if (decimalzerofound) {
          if (str[i - decimalzerofound - 1] == '.') {
            decimalzerofound++;
          }
          for (j = i; j < (len + 1); j++) {
            str[j - decimalzerofound] = str[j];
          }
          trailingzerofound = 1;
          break;
        }
        if (str[i] != '.') {
          numberfound = 0;
          dotfound = 0;
          decimalzerofound = 0;
        }
      } else {
        numberfound = 1;
        if (str[i] > '0') {
          decimalzerofound = 0;
        }
      }
      if ((str[i] == '.') && numberfound) {
        dotfound = 1;
      }
      if ((str[i] == '0') && dotfound) {
        decimalzerofound++;
      }
    }
  }
  if (decimalzerofound) {
    if (str[i - decimalzerofound - 1] == '.') {
      decimalzerofound++;
    }
    for (j = i; j < (len + 1); j++) {
      str[j - decimalzerofound] = str[j];
    }
  }
  if (len > 1) {
    if (!((str[len - 2] < '0') || (str[i] > '9'))) {
      if (str[len - 1] == '.') {
        str[len - 1] = 0;
      }
    }
  }
}
```