user: 请将以下的汇编代码转换成C语言代码:

```asm
<trimid_gbk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x1,-0x10(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L130
L41:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1f,%al
  jg     L90
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L8
L90:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L133
  cmpl   $0x1,-0x10(%rbp)
  je     L80
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  addl   $0x1,-0x8(%rbp)
  movl   $0x1,-0x10(%rbp)
  jmp    L86
L133:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  js     L10
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L86
L10:
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x4(%rbp)
  jle    L109
  cmpl   $0x1,-0x24(%rbp)
  jne    L87
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa1,%al
  jne    L87
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa1,%al
  jne    L87
  cmpl   $0x1,-0x10(%rbp)
  jne    L138
  addl   $0x1,-0xc(%rbp)
  jmp    L86
L138:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  addl   $0x1,-0x8(%rbp)
  movl   $0x1,-0x10(%rbp)
  addl   $0x1,-0xc(%rbp)
  jmp    L86
L87:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  addl   $0x1,-0xc(%rbp)
  jmp    L86
L8:
  nop
  jmp    L86
L80:
  nop
L86:
  addl   $0x1,-0xc(%rbp)
L130:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L41
  jmp    L178
L109:
  nop
L178:
  mov    -0x8(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L182
  mov    -0x8(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%eax
  sub    $0x1,%eax
  jmp    L147
L182:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%eax
L147:
  leave
  ret
```

assistant: ```c
int trimid_gbk(const char *in, char *out, int trans) {
  int flag;
  int i, pos, inlen;
  flag = 1;
  pos = 0;
  inlen = strlen(in);
  for (i = 0; i < inlen; i++) {
    if (*(in + i) < ' ' && *(in + i) >= 0)
      continue;
    if (*(in + i) == ' ') {
      if (flag == 1)
        continue;
      *(out + pos) = ' ';
      pos++;
      flag = 1;
      continue;
    }
    if (*((unsigned char *)(in + i)) < 0x80) {
      *(out + pos) = *(in + i);
      pos++;
      flag = 0;
      continue;
    } else {
      if (i + 1 < inlen) {
        if (trans == 1 && *(in + i) == '\xa1' && *(in + i + 1) == '\xa1') {
          if (flag == 1) {
            i++;
            continue;
          } else {
            *(out + pos) = ' ';
            pos++;
            flag = 1;
            i++;
            continue;
          }
        } else {
          *(out + pos) = *(in + i);
          pos++;
          *(out + pos) = *(in + i + 1);
          pos++;
          flag = 0;
          i++;
          continue;
        }
      } else {
        break;
      }
    }
  }
  if (*(out + pos - 1) == ' ') {
    *(out + pos - 1) = 0;
    return (pos - 1);
  } else {
    *(out + pos) = 0;
    return pos;
  }
}
```