// File: /workspace/github_c_makefile_star2_O0/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_http_create_digest_auth_header
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) mg_time());
  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);
  mg_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);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq 0x10(%rbp), %rax
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
movq %r9, -0x50(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x138(%rbp)
callq 0xb6e0
movq -0x138(%rbp), %rdi
cvttsd2si %xmm0, %rax
movl %eax, %ecx
movl $0x28, %esi
leaq 0xc9aa(%rip), %rdx      # 0x1fd05
movb $0x0, %al
callq 0x31f0
leaq -0x80(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x50(%rbp), %rdi
callq 0x3180
movq %rax, -0x120(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3180
movq %rax, %rbx
movq 0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq 0x10(%rbp), %rdi
callq 0x3180
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
movq -0x118(%rbp), %r9
movq -0x110(%rbp), %r10
leaq 0xc023(%rip), %r11      # 0x1f400
movl $0x1, %r8d
xorl %ecx, %ecx
movq %r11, %rcx
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq $0x1, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, %al
callq 0x13100
movq -0x38(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x38(%rbp), %rdi
callq 0x3180
movq %rax, -0x100(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x40(%rbp), %rdi
callq 0x3180
movq %rax, -0xf0(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %r12
leaq -0xe0(%rbp), %rdi
callq 0x3180
movq %rax, %r15
leaq -0xe0(%rbp), %rbx
leaq -0xe0(%rbp), %rdi
callq 0x3180
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movq -0xf0(%rbp), %rcx
movq -0xe8(%rbp), %r8
movq %rax, %r11
leaq -0xb0(%rbp), %rax
movl $0x20, %r9d
leaq 0xd388(%rip), %r14      # 0x20840
leaq 0xbf43(%rip), %r10      # 0x1f402
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq $0x4, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x13560
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x40(%rbp), %r9
leaq -0xe0(%rbp), %r11
leaq -0xe0(%rbp), %r10
leaq -0xb0(%rbp), %rax
leaq 0xc7e0(%rip), %rdx      # 0x1fd08
leaq 0xbed3(%rip), %rbx      # 0x1f402
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x31f0
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)