// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: open_local_endpoint
static void open_local_endpoint(struct connection *conn, int skip_user) {
#ifndef MONGOOSE_NO_FILESYSTEM
  char path[MAX_PATH_SIZE];
  file_stat_t st;
  int exists = 0;
#endif

  // If EP_USER was set in a prev call, reset it
  conn->endpoint_type = EP_NONE;

#ifndef MONGOOSE_NO_AUTH
  if (conn->server->event_handler && call_user(conn, MG_AUTH) == MG_FALSE) {
    mg_send_digest_auth_request(&conn->mg_conn);
    return;
  }
#endif

  // Call URI handler if one is registered for this URI
  if (skip_user == 0 && conn->server->event_handler != NULL) {
    conn->endpoint_type = EP_USER;
#if MONGOOSE_POST_SIZE_LIMIT > 1
    {
      const char *cl = mg_get_header(&conn->mg_conn, "Content-Length");
      if ((strcmp(conn->mg_conn.request_method, "POST") == 0 ||
           strcmp(conn->mg_conn.request_method, "PUT") == 0) &&
          (cl == NULL || to64(cl) > MONGOOSE_POST_SIZE_LIMIT)) {
        send_http_error(conn, 500, "POST size > %lu",
                        (unsigned long) MONGOOSE_POST_SIZE_LIMIT);
      }
    }
#endif
    return;
  }

  if (strcmp(conn->mg_conn.request_method, "CONNECT") == 0 ||
      mg_strncasecmp(conn->mg_conn.uri, "http", 4) == 0) {
    const char *enp = conn->server->config_options[ENABLE_PROXY];
    if (enp == NULL || strcmp(enp, "yes") != 0) {
      send_http_error(conn, 405, NULL);
    } else {
      proxify_connection(conn);
    }
    return;
  }

  if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
    send_options(conn);
    return;
  }

#ifdef MONGOOSE_NO_FILESYSTEM
  send_http_error(conn, 404, NULL);
#else
  exists = convert_uri_to_file_name(conn, path, sizeof(path), &st);

  if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
    send_options(conn);
  } else if (conn->server->config_options[DOCUMENT_ROOT] == NULL) {
    send_http_error(conn, 404, NULL);
#ifndef MONGOOSE_NO_AUTH
  } else if ((!is_dav_request(conn) && !is_authorized(conn, path,
               exists && S_ISDIR(st.st_mode))) ||
             (is_dav_request(conn) && !is_authorized_for_dav(conn))) {
    mg_send_digest_auth_request(&conn->mg_conn);
    close_local_endpoint(conn);
#endif
#ifndef MONGOOSE_NO_DAV
  } else if (must_hide_file(conn, path)) {
    send_http_error(conn, 404, NULL);
  } else if (!strcmp(conn->mg_conn.request_method, "PROPFIND")) {
    handle_propfind(conn, path, &st, exists);
  } else if (!strcmp(conn->mg_conn.request_method, "MKCOL")) {
    handle_mkcol(conn, path);
  } else if (!strcmp(conn->mg_conn.request_method, "DELETE")) {
    handle_delete(conn, path);
  } else if (!strcmp(conn->mg_conn.request_method, "PUT")) {
    handle_put(conn, path);
#endif
  } else {
    mg_send_file_internal(&conn->mg_conn, path, &st, exists, NULL);
  }
#endif  // MONGOOSE_NO_FILESYSTEM
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40f8, %rsp           # imm = 0x40F8
movl %esi, %r14d
movq %rdi, %rbx
movl $0x0, 0x2b8(%rdi)
movq 0x2a8(%rdi), %rax
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6dba4
leaq 0x8(%rbx), %r15
movq %r15, %rdi
movl $0x66, %esi
callq *%rax
testl %eax, %eax
je 0x6dcb8
testl %r14d, %r14d
je 0x6dc97
leaq 0x8(%rbx), %r13
movq 0x8(%rbx), %r14
leaq 0xa803(%rip), %rsi      # 0x783bf
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6dc4e
movq 0x10(%rbx), %rdi
leaq 0xb8d6(%rip), %rsi      # 0x794ad
movl $0x4, %edx
movq %rdi, -0x40(%rbp)
callq 0x69234
testl %eax, %eax
je 0x6dc4e
leaq 0xb8a0(%rip), %rsi      # 0x79490
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6dd0c
movq 0x2a8(%rbx), %r15
movq 0xc8(%r15), %rax
movq %rax, -0x30(%rbp)
movq %r14, %rdi
callq 0x6f8e6
testl %eax, %eax
je 0x6dcd1
movq 0x68(%r15), %r12
testq %r12, %r12
je 0x6dcd1
movq 0x58(%r15), %rax
movq %rax, -0x70(%rbp)
leaq 0x6c96(%rip), %rsi      # 0x748d4
movq %r13, %rdi
callq 0x67c6a
movq %rax, %r15
jmp 0x6dcf8
movq 0x2a8(%rbx), %rax
movq 0x80(%rax), %rdi
testq %rdi, %rdi
je 0x6dc75
leaq 0x690b(%rip), %rsi      # 0x74573
callq 0xc950
testl %eax, %eax
je 0x6dd47
movq %rbx, %rdi
movl $0x195, %esi            # imm = 0x195
xorl %edx, %edx
xorl %eax, %eax
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ae64
movq 0x2a8(%rbx), %rax
cmpq $0x0, 0x30(%rax)
je 0x6dbad
movl $0x3, 0x2b8(%rbx)
jmp 0x6e388
movq %r15, %rdi
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68a11
movq 0x58(%r15), %rax
movq %rax, -0x70(%rbp)
movq 0x70(%r15), %r12
leaq 0x6bf0(%rip), %rsi      # 0x748d4
movq %r13, %rdi
callq 0x67c6a
movq %rax, %r15
testq %r12, %r12
je 0x6de4d
movq -0x30(%rbp), %r14
movq %r12, %rdi
callq 0xc460
movq %rax, %r8
jmp 0x6de57
movl $0xc8, 0x284(%rbx)
leaq 0x8632(%rip), %rsi      # 0x7634f
leaq 0xb8e2(%rip), %rdx      # 0x79606
movq %r13, %rdi
xorl %eax, %eax
callq 0x67a83
movq %rbx, %rdi
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x68a64
leaq -0x32(%rbp), %rcx
movw $0x50, (%rcx)
leaq -0x58(%rbp), %r8
movl $0x0, (%r8)
movq 0x10(%rbx), %r14
xorl %eax, %eax
leaq -0x2110(%rbp), %rdx
movb %al, (%rdx)
movb %al, -0x108(%rbp)
leaq 0xb855(%rip), %rsi      # 0x795cc
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x2, %eax
je 0x6dde1
leaq 0xb835(%rip), %rsi      # 0x795c2
leaq -0x108(%rbp), %rdx
leaq -0x2110(%rbp), %rcx
leaq -0x32(%rbp), %r8
leaq -0x58(%rbp), %r9
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x3, %eax
je 0x6dde1
leaq 0xb823(%rip), %rsi      # 0x795dc
leaq -0x108(%rbp), %rdx
leaq -0x2110(%rbp), %rcx
leaq -0x58(%rbp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x2, %eax
je 0x6dde1
movl $0x0, -0x58(%rbp)
movq (%rbx), %rax
cmpq $0x0, 0x70(%rax)
leaq 0xb812(%rip), %rax      # 0x79602
leaq 0xb807(%rip), %rcx      # 0x795fe
cmoveq %rax, %rcx
movzwl -0x32(%rbp), %r9d
leaq 0xb7eb(%rip), %rdx      # 0x795f2
leaq -0x4110(%rbp), %rdi
leaq -0x2110(%rbp), %r8
movl $0x3e8, %esi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc5d0
cmpl $0x0, -0x58(%rbp)
jle 0x6de3e
leaq -0x4110(%rbp), %rsi
movq %r13, %rdi
callq 0x69535
testl %eax, %eax
jne 0x6e388
movq (%rbx), %rax
orl $0x10, 0xa0(%rax)
jmp 0x6e388
xorl %r12d, %r12d
xorl %r8d, %r8d
movq -0x30(%rbp), %r14
testq %r14, %r14
setne %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6df27
movq %r8, -0x68(%rbp)
movq %r15, %rdi
movl $0x3a, %esi
callq 0xc5f0
testq %rax, %rax
je 0x6de89
subq %r15, %rax
jmp 0x6de91
movq %r15, %rdi
callq 0xc460
movq %rax, -0x30(%rbp)
leaq -0x4110(%rbp), %rsi
leaq -0x58(%rbp), %rdx
movq %r14, %rdi
callq 0x6bda1
testq %rax, %rax
je 0x6df23
movq %rax, %r14
movq %r15, -0x78(%rbp)
movq %r12, -0x60(%rbp)
movq %r13, -0x48(%rbp)
movq -0x30(%rbp), %rax
leaq 0x1(%rax), %r13
leaq -0x4110(%rbp), %r12
leaq -0x58(%rbp), %r15
movq -0x4108(%rbp), %rax
cmpq $0x2, %rax
jb 0x6df05
movq -0x4110(%rbp), %rdi
cmpb $0x40, (%rdi)
jne 0x6df05
cmpq %r13, %rax
jne 0x6df05
incq %rdi
movq -0x78(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x69234
testl %eax, %eax
je 0x6e26a
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6bda1
movq %rax, %r14
testq %rax, %rax
jne 0x6decf
movq -0x48(%rbp), %r13
movq -0x60(%rbp), %r12
movq -0x68(%rbp), %r8
xorl %r15d, %r15d
testq %r12, %r12
je 0x6e069
testl %r8d, %r8d
je 0x6e069
movb $0x1, %al
movl %eax, -0x30(%rbp)
leaq 0xb040(%rip), %rdx      # 0x78f88
leaq -0x2110(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movl %r8d, %ecx
movq %r12, -0x60(%rbp)
movq %r12, %r8
movq -0x40(%rbp), %r9
xorl %eax, %eax
callq 0x6ad62
movq 0x2a8(%rbx), %rax
movq 0xc8(%rax), %r12
leaq -0x4110(%rbp), %r14
leaq -0x58(%rbp), %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6bda1
testq %rax, %rax
je 0x6dfdd
movq %rax, %r12
movq -0x4110(%rbp), %rdi
movq -0x4108(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x67cec
testl %eax, %eax
jle 0x6df82
movl -0x50(%rbp), %ecx
movq -0x58(%rbp), %r8
movl %eax, %eax
movq -0x40(%rbp), %r9
addq %rax, %r9
leaq 0xafbe(%rip), %rdx      # 0x78f88
leaq -0x2110(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
xorl %eax, %eax
callq 0x6ad62
leaq -0x2110(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xcb70
movl $0x1, %r15d
testl %eax, %eax
je 0x6e079
movq %r13, -0x48(%rbp)
movq -0x60(%rbp), %rdi
callq 0xc460
leaq (%rax,%rbp), %r14
addq $-0x210e, %r14          # imm = 0xDEF2
leaq -0x2110(%rbp), %r15
leaq -0x108(%rbp), %r13
movq -0x70(%rbp), %r12
movzbl (%r14), %eax
cmpl $0x2f, %eax
je 0x6e033
testl %eax, %eax
jne 0x6e064
jmp 0x6e070
movb $0x0, (%r14)
movq %r12, %rdi
callq 0xc460
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x67cec
testl %eax, %eax
jle 0x6e060
movq %r15, %rdi
movq %r13, %rsi
callq 0xcb70
testl %eax, %eax
je 0x6e082
movb $0x2f, (%r14)
incq %r14
jmp 0x6e024
movb $0x1, %al
movl %eax, -0x30(%rbp)
jmp 0x6e0aa
xorl %r15d, %r15d
movq -0x48(%rbp), %r13
jmp 0x6e0aa
movl $0x0, -0x30(%rbp)
jmp 0x6e0aa
movb $0x2f, (%r14)
movq %r14, %rdi
callq 0x6bd6d
movq %rax, 0x2c0(%rbx)
movb $0x0, (%r14)
movl $0x0, -0x30(%rbp)
movq -0x48(%rbp), %r13
movl $0x1, %r15d
movq (%r13), %r14
leaq 0xb3db(%rip), %rsi      # 0x79490
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6e1a2
movl %r15d, -0x40(%rbp)
movq 0x2a8(%rbx), %r15
cmpq $0x0, 0x70(%r15)
je 0x6e18c
movq %r14, %rdi
callq 0x6f8e6
testl %eax, %eax
je 0x6e1c9
movq 0x8(%rbx), %r15
movq %r15, %rdi
callq 0x6f8e6
movq 0x2a8(%rbx), %r12
testl %eax, %eax
je 0x6e174
movq 0x60(%r12), %r14
testq %r15, %r15
je 0x6e12a
leaq 0xb385(%rip), %rsi      # 0x79498
movq %r15, %rdi
callq 0xc950
testl %eax, %eax
sete %al
testq %r14, %r14
sete %cl
testb %cl, %al
jne 0x6e174
testq %r14, %r14
je 0x6e378
leaq 0xb21b(%rip), %rsi      # 0x79355
movq %r14, %rdi
callq 0xcb90
testq %rax, %rax
je 0x6e378
movq %rax, %r14
movq %r13, %rdi
movq %rax, %rsi
callq 0x68fa1
movl %eax, %r15d
movq %r14, %rdi
callq 0xc4c0
testl %r15d, %r15d
je 0x6e378
movq 0x2a8(%rbx), %r12
movq 0x98(%r12), %rdi
leaq -0x2110(%rbp), %rsi
callq 0x6ae0b
testl %eax, %eax
je 0x6e1e5
movq %rbx, %rdi
movl $0x194, %esi            # imm = 0x194
xorl %edx, %edx
xorl %eax, %eax
callq 0x6ae64
jmp 0x6e388
movl $0xc8, 0x284(%rbx)
leaq 0x819c(%rip), %rsi      # 0x7634f
leaq 0xb44c(%rip), %rdx      # 0x79606
movq %r13, %rdi
xorl %eax, %eax
callq 0x67a83
jmp 0x6e380
movq 0x90(%r15), %rdi
testq %rdi, %rdi
je 0x6e27b
leaq 0xb175(%rip), %rsi      # 0x79355
jmp 0x6e348
movq (%r13), %r14
leaq 0xb2a8(%rip), %rsi      # 0x79498
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6e2f2
leaq 0xb29a(%rip), %rsi      # 0x794a1
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
movl -0x40(%rbp), %r15d
je 0x6e39a
leaq 0xb267(%rip), %rsi      # 0x79489
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6e3ab
leaq 0x65c9(%rip), %rsi      # 0x74802
movq %r14, %rdi
callq 0xc950
leaq -0x2110(%rbp), %rsi
testl %eax, %eax
je 0x6e3bc
leaq -0x108(%rbp), %rdx
movq %r13, %rdi
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x69d9c
jmp 0x6e388
movq -0x58(%rbp), %r12
movl -0x50(%rbp), %r8d
movq -0x48(%rbp), %r13
jmp 0x6df27
movl -0xf0(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
setne %al
movl -0x30(%rbp), %ecx
orb %al, %cl
je 0x6e30d
leaq -0x2110(%rbp), %r14
movq %r14, %rdi
movl $0x2f, %esi
callq 0xca50
testq %rax, %rax
cmovel %r14d, %eax
subl %r14d, %eax
leaq 0xb3b0(%rip), %rcx      # 0x7966a
movq %rcx, (%rsp)
leaq 0xb3af(%rip), %rdx      # 0x79674
leaq -0x4110(%rbp), %r15
movl $0x2000, %esi           # imm = 0x2000
movq %r15, %rdi
movl %eax, %ecx
movq %r14, %r8
movl $0x2f, %r9d
xorl %eax, %eax
callq 0x6ad62
leaq 0xb068(%rip), %rsi      # 0x79355
movq %r15, %rdi
jmp 0x6e348
leaq -0x2110(%rbp), %rsi
leaq -0x108(%rbp), %rdx
movq %rbx, %rdi
movl -0x40(%rbp), %ecx
callq 0x6f948
jmp 0x6e388
leaq 0xaac1(%rip), %rdx      # 0x78dd5
leaq 0xb34f(%rip), %r9       # 0x7966a
leaq -0x4110(%rbp), %r14
leaq -0x2110(%rbp), %rcx
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
movl $0x2f, %r8d
xorl %eax, %eax
callq 0x6ad62
leaq 0xb010(%rip), %rsi      # 0x79355
movq %r14, %rdi
callq 0xcb90
movq %rax, %r14
testq %rax, %rax
je 0x6e0eb
movq %r13, %rdi
movq %r14, %rsi
callq 0x68fa1
movl %eax, %r15d
movq %r14, %rdi
callq 0xc4c0
testl %r15d, %r15d
jne 0x6e0eb
movq %r13, %rdi
callq 0x68a11
movq %rbx, %rdi
callq 0x68a64
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x2110(%rbp), %rsi
movq %rbx, %rdi
callq 0x6fb23
jmp 0x6e388
leaq -0x2110(%rbp), %rsi
movq %rbx, %rdi
callq 0x6fb9a
jmp 0x6e388
movq %rbx, %rdi
callq 0x6fc12
jmp 0x6e388