user: 请从给定的汇编指令推导出C源代码：

```asm
<remove_trailing_zeros>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x0,%r12d
  mov    $0x1,%ebp
  jmp    L174
L96:
  mov    %eax,%edx
  sub    %ecx,%edx
  movslq %edx,%rdx
  cmpb   $0x2e,-0x1(%rbx,%rdx,1)
  je     L263
L167:
  cmp    %eax,%r8d
  jl     L174
  cltq
  movslq %ecx,%rcx
  mov    %rbx,%rsi
  sub    %rcx,%rsi
L82:
  movzbl (%rbx,%rax,1),%edx
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%r8d
  jge    L82
L174:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%r8d
  test   %eax,%eax
  jle    L152
  mov    %rbx,%rsi
  mov    $0x0,%ecx
  mov    $0x0,%r10d
  mov    %r12d,%r9d
  mov    $0x0,%eax
  jmp    L271
L263:
  add    $0x1,%ecx
  jmp    L167
L145:
  cmp    $0x30,%dl
  jg     L207
  test   %r10d,%r10d
  je     L24
  cmp    $0x30,%dl
  jne    L24
  add    $0x1,%ecx
  mov    %ebp,%r9d
  jmp    L261
L110:
  test   %r9d,%r9d
  cmovne %r9d,%r10d
  cmove  %r9d,%ecx
  jmp    L261
L223:
  add    $0x1,%ecx
  jmp    L19
L152:
  mov    $0x0,%eax
  jmp    L204
L41:
  movb   $0x0,(%rax)
  jmp    L132
L62:
  test   %ecx,%ecx
  je     L21
  mov    %r8d,%eax
  sub    %ecx,%eax
  cltq
  cmpb   $0x2e,-0x1(%rbx,%rax,1)
  je     L223
L19:
  movslq %r8d,%rax
  movslq %ecx,%rcx
  mov    %rbx,%rsi
  sub    %rcx,%rsi
L114:
  movzbl (%rbx,%rax,1),%edx
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%r8d
  jge    L114
  mov    %r8d,%eax
L204:
  cmp    $0x1,%r8d
  jle    L132
  movslq %r8d,%r8
  cmpb   $0x2f,-0x2(%rbx,%r8,1)
  jle    L132
  cltq
  cmpb   $0x39,(%rbx,%rax,1)
  jg     L132
  lea    -0x1(%rbx,%r8,1),%rax
  cmpb   $0x2e,(%rax)
  je     L41
L132:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L21:
  mov    %r8d,%eax
  jmp    L204
L24:
  mov    %ebp,%r9d
  jmp    L261
L207:
  mov    $0x1,%ecx
L32:
  mov    %ecx,%r9d
  mov    $0x0,%ecx
L261:
  add    $0x1,%eax
  add    $0x1,%rsi
  cmp    %eax,%r8d
  je     L62
L271:
  movzbl (%rsi),%edx
  lea    -0x30(%rdx),%edi
  cmp    $0x9,%dil
  jbe    L145
  test   %ecx,%ecx
  jne    L96
  cmp    $0x2e,%dl
  je     L110
  mov    %ecx,%r10d
  jmp    L32
```

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;
      }
    }
  }
}
```