user: Converte this assembly snippet into its equivalent C code:

```asm
<mg_http_create_digest_auth_header>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %r9,%r12
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %rdi,(%rsp)
  xor    %edi,%edi
  lea    0x90(%rsp),%rbx
  mov    0x100(%rsp),%r15
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  call   <time@plt>
  lea    D49(%rip),%rdx
  mov    $0x28,%esi
  mov    %rbx,%rdi
  mov    %eax,%ecx
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rax,0x18(%rsp)
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rax,0x10(%rsp)
  call   <strlen@plt>
  lea    0x30(%rsp),%r10
  push   $0x0
  mov    0x20(%rsp),%rsi
  lea    D5(%rip),%rcx
  mov    %r10,%rdi
  mov    %rax,%rdx
  mov    %rbp,%r9
  push   %rsi
  mov    %r12,%rsi
  push   %r15
  lea    D7(%rip),%r15
  push   $0x1
  push   %rcx
  mov    0x38(%rsp),%r8
  push   %r8
  mov    $0x1,%r8d
  mov    %r10,0x58(%rsp)
  call   <cs_md5@plt>
  add    $0x30,%rsp
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %rax,0x20(%rsp)
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    %rax,0x18(%rsp)
  call   <strlen@plt>
  sub    $0x8,%rsp
  mov    $0x20,%r9d
  mov    %r14,%rdi
  lea    0x68(%rsp),%r11
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  push   %r11
  mov    %r11,0x20(%rsp)
  push   $0x4
  push   %r15
  mov    0x40(%rsp),%rdx
  push   %rdx
  push   %rbx
  push   $0x1
  push   %rax
  push   %rdx
  mov    %r13,%rdx
  push   %rbx
  mov    0x78(%rsp),%r8
  mov    0x68(%rsp),%rcx
  call   <mkmd5resp@plt>
  mov    0x60(%rsp),%r11
  add    $0x50,%rsp
  xor    %eax,%eax
  mov    %r13,%r9
  mov    %rbp,%r8
  lea    D44(%rip),%rdx
  mov    %r12,%rcx
  push   %r11
  push   %rbx
  push   %rbx
  push   %r15
  mov    0x28(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  call   <snprintf@plt>
  add    $0x20,%rsp
  mov    0xb8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D49
type_infered: string
name: disassemble_data
arguments: data_tag: D5
type_infered: string
name: disassemble_data
arguments: data_tag: D7
type_infered: string
name: disassemble_data
arguments: data_tag: D14
type_infered: string
name: disassemble_data
arguments: data_tag: D44
type_infered: string

tool: D49: %x

tool: D5: :

tool: D7: auth

tool: D14: 1

tool: D44: Authorization: Digest username="%s",realm="%s",uri="%s",qop=%s,nc=1,cnonce=%s,nonce=%s,response=%s


assistant: ```c
int mg_http_create_digest_auth_header(char *buf, size_t buf_len, const char *method, const char *uri, const char *auth_domain, const char *user, const char *passwd) {
  static const char colon[] = ":", qop[] = "auth";
  static const size_t one = 1;
  char ha1[33], resp[33], cnonce[40];
  snprintf(cnonce, sizeof(cnonce), "%x", (unsigned int)time(NULL));
  cs_md5(ha1, user, (size_t)strlen(user), colon, one, auth_domain, (size_t)strlen(auth_domain), colon, one, passwd, (size_t)strlen(passwd), NULL);
  mkmd5resp(method, strlen(method), uri, strlen(uri), ha1, sizeof(ha1) - 1, cnonce, strlen(cnonce), "1", one, cnonce, strlen(cnonce), qop, sizeof(qop) - 1, resp);
  return snprintf(buf, buf_len,
                  "Authorization: Digest username=\"%s\","
                  "realm=\"%s\",uri=\"%s\",qop=%s,nc=1,cnonce=%s,"
                  "nonce=%s,response=%s\r\n",
                  user, auth_domain, uri, qop, cnonce, cnonce, resp);
}
```