// File: /workspace/github_c_makefile_star2_O0/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_do_ssi_include
static void mg_do_ssi_include(struct mg_connection *nc, struct http_message *hm,
                              const char *ssi, char *tag, int include_level,
                              const struct mg_serve_http_opts *opts) {
  char file_name[MG_MAX_PATH], path[MG_MAX_PATH], *p;
  FILE *fp;

  /*
   * sscanf() is safe here, since send_ssi_file() also uses buffer
   * of size MG_BUF_LEN to get the tag. So strlen(tag) is always < MG_BUF_LEN.
   */
  if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
    /* File name is relative to the webserver root */
    snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
  } else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) {
    /*
     * File name is relative to the webserver working directory
     * or it is absolute system path
     */
    snprintf(path, sizeof(path), "%s", file_name);
  } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 ||
             sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
    /* File name is relative to the currect document */
    snprintf(path, sizeof(path), "%s", ssi);
    if ((p = strrchr(path, DIRSEP)) != NULL) {
      p[1] = '\0';
    }
    snprintf(path + strlen(path), sizeof(path) - strlen(path), "%s", file_name);
  } else {
    mg_printf(nc, "Bad SSI #include: [%s]", tag);
    return;
  }

  if ((fp = mg_fopen(path, "rb")) == NULL) {
    mg_printf(nc, "SSI include error: mg_fopen(%s): %s", path,
              strerror(mg_get_errno()));
  } else {
    mg_set_close_on_exec((sock_t) fileno(fp));
    if (mg_match_prefix(opts->ssi_pattern, strlen(opts->ssi_pattern), path) >
        0) {
      mg_send_ssi_file(nc, hm, path, fp, include_level + 1, opts);
    } else {
      mg_send_file_data(nc, fp);
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2070, %rsp           # imm = 0x2070
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4d34(%rip), %rsi      # 0x211c9
movb $0x0, %al
callq 0x3460
cmpl $0x1, %eax
jne 0x1c4ce
leaq -0x2030(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rcx
leaq -0x1030(%rbp), %r8
movl $0x1000, %esi           # imm = 0x1000
leaq 0x4357(%rip), %rdx      # 0x20819
movb $0x0, %al
callq 0x31f0
jmp 0x1c618
movq -0x20(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4cfa(%rip), %rsi      # 0x211da
movb $0x0, %al
callq 0x3460
cmpl $0x1, %eax
jne 0x1c512
leaq -0x2030(%rbp), %rdi
leaq -0x1030(%rbp), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3a8c(%rip), %rdx      # 0x1ff92
movb $0x0, %al
callq 0x31f0
jmp 0x1c616
movq -0x20(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4cc7(%rip), %rsi      # 0x211eb
movb $0x0, %al
callq 0x3460
cmpl $0x1, %eax
je 0x1c552
movq -0x20(%rbp), %rdi
leaq -0x1030(%rbp), %rdx
leaq 0x4cb7(%rip), %rsi      # 0x211f9
movb $0x0, %al
callq 0x3460
cmpl $0x1, %eax
jne 0x1c5f9
leaq -0x2030(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x1000, %esi           # imm = 0x1000
leaq 0x3a29(%rip), %rdx      # 0x1ff92
movb $0x0, %al
callq 0x31f0
leaq -0x2030(%rbp), %rdi
movl $0x2f, %esi
callq 0x3200
movq %rax, -0x2038(%rbp)
cmpq $0x0, %rax
je 0x1c599
movq -0x2038(%rbp), %rax
movb $0x0, 0x1(%rax)
leaq -0x2030(%rbp), %rax
movq %rax, -0x2050(%rbp)
leaq -0x2030(%rbp), %rdi
callq 0x3180
movq %rax, %rcx
movq -0x2050(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x2048(%rbp)
leaq -0x2030(%rbp), %rdi
callq 0x3180
movq -0x2048(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
leaq -0x1030(%rbp), %rcx
leaq 0x39a2(%rip), %rdx      # 0x1ff92
movb $0x0, %al
callq 0x31f0
jmp 0x1c614
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x4bfa(%rip), %rsi      # 0x21202
movb $0x0, %al
callq 0xb2f0
jmp 0x1c70f
jmp 0x1c616
jmp 0x1c618
leaq -0x2030(%rbp), %rdi
leaq 0x35c7(%rip), %rsi      # 0x1fbed
callq 0x12360
movq %rax, -0x2040(%rbp)
cmpq $0x0, %rax
jne 0x1c681
movq -0x8(%rbp), %rax
movq %rax, -0x2060(%rbp)
leaq -0x2030(%rbp), %rax
movq %rax, -0x2058(%rbp)
callq 0xd6a0
movl %eax, %edi
callq 0x3650
movq -0x2060(%rbp), %rdi
movq -0x2058(%rbp), %rdx
movq %rax, %rcx
leaq 0x4ba4(%rip), %rsi      # 0x21219
movb $0x0, %al
callq 0xb2f0
jmp 0x1c70f
movq -0x2040(%rbp), %rdi
callq 0x33f0
movl %eax, %edi
callq 0xe240
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x2068(%rbp)
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x3180
movq -0x2068(%rbp), %rdi
movl %eax, %esi
leaq -0x2030(%rbp), %rdx
callq 0x4730
cmpl $0x0, %eax
jle 0x1c6f3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x2030(%rbp), %rdx
movq -0x2040(%rbp), %rcx
movl -0x24(%rbp), %r8d
addl $0x1, %r8d
movq -0x30(%rbp), %r9
callq 0x1c010
jmp 0x1c703
movq -0x8(%rbp), %rdi
movq -0x2040(%rbp), %rsi
callq 0x1c720
movq -0x2040(%rbp), %rdi
callq 0x3160
addq $0x2070, %rsp           # imm = 0x2070
popq %rbp
retq
nopl (%rax,%rax)