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

```asm
<sshbuf_put_bignum2_bytes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  cmpq   $0x7fffffb,-0x38(%rbp)
  jbe    L19
  mov    $0xfffffff7,%eax
  jmp    L86
L112:
  subq   $0x1,-0x38(%rbp)
  addq   $0x8,-0x10(%rbp)
L19:
  cmpq   $0x0,-0x38(%rbp)
  je     L27
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L112
L27:
  cmpq   $0x0,-0x38(%rbp)
  je     L75
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  and    $0x80,%eax
  test   %rax,%rax
  je     L75
  mov    $0x1,%eax
  jmp    L92
L75:
  mov    $0x0,%eax
L92:
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  lea    0x4(%rax),%rcx
  lea    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sshbuf_reserve@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jns    L90
  mov    -0x1c(%rbp),%eax
  jmp    L86
L90:
  mov    -0x38(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  shr    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movslq %edx,%rdx
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  sar    $0x10,%eax
  cltq
  mov    -0x18(%rbp),%rdx
  add    $0x8,%rdx
  movzbl %al,%eax
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  sar    $0x8,%eax
  cltq
  mov    -0x18(%rbp),%rdx
  add    $0x10,%rdx
  movzbl %al,%eax
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  cltq
  mov    -0x18(%rbp),%rdx
  add    $0x18,%rdx
  movzbl %al,%eax
  mov    %rax,(%rdx)
  cmpl   $0x0,-0x20(%rbp)
  je     L116
  mov    -0x18(%rbp),%rax
  add    $0x20,%rax
  movq   $0x0,(%rax)
L116:
  cmpq   $0x0,-0x38(%rbp)
  je     L43
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x4,%rax
  shl    $0x3,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
L43:
  mov    $0x0,%eax
L86:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L29
  call   <__stack_chk_fail@plt>
L29:
  leave
  ret
```

assistant: ```c
int sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len) {
  u_char *d;
  const u_char *s = (const u_char *)v;
  int r, prepend;
  if (len > 0x8000000 - 5) {
    ;
    return -9;
  }
  for (; len > 0 && *s == 0; len--, s++)
    ;
  prepend = len > 0 && (s[0] & 0x80) != 0;
  if ((r = sshbuf_reserve(buf, len + 4 + prepend, &d)) < 0)
    return r;
  do {
    ((u_char *)(d))[0] = (((u_int64_t)(len + prepend)) >> 24) & 0xff;
    ((u_char *)(d))[1] = (((u_int64_t)(len + prepend)) >> 16) & 0xff;
    ((u_char *)(d))[2] = (((u_int64_t)(len + prepend)) >> 8) & 0xff;
    ((u_char *)(d))[3] = ((u_int64_t)(len + prepend)) & 0xff;
  } while (0);
  if (prepend)
    d[4] = 0;
  if (len != 0)
    memcpy(d + 4 + prepend, s, len);
  return 0;
}
```