// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
addq $0x8, %rdi
leaq 0x2082(%rip), %rsi      # 0x161af
callq 0xe5cf
testq %rax, %rax
je 0x14152
movq %rax, %rbx
leaq 0x207c(%rip), %rsi      # 0x161bd
movl $0x7, %edx
movq %rax, %rdi
callq 0xea9f
testl %eax, %eax
je 0x14168
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x24b8, %rsp           # imm = 0x24B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x8(%rsp)
movb 0x7(%rbx), %cl
leaq 0x4b0(%rsp), %r14
movq %r14, %rax
testb %cl, %cl
je 0x141ab
addq $0x8, %rbx
leaq 0x4b0(%rsp), %rax
movl $0x1fff, %edx           # imm = 0x1FFF
movb %cl, (%rax)
incq %rax
movb (%rbx), %cl
testb %cl, %cl
je 0x141ab
leaq -0x1(%rdx), %rsi
incq %rbx
cmpq $0x1, %rdx
movq %rsi, %rdx
ja 0x14190
movb $0x0, (%rax)
xorl %eax, %eax
leaq 0x48(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x40(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x30(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x28(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x20(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x18(%rsp), %rcx
movq %rax, (%rcx)
callq 0x5520
movq %rax, %r15
leaq 0x10d1(%rip), %r13      # 0x152c8
leaq 0xb0(%rsp), %rbp
movq (%r15), %rax
decq %r14
movzbl 0x1(%r14), %ecx
incq %r14
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x14205
movq %r14, 0xb0(%rsp)
movq %rbp, %rdi
leaq 0x1f9f(%rip), %rsi      # 0x161c5
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x12675
movq %rax, %rbx
movq 0xb0(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x1427f
incq %rax
movq %rax, 0xb0(%rsp)
movq %rbp, %rdi
leaq 0x104d(%rip), %rsi      # 0x152a2
movq %r13, %rdx
movl $0x5c, %ecx
callq 0x12675
movq %rax, %r14
movq 0xb0(%rsp), %rax
cmpb $0x2c, (%rax)
jne 0x14296
incq %rax
movq %rax, 0xb0(%rsp)
jmp 0x14296
movq %rbp, %rdi
leaq 0x103e(%rip), %rsi      # 0x152c7
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x12675
movq %rax, %r14
movb (%rbx), %r12b
testb %r12b, %r12b
je 0x1435d
movq %rbx, %rdi
leaq 0x1f1b(%rip), %rsi      # 0x161c7
callq 0x56b0
leaq 0x48(%rsp), %rcx
testl %eax, %eax
je 0x1434d
movq %rbx, %rdi
leaq 0x1f08(%rip), %rsi      # 0x161d0
callq 0x56b0
leaq 0x38(%rsp), %rcx
testl %eax, %eax
je 0x1434d
movq %rbx, %rdi
leaq 0x1ef7(%rip), %rsi      # 0x161d7
callq 0x56b0
leaq 0x30(%rsp), %rcx
testl %eax, %eax
je 0x1434d
movq %rbx, %rdi
leaq 0x1559(%rip), %rsi      # 0x15851
callq 0x56b0
leaq 0x40(%rsp), %rcx
testl %eax, %eax
je 0x1434d
movq %rbx, %rdi
leaq 0x1ed0(%rip), %rsi      # 0x161e0
callq 0x56b0
leaq 0x28(%rsp), %rcx
testl %eax, %eax
je 0x1434d
cmpb $0x6e, %r12b
jne 0x14335
cmpb $0x63, 0x1(%rbx)
jne 0x14335
cmpb $0x0, 0x2(%rbx)
leaq 0x20(%rsp), %rcx
je 0x1434d
movq %rbx, %rdi
leaq 0x1e92(%rip), %rsi      # 0x161d1
callq 0x56b0
leaq 0x18(%rsp), %rcx
testl %eax, %eax
jne 0x14350
movq %r14, (%rcx)
movq 0xb0(%rsp), %r14
jmp 0x141ff
movq 0x48(%rsp), %rbx
testq %rbx, %rbx
movq 0x8(%rsp), %r14
je 0x14152
movq %rbx, %rdi
callq 0xfd09
movq %rax, 0x30(%r14)
leaq 0xb0(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x10(%rsp), %rdx
callq 0x5840
testq %rax, %rax
je 0x14152
leaq 0x1dfd(%rip), %r14      # 0x161a0
leaq 0xb0(%rsp), %r15
leaq 0x3b0(%rsp), %r12
leaq 0x2b0(%rsp), %r13
leaq 0x1b0(%rsp), %rbp
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x5490
cmpl $0x3, %eax
jne 0x14409
movq %rbx, %rdi
movq %r12, %rsi
callq 0x56b0
testl %eax, %eax
jne 0x14409
movq 0x8(%rsp), %rax
movq 0x458(%rax), %rax
movq 0x38(%rax), %rdi
movq %r13, %rsi
callq 0x56b0
testl %eax, %eax
je 0x14425
movq %r15, %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x10(%rsp), %rdx
callq 0x5840
testq %rax, %rax
jne 0x143c3
jmp 0x14152
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r12
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %r14
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %rbx
movq %r15, %xmm0
movq %r12, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %rsi, %xmm0
movq %r14, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
pxor %xmm0, %xmm0
testq %r13, %r13
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 %ebp, %ebp
orb %dl, %cl
jne 0x14154
movq %rsi, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x5210
cmpq $0x20, %rax
jne 0x14154
leaq 0xe10(%rip), %rdx       # 0x152d6
xorl %ebp, %ebp
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
movq %rdx, %r12
movq 0x8(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xed54
subq $0x8, %rsp
leaq 0x58(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %r12, %r8
movq %r14, %r9
xorl %eax, %eax
pushq $0x0
leaq 0x90(%rsp), %r10
pushq %r10
pushq %r12
pushq %r13
pushq %r12
pushq 0x40(%rsp)
pushq %r12
callq 0xed54
addq $0x40, %rsp
callq 0x50e0
movq (%rax), %rax
movzbl (%rbx,%rbp), %esi
movl (%rax,%rsi,4), %ecx
movzbl 0x50(%rsp,%rbp), %edx
movl (%rax,%rdx,4), %edx
testl %esi, %esi
je 0x14547
incq %rbp
cmpl %edx, %ecx
je 0x1452d
xorl %ebp, %ebp
cmpl %edx, %ecx
sete %bpl
jmp 0x14154