// File: /workspace/github_cpp_makefile_star2_O3/nilnilnil[P]autocomplete/deps/mongoose/mongoose.c
// Function: send_ssi_file
static void send_ssi_file(struct mg_connection *conn, const char *path,
                          FILE *fp, int include_level) {
  char buf[BUFSIZ];
  int ch, len, in_ssi_tag;

  if (include_level > 10) {
    cry(conn, "SSI #include level is too deep (%s)", path);
    return;
  }

  in_ssi_tag = 0;
  len = 0;

  while ((ch = fgetc(fp)) != EOF) {
    if (in_ssi_tag && ch == '>') {
      in_ssi_tag = 0;
      buf[len++] = (char) ch;
      buf[len] = '\0';
      assert(len <= (int) sizeof(buf));
      if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
        // Not an SSI tag, pass it
        (void) mg_write(conn, buf, (size_t)len);
      } else {
        if (!memcmp(buf + 5, "include", 7)) {
          do_ssi_include(conn, path, buf + 12, include_level);
#if !defined(NO_POPEN)
        } else if (!memcmp(buf + 5, "exec", 4)) {
          do_ssi_exec(conn, buf + 9);
#endif // !NO_POPEN
        } else {
          cry(conn, "%s: unknown SSI " "command: \"%s\"", path, buf);
        }
      }
      len = 0;
    } else if (in_ssi_tag) {
      if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
        // Not an SSI tag
        in_ssi_tag = 0;
      } else if (len == (int) sizeof(buf) - 2) {
        cry(conn, "%s: SSI tag is too large", path);
        len = 0;
      }
      buf[len++] = ch & 0xff;
    } else if (ch == '<') {
      in_ssi_tag = 1;
      if (len > 0) {
        (void) mg_write(conn, buf, (size_t)len);
      }
      len = 0;
      buf[len++] = ch & 0xff;
    } else {
      buf[len++] = ch & 0xff;
      if (len == (int) sizeof(buf)) {
        (void) mg_write(conn, buf, (size_t)len);
        len = 0;
      }
    }
  }

  // Send the rest of buffered data
  if (len > 0) {
    (void) mg_write(conn, buf, (size_t)len);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5028, %rsp           # imm = 0x5028
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0xa, %ecx
jle 0x147ab
leaq 0x2091(%rip), %rsi      # 0x1681e
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x5028, %rsp           # imm = 0x5028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xfb6a
movl %ecx, %ebp
movq %rdx, %r15
movq %rdx, %rdi
callq 0x5820
cmpl $-0x1, %eax
je 0x14b6a
movl %eax, %r13d
movq %r14, (%rsp)
incl %ebp
movl %ebp, 0xc(%rsp)
leaq 0x20(%rsp), %r12
xorl %r14d, %r14d
xorl %ebp, %ebp
testl %r14d, %r14d
sete %al
cmpl $0x3e, %r13d
setne %cl
orb %al, %cl
jne 0x14838
movslq %ebp, %r8
movw $0x3e, 0x20(%rsp,%r8)
cmpl $0x5, %ebp
jl 0x14814
movl 0x20(%rsp), %eax
movl $0x2d2d213c, %ecx       # imm = 0x2D2D213C
xorl %ecx, %eax
movzbl 0x24(%rsp), %ecx
xorl $0x23, %ecx
orl %eax, %ecx
je 0x148e7
incq %r8
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %ebp, %ebp
xorl %edi, %edi
movq %r12, %rcx
callq 0xe799
xorl %r14d, %r14d
jmp 0x148ce
testl %r14d, %r14d
je 0x14873
movl $0x1, %r14d
cmpl $0x1ffe, %ebp           # imm = 0x1FFE
je 0x148ad
cmpl $0x5, %ebp
jne 0x148c4
movl 0x20(%rsp), %eax
movl $0x2d2d213c, %ecx       # imm = 0x2D2D213C
xorl %ecx, %eax
movzbl 0x24(%rsp), %ecx
xorl $0x23, %ecx
xorl %r14d, %r14d
orl %eax, %ecx
sete %r14b
movl $0x5, %ebp
jmp 0x148c4
cmpl $0x3c, %r13d
jne 0x1492e
testl %ebp, %ebp
jle 0x1489b
movl %ebp, %r8d
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %edi, %edi
movq %r12, %rcx
callq 0xe799
movb $0x3c, 0x20(%rsp)
movl $0x1, %ebp
movl $0x1, %r14d
jmp 0x148ce
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x1fba(%rip), %rsi      # 0x16873
movq (%rsp), %rdx
xorl %eax, %eax
callq 0xfb6a
movslq %ebp, %rax
incl %ebp
movb %r13b, 0x20(%rsp,%rax)
movq %r15, %rdi
callq 0x5820
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0x147d8
jmp 0x14b4a
movl 0x25(%rsp), %eax
movl $0x6c636e69, %ecx       # imm = 0x6C636E69
xorl %ecx, %eax
movl 0x28(%rsp), %ecx
movl $0x6564756c, %edx       # imm = 0x6564756C
xorl %edx, %ecx
orl %eax, %ecx
je 0x1495d
cmpl $0x63657865, 0x25(%rsp) # imm = 0x63657865
je 0x149d7
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x1f3a(%rip), %rsi      # 0x16855
movq (%rsp), %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xfb6a
jmp 0x14830
movslq %ebp, %rax
incl %ebp
movb %r13b, 0x20(%rsp,%rax)
xorl %r14d, %r14d
cmpl $0x2000, %ebp           # imm = 0x2000
jne 0x148ce
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %ebp, %ebp
movl $0x2000, %r8d           # imm = 0x2000
jmp 0x14826
movq 0x18(%rbx), %rdi
movq 0x458(%rbx), %rax
movq 0xa0(%rax), %rsi
leaq 0x10(%rsp), %rdx
callq 0x14089
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
leaq 0x1f04(%rip), %rsi      # 0x1688c
leaq 0x3020(%rsp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
leaq 0x2020(%rsp), %rbp
jne 0x149e9
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x17d4(%rip), %rcx      # 0x16197
xorl %eax, %eax
pushq %r13
pushq $0x2f
callq 0x12579
addq $0x10, %rsp
jmp 0x14a8e
movq %rbx, %rdi
leaq 0x29(%rsp), %rsi
callq 0x14b7c
jmp 0x14b2d
movq %r14, %rdi
leaq 0x1eaa(%rip), %rsi      # 0x1689d
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
jne 0x14a0f
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %rbp, %rsi
jmp 0x14a7d
movq %r14, %rdi
leaq 0x1e92(%rip), %rsi      # 0x168ab
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
jne 0x14b34
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x1d2f(%rip), %rcx      # 0x1676d
movq (%rsp), %r8
xorl %eax, %eax
callq 0x12579
movq %rbp, %rdi
movl $0x2f, %esi
callq 0x5530
testq %rax, %rax
je 0x14a5f
movb $0x0, 0x1(%rax)
movq %rbp, %rdi
callq 0x5210
leaq (%rsp,%rax), %rsi
addq $0x2020, %rsi           # imm = 0x2020
movl $0x1000, %edx           # imm = 0x1000
subq %rax, %rdx
movq %rbx, %rdi
leaq 0x1ce9(%rip), %rcx      # 0x1676d
movq %r13, %r8
xorl %eax, %eax
callq 0x12579
movq %rbp, %rdi
leaq 0x1aca(%rip), %rsi      # 0x16562
callq 0x55c0
testq %rax, %rax
je 0x14aeb
movq %rax, %r13
movq %rax, %rdi
callq 0x54f0
movl %eax, %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x5290
movq 0x458(%rbx), %rax
movq 0x40(%rax), %rsi
movq %rbp, %rdi
callq 0x13046
movq %rbx, %rdi
testl %eax, %eax
je 0x14b13
movq %rbp, %rsi
movq %r13, %rdx
movl 0xc(%rsp), %ecx
callq 0x1476a
jmp 0x14b25
callq 0x5060
movl (%rax), %edi
callq 0x51a0
movq %rbx, %rdi
leaq 0x1dca(%rip), %rsi      # 0x168cb
movq %r14, %rdx
movq %rbp, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xfb6a
jmp 0x14b2d
movq %r13, %rsi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x145dd
movq %r13, %rdi
callq 0x54a0
xorl %ebp, %ebp
jmp 0x14830
movq %rbx, %rdi
leaq 0x1d76(%rip), %rsi      # 0x168b4
movq %r14, %rdx
xorl %eax, %eax
callq 0xfb6a
jmp 0x14b2d
testl %ebp, %ebp
jle 0x14b6a
movl %ebp, %r8d
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
leaq 0x20(%rsp), %rcx
xorl %edi, %edi
callq 0xe799
addq $0x5028, %rsp           # imm = 0x5028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq