// File: /workspace/github_cpp_makefile_star2_O2/nilnilnil[P]autocomplete/deps/mongoose/mongoose.c
// Function: authorize
static int authorize(struct mg_connection *conn, FILE *fp) {
  struct ah ah;
  char line[256], f_user[256], ha1[256], f_domain[256], buf[BUFSIZ];

  if (!parse_auth_header(conn, buf, sizeof(buf), &ah)) {
    return 0;
  }

  // Loop over passwords file
  while (fgets(line, sizeof(line), fp) != NULL) {
    if (sscanf(line, "%[^:]:%[^:]:%s", f_user, f_domain, ha1) != 3) {
      continue;
    }

    if (!strcmp(ah.user, f_user) &&
        !strcmp(conn->ctx->config[AUTHENTICATION_DOMAIN], f_domain))
      return check_password(
            conn->request_info.request_method,
            ha1, ah.uri, ah.nonce, ah.nc, ah.cnonce, ah.qop,
            ah.response);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x24b8, %rsp           # imm = 0x24B8
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
addq $0x8, %rdi
leaq 0x23e8(%rip), %rsi      # 0x131af
callq 0xb940
testq %rax, %rax
je 0x10dea
movq %rax, %r14
leaq 0x23e2(%rip), %rsi      # 0x131bd
pushq $0x7
popq %rdx
movq %rax, %rdi
callq 0xbdab
testl %eax, %eax
je 0x10e00
xorl %esi, %esi
movl %esi, %eax
addq $0x24b8, %rsp           # imm = 0x24B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x7, %r14
leaq 0x4b0(%rsp), %rbx
movl $0x2000, %edx           # imm = 0x2000
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc030
leaq 0x48(%rsp), %rax
andq $0x0, (%rax)
leaq 0x40(%rsp), %rax
andq $0x0, (%rax)
leaq 0x38(%rsp), %rax
andq $0x0, (%rax)
leaq 0x30(%rsp), %rax
andq $0x0, (%rax)
leaq 0x28(%rsp), %rax
andq $0x0, (%rax)
leaq 0x20(%rsp), %rax
andq $0x0, (%rax)
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
callq 0x5510
movq %rax, %r15
leaq 0x145e(%rip), %r13      # 0x122c8
leaq 0x80(%rsp), %rbp
movq (%r15), %rax
decq %rbx
movzbl 0x1(%rbx), %ecx
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x10e78
movq %rbx, 0x80(%rsp)
movq %rbp, %rdi
leaq 0x232d(%rip), %rsi      # 0x131c5
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x109ca
movq %rax, %r14
movq 0x80(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x10eef
incq %rax
movq %rax, 0x80(%rsp)
movq %rbp, %rdi
leaq 0x13db(%rip), %rsi      # 0x122a2
movq %r13, %rdx
pushq $0x5c
popq %rcx
callq 0x109ca
movq %rax, %rbx
movq 0x80(%rsp), %rax
cmpb $0x2c, (%rax)
jne 0x10f06
incq %rax
movq %rax, 0x80(%rsp)
jmp 0x10f06
movq %rbp, %rdi
leaq 0x13ce(%rip), %rsi      # 0x122c7
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x109ca
movq %rax, %rbx
movb (%r14), %r12b
testb %r12b, %r12b
je 0x10fcf
movq %r14, %rdi
leaq 0x22ab(%rip), %rsi      # 0x131c7
callq 0x56c0
leaq 0x48(%rsp), %rcx
testl %eax, %eax
je 0x10fbf
movq %r14, %rdi
leaq 0x2298(%rip), %rsi      # 0x131d0
callq 0x56c0
leaq 0x38(%rsp), %rcx
testl %eax, %eax
je 0x10fbf
movq %r14, %rdi
leaq 0x2287(%rip), %rsi      # 0x131d7
callq 0x56c0
leaq 0x30(%rsp), %rcx
testl %eax, %eax
je 0x10fbf
movq %r14, %rdi
leaq 0x18e9(%rip), %rsi      # 0x12851
callq 0x56c0
leaq 0x40(%rsp), %rcx
testl %eax, %eax
je 0x10fbf
movq %r14, %rdi
leaq 0x2260(%rip), %rsi      # 0x131e0
callq 0x56c0
leaq 0x28(%rsp), %rcx
testl %eax, %eax
je 0x10fbf
cmpb $0x6e, %r12b
jne 0x10fa7
cmpb $0x63, 0x1(%r14)
jne 0x10fa7
cmpb $0x0, 0x2(%r14)
leaq 0x20(%rsp), %rcx
je 0x10fbf
movq %r14, %rdi
leaq 0x2220(%rip), %rsi      # 0x131d1
callq 0x56c0
leaq 0x18(%rsp), %rcx
testl %eax, %eax
jne 0x10fc2
movq %rbx, (%rcx)
movq 0x80(%rsp), %rbx
jmp 0x10e72
movq 0x48(%rsp), %rbx
testq %rbx, %rbx
je 0x10dea
movq %rbx, %rdi
callq 0xcedd
movq 0x8(%rsp), %rcx
movq %rax, 0x30(%rcx)
leaq 0x80(%rsp), %r14
leaq 0x21a3(%rip), %r15      # 0x131a0
leaq 0x3b0(%rsp), %r12
leaq 0x2b0(%rsp), %r13
leaq 0x1b0(%rsp), %rbp
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x10(%rsp), %rdx
callq 0x5840
testq %rax, %rax
je 0x10dea
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x5470
cmpl $0x3, %eax
jne 0x11015
movq %rbx, %rdi
movq %r12, %rsi
callq 0x56c0
testl %eax, %eax
jne 0x11015
movq 0x8(%rsp), %rax
movq 0x458(%rax), %rax
movq 0x38(%rax), %rdi
movq %r13, %rsi
callq 0x56c0
testl %eax, %eax
jne 0x11015
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r12
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %r14
movq 0x38(%rsp), %r13
movq 0x28(%rsp), %rbp
movq 0x30(%rsp), %rbx
movq %r15, %xmm0
movq %r12, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %r13, %xmm0
movq %r14, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
pxor %xmm0, %xmm0
testq %rbp, %rbp
sete %al
testq %rbx, %rbx
sete %cl
pcmpeqd %xmm0, %xmm2
pcmpeqd %xmm0, %xmm1
movdqa %xmm1, %xmm0
shufps $0xdd, %xmm2, %xmm0     # xmm0 = xmm0[1,3],xmm2[1,3]
shufps $0x88, %xmm2, %xmm1     # xmm1 = xmm1[0,2],xmm2[0,2]
andps %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
setne %dl
orb %al, %cl
xorl %esi, %esi
orb %dl, %cl
jne 0x10dec
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x51e0
xorl %esi, %esi
cmpq $0x20, %rax
jne 0x10dec
leaq 0x11c2(%rip), %rdx      # 0x122d6
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xc04f
subq $0x8, %rsp
leaq 0x188(%rsp), %r12
leaq 0x1b8(%rsp), %rsi
movq %r12, %rdi
leaq 0x118d(%rip), %rdx      # 0x122d6
movq %r15, %rcx
movq %rdx, %r8
movq %r14, %r9
xorl %eax, %eax
pushq $0x0
leaq 0x60(%rsp), %r10
pushq %r10
pushq %rdx
pushq %rbp
pushq %rdx
pushq %r13
pushq %rdx
callq 0xc04f
addq $0x40, %rsp
movq %rbx, %rdi
movq %r12, %rsi
callq 0xd3cf
xorl %esi, %esi
testl %eax, %eax
sete %sil
jmp 0x10dec