// File: /workspace/github_cpp_makefile_star2_O1/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 $0x24a8, %rsp           # imm = 0x24A8
movq %rsi, 0x38(%rsp)
movq %rdi, 0x18(%rsp)
addq $0x8, %rdi
leaq 0x1ec8(%rip), %rsi      # 0x161af
callq 0xe677
movb $0x1, %r14b
testq %rax, %rax
je 0x14313
movq %rax, %rbx
leaq 0x1ebf(%rip), %rsi      # 0x161bd
movl $0x7, %edx
movq %rax, %rdi
callq 0xeb3c
testl %eax, %eax
je 0x143de
xorl %ebx, %ebx
testb %r14b, %r14b
jne 0x143ca
leaq 0xa0(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x38(%rsp), %rdx
callq 0x5840
testq %rax, %rax
je 0x143ca
leaq 0x1e5b(%rip), %rbx      # 0x161a0
leaq 0xa0(%rsp), %r14
leaq 0x3a0(%rsp), %r15
leaq 0x2a0(%rsp), %r12
leaq 0x1a0(%rsp), %r13
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x5490
cmpl $0x3, %eax
jne 0x143b1
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x56b0
testl %eax, %eax
jne 0x143b1
movq 0x18(%rsp), %rax
movq 0x458(%rax), %rax
movq 0x38(%rax), %rdi
movq %r12, %rsi
callq 0x56b0
testl %eax, %eax
je 0x1460f
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x38(%rsp), %rdx
callq 0x5840
testq %rax, %rax
jne 0x14365
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x24a8, %rsp           # imm = 0x24A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb 0x7(%rbx), %dl
leaq 0x4a0(%rsp), %rax
movq %rax, %rcx
testb %dl, %dl
je 0x1441c
addq $0x8, %rbx
leaq 0x4a0(%rsp), %rcx
movl $0x1fff, %esi           # imm = 0x1FFF
movb %dl, (%rcx)
incq %rcx
movb (%rbx), %dl
testb %dl, %dl
je 0x1441c
leaq -0x1(%rsi), %rdi
incq %rbx
cmpq $0x1, %rsi
movq %rdi, %rsi
ja 0x14401
movb $0x0, (%rcx)
leaq 0xa0(%rsp), %r12
movq %rax, (%r12)
movq $0x0, 0x20(%rsp)
callq 0x5520
movq %rax, %rbx
leaq 0xe85(%rip), %r13       # 0x152c8
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq %rax, 0x10(%rsp)
movq (%rbx), %rcx
movq 0xa0(%rsp), %rax
decq %rax
movzbl 0x1(%rax), %edx
incq %rax
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0x1447d
movq %rax, 0xa0(%rsp)
movq %r12, %rdi
leaq 0x1d28(%rip), %rsi      # 0x161c5
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x132f9
movq %rax, %r14
movq 0xa0(%rsp), %rax
cmpb $0x22, (%rax)
jne 0x144f6
incq %rax
movq %rax, 0xa0(%rsp)
movq %r12, %rdi
leaq 0xdd6(%rip), %rsi       # 0x152a2
movq %r13, %rdx
movl $0x5c, %ecx
callq 0x132f9
movq %rax, %r15
movq 0xa0(%rsp), %rax
cmpb $0x2c, (%rax)
jne 0x1450d
incq %rax
movq %rax, 0xa0(%rsp)
jmp 0x1450d
movq %r12, %rdi
leaq 0xdc7(%rip), %rsi       # 0x152c7
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x132f9
movq %rax, %r15
cmpb $0x0, (%r14)
je 0x145e7
movq %r14, %rdi
leaq 0x1ca6(%rip), %rsi      # 0x161c7
callq 0x56b0
testl %eax, %eax
je 0x145d8
movq %r14, %rdi
leaq 0x1c98(%rip), %rsi      # 0x161d0
callq 0x56b0
testl %eax, %eax
je 0x145a7
movq %r14, %rdi
leaq 0x1c8c(%rip), %rsi      # 0x161d7
callq 0x56b0
testl %eax, %eax
je 0x145b0
movq %r14, %rdi
leaq 0x12f3(%rip), %rsi      # 0x15851
callq 0x56b0
testl %eax, %eax
je 0x145ba
movq %r14, %rdi
leaq 0x1c6f(%rip), %rsi      # 0x161e0
callq 0x56b0
testl %eax, %eax
je 0x145c4
movq %r14, %rdi
leaq 0x1c60(%rip), %rsi      # 0x161e4
callq 0x56b0
testl %eax, %eax
je 0x145ce
movq %r14, %rdi
leaq 0x1c3a(%rip), %rsi      # 0x161d1
callq 0x56b0
testl %eax, %eax
cmoveq %r15, %rbp
jmp 0x1446f
movq %r15, (%rsp)
jmp 0x1446f
movq %r15, 0x30(%rsp)
jmp 0x1446f
movq %r15, 0x10(%rsp)
jmp 0x1446f
movq %r15, 0x28(%rsp)
jmp 0x1446f
movq %r15, 0x8(%rsp)
jmp 0x1446f
movq %r15, 0x20(%rsp)
movq 0x10(%rsp), %rax
jmp 0x1446a
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14607
callq 0xfe19
movq 0x18(%rsp), %rcx
movq %rax, 0x30(%rcx)
xorl %r14d, %r14d
jmp 0x14313
movb $0x1, %r14b
jmp 0x14313
movq 0x18(%rsp), %rax
movq 0x10(%rax), %r14
movq %rbp, %xmm0
movq %r14, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movq (%rsp), %r15
movq %r15, %xmm1
movq 0x8(%rsp), %xmm2
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
pxor %xmm1, %xmm1
pcmpeqd %xmm1, %xmm2
pcmpeqd %xmm1, %xmm0
movdqa %xmm0, %xmm1
shufps $0xdd, %xmm2, %xmm1     # xmm1 = xmm1[1,3],xmm2[1,3]
shufps $0x88, %xmm2, %xmm0     # xmm0 = xmm0[0,2],xmm2[0,2]
andps %xmm1, %xmm0
movmskps %xmm0, %eax
xorl %ebx, %ebx
testl %eax, %eax
jne 0x143ca
movq 0x28(%rsp), %r12
testq %r12, %r12
je 0x143ca
movq 0x30(%rsp), %r13
testq %r13, %r13
je 0x143ca
movq %r13, %rdi
callq 0x5210
cmpq $0x20, %rax
jne 0x143ca
leaq 0xc40(%rip), %rbx       # 0x152d6
movq %r15, (%rsp)
movq %r12, %r15
xorl %r12d, %r12d
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0xedf1
subq $0x8, %rsp
leaq 0x48(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movq %rbx, %r8
movq 0x10(%rsp), %r9
xorl %eax, %eax
pushq $0x0
leaq 0x80(%rsp), %r10
pushq %r10
pushq %rbx
pushq %r15
pushq %rbx
pushq 0x30(%rsp)
pushq %rbx
callq 0xedf1
addq $0x40, %rsp
callq 0x50e0
movq (%rax), %rax
movzbl (%r13,%r12), %esi
movl (%rax,%rsi,4), %ecx
movzbl 0x40(%rsp,%r12), %edx
movl (%rax,%rdx,4), %edx
testl %esi, %esi
je 0x1471e
incq %r12
cmpl %edx, %ecx
je 0x14701
xorl %ebx, %ebx
cmpl %edx, %ecx
sete %bl
jmp 0x143ca