// File: /workspace/github_c_makefile_star2_O1/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), %rcx
movq 0x30(%rcx), %rax
testq %rax, %rax
je 0x6f816
testq %rbx, %rbx
sete %dl
testq %rcx, %rcx
sete %cl
orb %dl, %cl
jne 0x6f8d3
leaq 0x8(%rbx), %rdi
movl $0x66, %esi
callq *%rax
testl %eax, %eax
je 0x6f8d3
testl %r14d, %r14d
je 0x6f935
leaq 0x8(%rbx), %r15
movq 0x8(%rbx), %r14
leaq 0xab91(%rip), %rsi      # 0x7a3bf
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6f8f0
movq 0x10(%rbx), %r13
leaq 0xbc64(%rip), %rsi      # 0x7b4ad
movl $0x4, %edx
movq %r13, %rdi
callq 0x6ae41
testl %eax, %eax
je 0x6f8f0
leaq 0xbc2b(%rip), %rsi      # 0x7b490
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6f956
movq 0x2a8(%rbx), %r14
movq 0xc8(%r14), %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
callq 0x7158a
testl %eax, %eax
je 0x6f89c
movq 0x68(%r14), %r12
testq %r12, %r12
jne 0x6f8a0
movq 0x70(%r14), %r12
movq 0x58(%r14), %rax
movq %rax, -0x78(%rbp)
leaq 0x701d(%rip), %rsi      # 0x768cc
movq %r15, %rdi
callq 0x69863
movq %rax, %r14
testq %r12, %r12
je 0x6fa97
movq %r12, %rdi
callq 0xc460
movq %rax, %r8
jmp 0x6fa9a
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6a5c2
movq 0x2a8(%rbx), %rax
movq 0x80(%rax), %rdi
testq %rdi, %rdi
je 0x6f913
leaq 0x6c61(%rip), %rsi      # 0x7656b
callq 0xc950
testl %eax, %eax
je 0x6f991
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 0x6c73d
movq 0x2a8(%rbx), %rax
cmpq $0x0, 0x30(%rax)
je 0x6f81f
movl $0x3, 0x2b8(%rbx)
jmp 0x6ffb0
movl $0xc8, 0x284(%rbx)
leaq 0x89dd(%rip), %rsi      # 0x78344
leaq 0xbc98(%rip), %rdx      # 0x7b606
movq %r15, %rdi
xorl %eax, %eax
callq 0x69675
movq %rbx, %rdi
addq $0x40f8, %rsp           # imm = 0x40F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6a615
leaq -0x2a(%rbp), %rcx
movw $0x50, (%rcx)
leaq -0x50(%rbp), %r8
movl $0x0, (%r8)
movq 0x10(%rbx), %r14
xorl %eax, %eax
leaq -0x2110(%rbp), %rdx
movb %al, (%rdx)
movb %al, -0x108(%rbp)
leaq 0xbc0b(%rip), %rsi      # 0x7b5cc
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x2, %eax
je 0x6fa2b
leaq 0xbbeb(%rip), %rsi      # 0x7b5c2
leaq -0x108(%rbp), %rdx
leaq -0x2110(%rbp), %rcx
leaq -0x2a(%rbp), %r8
leaq -0x50(%rbp), %r9
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x3, %eax
je 0x6fa2b
leaq 0xbbd9(%rip), %rsi      # 0x7b5dc
leaq -0x108(%rbp), %rdx
leaq -0x2110(%rbp), %rcx
leaq -0x50(%rbp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
cmpl $0x2, %eax
je 0x6fa2b
movl $0x0, -0x50(%rbp)
movq (%rbx), %rax
cmpq $0x0, 0x70(%rax)
leaq 0xbbc8(%rip), %rax      # 0x7b602
leaq 0xbbbd(%rip), %rcx      # 0x7b5fe
cmoveq %rax, %rcx
movzwl -0x2a(%rbp), %r9d
leaq 0xbba1(%rip), %rdx      # 0x7b5f2
leaq -0x4110(%rbp), %rdi
leaq -0x2110(%rbp), %r8
movl $0x3e8, %esi            # imm = 0x3E8
xorl %eax, %eax
callq 0xc5d0
cmpl $0x0, -0x50(%rbp)
jle 0x6fa88
leaq -0x4110(%rbp), %rsi
movq %r15, %rdi
callq 0x6b125
testl %eax, %eax
jne 0x6ffb0
movq (%rbx), %rax
orl $0x10, 0xa0(%rax)
jmp 0x6ffb0
xorl %r8d, %r8d
cmpq $0x0, -0x38(%rbp)
setne %al
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq %r15, -0x40(%rbp)
jne 0x6fb6d
movq %r8, -0x68(%rbp)
movq %r14, %rdi
movl $0x3a, %esi
callq 0xc5f0
testq %rax, %rax
movq %r14, -0x70(%rbp)
je 0x6fad6
subq %r14, %rax
jmp 0x6fade
movq %r14, %rdi
callq 0xc460
movq %rax, -0x60(%rbp)
leaq -0x4110(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x6d92e
testq %rax, %rax
je 0x6fb69
movq %rax, %r14
movq %r12, -0x58(%rbp)
movq -0x60(%rbp), %rax
incq %rax
movq %rax, -0x38(%rbp)
leaq -0x4110(%rbp), %r12
leaq -0x50(%rbp), %r15
movq -0x4108(%rbp), %rax
cmpq $0x2, %rax
jb 0x6fb4f
movq -0x4110(%rbp), %rdi
cmpb $0x40, (%rdi)
jne 0x6fb4f
cmpq -0x38(%rbp), %rax
jne 0x6fb4f
incq %rdi
movq -0x70(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x6ae41
testl %eax, %eax
je 0x6ff02
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6d92e
movq %rax, %r14
testq %rax, %rax
jne 0x6fb18
movq -0x58(%rbp), %r12
movq -0x68(%rbp), %r8
xorl %r15d, %r15d
testq %r12, %r12
je 0x6fca8
testl %r8d, %r8d
je 0x6fca8
movb $0x1, %al
movl %eax, -0x38(%rbp)
leaq 0xb3fa(%rip), %rdx      # 0x7af88
leaq -0x2110(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movl %r8d, %ecx
movq %r12, -0x58(%rbp)
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x6c630
movq 0x2a8(%rbx), %rax
movq 0xc8(%rax), %r12
leaq -0x4110(%rbp), %r14
leaq -0x50(%rbp), %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6d92e
testq %rax, %rax
je 0x6fc20
movq %rax, %r12
movq -0x4110(%rbp), %rdi
movq -0x4108(%rbp), %rsi
movq %r13, %rdx
callq 0x698e5
testl %eax, %eax
jle 0x6fbc7
movl -0x48(%rbp), %ecx
movq -0x50(%rbp), %r8
movl %eax, %eax
addq %rax, %r13
leaq 0xb37e(%rip), %rdx      # 0x7af88
leaq -0x2110(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r13, %r9
xorl %eax, %eax
callq 0x6c630
leaq -0x2110(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xcb70
movl $0x1, %r15d
testl %eax, %eax
je 0x6fcb4
movq -0x58(%rbp), %rdi
callq 0xc460
leaq (%rax,%rbp), %r14
addq $-0x210e, %r14          # imm = 0xDEF2
leaq -0x2110(%rbp), %r15
leaq -0x108(%rbp), %r13
movq -0x78(%rbp), %r12
movzbl (%r14), %eax
cmpl $0x2f, %eax
je 0x6fc72
testl %eax, %eax
jne 0x6fca3
jmp 0x6fcaf
movb $0x0, (%r14)
movq %r12, %rdi
callq 0xc460
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x698e5
testl %eax, %eax
jle 0x6fc9f
movq %r15, %rdi
movq %r13, %rsi
callq 0xcb70
testl %eax, %eax
je 0x6fcbd
movb $0x2f, (%r14)
incq %r14
jmp 0x6fc63
movb $0x1, %al
movl %eax, -0x38(%rbp)
jmp 0x6fce1
xorl %r15d, %r15d
jmp 0x6fce1
movl $0x0, -0x38(%rbp)
jmp 0x6fce1
movb $0x2f, (%r14)
movq %r14, %rdi
callq 0x6d8fa
movq %rax, 0x2c0(%rbx)
movb $0x0, (%r14)
movl $0x0, -0x38(%rbp)
movl $0x1, %r15d
movq -0x40(%rbp), %r14
movq (%r14), %rdi
leaq 0xb7a1(%rip), %rsi      # 0x7b490
callq 0xc950
testl %eax, %eax
je 0x6fdd0
movq 0x2a8(%rbx), %r14
cmpq $0x0, 0x70(%r14)
je 0x6fdba
movq %rbx, %rdi
callq 0x7158a
testl %eax, %eax
je 0x6fdf7
movq %rbx, %rdi
callq 0x7158a
testl %eax, %eax
je 0x6fda3
movq 0x2a8(%rbx), %rax
movq 0x60(%rax), %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x6fd59
leaq 0xb753(%rip), %rsi      # 0x7b498
callq 0xc950
testl %eax, %eax
sete %al
testq %r14, %r14
sete %cl
testb %cl, %al
jne 0x6fda3
testq %r14, %r14
je 0x6ff9f
leaq 0xb5ec(%rip), %rsi      # 0x7b355
movq %r14, %rdi
callq 0xcb90
testq %rax, %rax
je 0x6ff9f
movq %rax, %r14
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x6abae
movl %r15d, %r13d
movl %eax, %r15d
movq %r14, %rdi
callq 0xc4c0
testl %r15d, %r15d
movl %r13d, %r15d
je 0x6ff9f
leaq -0x2110(%rbp), %rsi
movq %rbx, %rdi
callq 0x6c6d9
testl %eax, %eax
je 0x6fe81
movq %rbx, %rdi
movl $0x194, %esi            # imm = 0x194
xorl %edx, %edx
xorl %eax, %eax
callq 0x6c73d
jmp 0x6ffb0
movl $0xc8, 0x284(%rbx)
leaq 0x8563(%rip), %rsi      # 0x78344
leaq 0xb81e(%rip), %rdx      # 0x7b606
movq %r14, %rdi
xorl %eax, %eax
callq 0x69675
jmp 0x6ffa8
movq 0x90(%r14), %r14
testq %r14, %r14
jne 0x6ff5e
movl -0xf0(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
setne %al
movl -0x38(%rbp), %ecx
orb %al, %cl
je 0x6ff2d
movl %r15d, %r13d
leaq -0x2110(%rbp), %r15
movq %r15, %rdi
movl $0x2f, %esi
callq 0xca50
testq %rax, %rax
cmovel %r15d, %eax
subl %r15d, %eax
leaq 0xb81d(%rip), %rcx      # 0x7b66a
movq %rcx, (%rsp)
leaq 0xb81c(%rip), %rdx      # 0x7b674
leaq -0x4110(%rbp), %r14
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
movl %eax, %ecx
movq %r15, %r8
movl %r13d, %r15d
movl $0x2f, %r9d
xorl %eax, %eax
callq 0x6c630
jmp 0x6ff5e
movq -0x40(%rbp), %rax
movq (%rax), %r14
leaq 0xb609(%rip), %rsi      # 0x7b498
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6ff0f
leaq 0xb5ff(%rip), %rsi      # 0x7b4a1
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6ffc2
leaq 0xb5d0(%rip), %rsi      # 0x7b489
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6ffd3
leaq 0x692a(%rip), %rsi      # 0x767fa
movq %r14, %rdi
callq 0xc950
leaq -0x2110(%rbp), %rsi
testl %eax, %eax
je 0x6ffe4
leaq -0x108(%rbp), %rdx
movq -0x40(%rbp), %rdi
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x6b8ac
jmp 0x6ffb0
movq -0x50(%rbp), %r12
movl -0x48(%rbp), %r8d
jmp 0x6fb6d
leaq -0x2110(%rbp), %rsi
leaq -0x108(%rbp), %rdx
movq %rbx, %rdi
movl %r15d, %ecx
callq 0x715f0
jmp 0x6ffb0
leaq 0xaea1(%rip), %rdx      # 0x7add5
leaq 0xb72f(%rip), %r9       # 0x7b66a
leaq -0x4110(%rbp), %r14
leaq -0x2110(%rbp), %rcx
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
movl $0x2f, %r8d
xorl %eax, %eax
callq 0x6c630
leaq 0xb3f0(%rip), %rsi      # 0x7b355
movq %r14, %rdi
callq 0xcb90
testq %rax, %rax
je 0x6fd1e
movq %rax, %r14
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x6abae
movl %r15d, %r13d
movl %eax, %r15d
movq %r14, %rdi
callq 0xc4c0
testl %r15d, %r15d
movl %r13d, %r15d
jne 0x6fd1e
movq -0x40(%rbp), %rdi
callq 0x6a5c2
movq %rbx, %rdi
callq 0x6a615
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 0x717c2
jmp 0x6ffb0
leaq -0x2110(%rbp), %rsi
movq %rbx, %rdi
callq 0x71839
jmp 0x6ffb0
movq %rbx, %rdi
callq 0x718b1
jmp 0x6ffb0