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

```asm
<capitalisepath>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  movb   $0x0,-0x24(%rbp)
  mov    D8(%rip),%rax
  movq   $0x0,(%rax)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L186
  mov    $0xffffffff,%eax
  jmp    L8
L186:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L112
L109:
  mov    -0x20(%rbp),%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x23(%rbp)
  cmpb   $0x2f,-0x23(%rbp)
  je     L114
  subl   $0x1,-0x20(%rbp)
L112:
  cmpl   $0x0,-0x20(%rbp)
  jne    L109
  jmp    L134
L114:
  nop
L134:
  movl   $0x0,-0x1c(%rbp)
  jmp    L69
L5:
  mov    -0x1c(%rbp),%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x22(%rbp)
  cmpb   $0x0,-0x22(%rbp)
  je     L43
  cmpl   $0x0,-0x1c(%rbp)
  jne    L153
  movzbl -0x22(%rbp),%eax
  mov    %al,-0x24(%rbp)
  cmpb   $0x2f,-0x24(%rbp)
  je     L92
  movzbl -0x22(%rbp),%eax
  mov    -0x40(%rbp),%rdx
  mov    (%rdx),%rcx
  mov    -0x1c(%rbp),%edx
  lea    (%rcx,%rdx,1),%rbx
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  jmp    L74
L92:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  add    %rax,%rdx
  movzbl -0x22(%rbp),%eax
  mov    %al,(%rdx)
  jmp    L74
L153:
  cmpb   $0x2f,-0x24(%rbp)
  je     L171
  cmpb   $0x20,-0x24(%rbp)
  jne    L31
L171:
  movzbl -0x22(%rbp),%eax
  mov    -0x40(%rbp),%rdx
  mov    (%rdx),%rcx
  mov    -0x1c(%rbp),%edx
  lea    (%rcx,%rdx,1),%rbx
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  jmp    L136
L31:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  add    %rax,%rdx
  movzbl -0x22(%rbp),%eax
  mov    %al,(%rdx)
L136:
  movzbl -0x22(%rbp),%eax
  mov    %al,-0x24(%rbp)
L74:
  addl   $0x1,-0x1c(%rbp)
L69:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jb     L5
  jmp    L197
L43:
  nop
  jmp    L197
L189:
  mov    -0x20(%rbp),%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x21(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  add    %rax,%rdx
  movzbl -0x21(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x20(%rbp)
L197:
  mov    -0x20(%rbp),%ebx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %rax,%rbx
  jb     L189
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rbx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %rbx,%rax
  movb   $0x0,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x18(%rbp)
  mov    D5(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x18(%rbp)
  jbe    L129
  mov    $0x0,%eax
  jmp    L8
L129:
  mov    -0x18(%rbp),%rax
L8:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int capitalisepath(const char *string, char **result) {
  unsigned char lastchar = 0;
  unsigned long len;
  errno = 0;
  if (!(*result = (char *)malloc(strlen(string) + 1))) {
    ;
    return -1;
  }
  unsigned int max;
  for (max = strlen(string) - 1; max > 0; --max) {
    unsigned char c = string[max];
    if (c == '/')
      break;
  }
  for (unsigned int n = 0; n < max; n++) {
    unsigned char c = string[n];
    if (0 == c)
      break;
    if (0 == n) {
      lastchar = c;
      if (lastchar != '/')
        (*result)[n] = toupper(c);
      else
        (*result)[n] = c;
    } else {
      if (lastchar == '/' || lastchar == ' ')
        (*result)[n] = toupper(c);
      else
        (*result)[n] = c;
      lastchar = c;
    }
  }
  for (; max < strlen(string); max++) {
    unsigned char c = string[max];
    (*result)[max] = c;
  }
  (*result)[strlen(string)] = '\0';
  len = strlen(*result);
  if (len > INT_MAX) {
    return 0;
  } else {
    return (int)len;
  }
}
```