// File: /workspace/github_cpp_makefile_star2_O1/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 0x14987
leaq 0x1eb8(%rip), %rsi      # 0x16821
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 0xfc79
movl %ecx, %ebp
movq %rdx, %r15
movq %rdx, %rdi
callq 0x5820
cmpl $-0x1, %eax
je 0x14d45
movl %eax, %r13d
incl %ebp
movl %ebp, 0xc(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
testl %r12d, %r12d
sete %al
cmpl $0x3e, %r13d
setne %cl
orb %al, %cl
jne 0x14a0d
movslq %ebp, %r8
movw $0x3e, 0x20(%rsp,%r8)
cmpl $0x5, %ebp
jl 0x149e7
movl 0x20(%rsp), %eax
movl $0x2d2d213c, %ecx       # imm = 0x2D2D213C
xorl %ecx, %eax
movzbl 0x24(%rsp), %ecx
xorl $0x23, %ecx
orl %eax, %ecx
je 0x14a94
incq %r8
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %ebp, %ebp
xorl %edi, %edi
leaq 0x20(%rsp), %rcx
callq 0xe841
xorl %r12d, %r12d
jmp 0x14b37
testl %r12d, %r12d
je 0x14a55
movl $0x1, %r12d
cmpl $0x1ffe, %ebp           # imm = 0x1FFE
je 0x14b17
cmpl $0x5, %ebp
jne 0x14b2d
movl 0x20(%rsp), %eax
movl $0x2d2d213c, %ecx       # imm = 0x2D2D213C
xorl %ecx, %eax
movzbl 0x24(%rsp), %ecx
xorl $0x23, %ecx
orl %eax, %ecx
je 0x14b0f
xorl %r12d, %r12d
movl $0x5, %ebp
jmp 0x14b2d
cmpl $0x3c, %r13d
jne 0x14ae0
testl %ebp, %ebp
jle 0x14a7f
movl %ebp, %r8d
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %edi, %edi
leaq 0x20(%rsp), %rcx
callq 0xe841
movb $0x3c, 0x20(%rsp)
movl $0x1, %ebp
movl $0x1, %r12d
jmp 0x14b37
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 0x14b50
cmpl $0x63657865, 0x25(%rsp) # imm = 0x63657865
je 0x14bbb
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x1d8c(%rip), %rsi      # 0x16858
movq %r14, %rdx
leaq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0xfc79
jmp 0x14a05
movslq %ebp, %rax
incl %ebp
movb %r13b, 0x20(%rsp,%rax)
xorl %r12d, %r12d
cmpl $0x2000, %ebp           # imm = 0x2000
jne 0x14b37
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
xorl %ebp, %ebp
movl $0x2000, %r8d           # imm = 0x2000
jmp 0x149f9
cmpl $0x1ffe, %ebp           # imm = 0x1FFE
jne 0x14b2d
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x1d53(%rip), %rsi      # 0x16876
movq %r14, %rdx
xorl %eax, %eax
callq 0xfc79
movslq %ebp, %rax
incl %ebp
movb %r13b, 0x20(%rsp,%rax)
movq %r15, %rdi
callq 0x5820
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0x149ab
jmp 0x14d47
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x14238
leaq 0x2c(%rsp), %r12
movq %r12, %rdi
leaq 0x1d23(%rip), %rsi      # 0x1688f
leaq 0x3020(%rsp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
jne 0x14bcd
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
leaq 0x2020(%rsp), %rbp
movq %rbp, %rsi
leaq 0x15f0(%rip), %rcx      # 0x16197
xorl %eax, %eax
pushq %r13
pushq $0x2f
callq 0x131fd
addq $0x10, %rsp
jmp 0x14c89
movq %rbx, %rdi
leaq 0x29(%rsp), %rsi
callq 0x14d79
jmp 0x14d28
movq %r12, %rdi
leaq 0x1cc9(%rip), %rsi      # 0x168a0
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
jne 0x14bfb
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
leaq 0x2020(%rsp), %rbp
movq %rbp, %rsi
jmp 0x14c78
movq %r12, %rdi
leaq 0x1ca9(%rip), %rsi      # 0x168ae
movq %r13, %rdx
xorl %eax, %eax
callq 0x5490
cmpl $0x1, %eax
jne 0x14d2f
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
leaq 0x2020(%rsp), %rbp
movq %rbp, %rsi
leaq 0x1b3e(%rip), %rcx      # 0x16770
movq %r14, %r8
xorl %eax, %eax
callq 0x131fd
movq %rbp, %rdi
movl $0x2f, %esi
callq 0x5530
testq %rax, %rax
je 0x14c52
movb $0x0, 0x1(%rax)
leaq 0x2020(%rsp), %rbp
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 0x1af1(%rip), %rcx      # 0x16770
movq %r13, %r8
xorl %eax, %eax
callq 0x131fd
movq %rbp, %rdi
leaq 0x18d2(%rip), %rsi      # 0x16565
callq 0x55c0
testq %rax, %rax
je 0x14ce6
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 0x13b6e
movq %rbx, %rdi
testl %eax, %eax
je 0x14d0e
movq %rbp, %rsi
movq %r13, %rdx
movl 0xc(%rsp), %ecx
callq 0x14946
jmp 0x14d20
callq 0x5060
movl (%rax), %edi
callq 0x51a0
movq %rbx, %rdi
leaq 0x1bd2(%rip), %rsi      # 0x168ce
movq %r12, %rdx
movq %rbp, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xfc79
jmp 0x14d28
movq %r13, %rsi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x147b9
movq %r13, %rdi
callq 0x54a0
xorl %ebp, %ebp
jmp 0x14a05
movq %rbx, %rdi
leaq 0x1b7e(%rip), %rsi      # 0x168b7
movq %r12, %rdx
xorl %eax, %eax
callq 0xfc79
jmp 0x14d28
xorl %ebp, %ebp
testl %ebp, %ebp
jle 0x14d67
movl %ebp, %r8d
movl 0x470(%rbx), %esi
movq 0x460(%rbx), %rdx
leaq 0x20(%rsp), %rcx
xorl %edi, %edi
callq 0xe841
addq $0x5028, %rsp           # imm = 0x5028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq