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

```asm
<licenseKeyFormatting>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L110
L115:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L44
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
L44:
  addl   $0x1,-0x2c(%rbp)
L110:
  mov    -0x2c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L115
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x28(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  je     L158
  movl   $0x0,-0x2c(%rbp)
  jmp    L130
L6:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    %ecx,-0x28(%rbp)
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    %edx,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  addl   $0x1,-0x2c(%rbp)
L130:
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %edx,%eax
  cmp    %eax,-0x2c(%rbp)
  jl     L6
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L17
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
  jmp    L17
L67:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    %ecx,-0x28(%rbp)
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    %edx,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %ecx,%eax
  sub    %edx,%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L29
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L29
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
L29:
  addl   $0x1,-0x2c(%rbp)
L17:
  mov    -0x2c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L67
  jmp    L95
L158:
  movl   $0x0,-0x2c(%rbp)
  jmp    L76
L98:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    %ecx,-0x28(%rbp)
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    %edx,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L56
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L56
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
L56:
  addl   $0x1,-0x2c(%rbp)
L76:
  mov    -0x2c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L98
L95:
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
char *licenseKeyFormatting(char *S, int K) {
  int len = strlen(S);
  int i, j;
  char *C, *ret;
  C = (char *)malloc(sizeof(char) * (len + 1));
  for (i = 0, j = 0; i < len; i++) {
    if (S[i] != '-') {
      C[j++] = S[i];
    }
  }
  C[j] = '\0';
  len = j;
  ret = (char *)malloc(sizeof(char) * (j + j / K + 1));
  j = 0;
  if (len % K) {
    for (i = 0; i < len % K; i++) {
      ret[j++] = toupper(C[i]);
    }
    if (C[i]) {
      ret[j++] = '-';
    }
    for (; i < len; i++) {
      ret[j++] = toupper(C[i]);
      if ((i + 1 - len % K) % K == 0 && C[i + 1]) {
        ret[j++] = '-';
      }
    }
  } else {
    for (i = 0; i < len; i++) {
      ret[j++] = toupper(C[i]);
      if ((i + 1) % K == 0 && C[i + 1]) {
        ret[j++] = '-';
      }
    }
  }
  ret[j] = '\0';
  return ret;
}
```