// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %r15
movq %rsi, %rdx
movq %rdi, %rbx
cmpl $0xa, %ecx
jle 0x113d9
leaq 0x2460(%rip), %rsi      # 0x1381e
movq %rbx, %rdi
xorl %eax, %eax
addq $0x5028, %rsp           # imm = 0x5028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcd67
movq %rdx, (%rsp)
incl %ecx
movl %ecx, 0xc(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x5820
movl %r14d, %edx
cmpl $-0x1, %eax
je 0x1173c
movl %eax, %r12d
testl %r13d, %r13d
sete %al
cmpl $0x3e, %r12d
setne %cl
orb %al, %cl
movslq %r14d, %rbp
je 0x114c9
testl %r13d, %r13d
je 0x11453
cmpl $0x1ffe, %r14d          # imm = 0x1FFE
je 0x1147c
pushq $0x1
popq %r13
cmpl $0x5, %r14d
jne 0x11498
leaq 0x20(%rsp), %rdi
leaq 0x2406(%rip), %rsi      # 0x13842
pushq $0x5
popq %rdx
callq 0x54c0
xorl %r13d, %r13d
testl %eax, %eax
sete %r13b
pushq $0x5
popq %r14
jmp 0x11498
cmpl $0x3c, %r12d
jne 0x114a8
testl %r14d, %r14d
jle 0x1146b
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xbac3
movb $0x3c, 0x20(%rsp)
pushq $0x1
popq %r13
movl %r13d, %r14d
jmp 0x113e9
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x23ea(%rip), %rsi      # 0x13873
movq (%rsp), %rdx
xorl %eax, %eax
callq 0xcd67
pushq $0x1
popq %r13
movslq %r14d, %rax
incl %r14d
movb %r12b, 0x20(%rsp,%rax)
jmp 0x113e9
leal 0x1(%rbp), %r14d
movb %r12b, 0x20(%rsp,%rbp)
movl $0x0, %r13d
cmpl $0x2000, %r14d          # imm = 0x2000
jne 0x113e9
jmp 0x115b9
movw $0x3e, 0x20(%rsp,%rbp)
cmpl $0x5, %r14d
jl 0x11538
leaq 0x20(%rsp), %rdi
leaq 0x2360(%rip), %rsi      # 0x13842
pushq $0x5
popq %rdx
callq 0x54c0
testl %eax, %eax
jne 0x11538
leaq 0x25(%rsp), %r14
movq %r14, %rdi
leaq 0x234b(%rip), %rsi      # 0x13848
pushq $0x7
popq %rdx
callq 0x54c0
testl %eax, %eax
je 0x11550
cmpl $0x63657865, (%r14)     # imm = 0x63657865
je 0x115cb
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0x2332(%rip), %rsi      # 0x13855
movq (%rsp), %rdx
leaq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0xcd67
jmp 0x113e6
incq %rbp
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0xbac3
jmp 0x113e3
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x10d18
leaq 0x2c(%rsp), %r14
movq %r14, %rdi
leaq 0x2320(%rip), %rsi      # 0x1388c
leaq 0x3020(%rsp), %r12
movq %r12, %rdx
xorl %eax, %eax
callq 0x5470
cmpl $0x1, %eax
jne 0x115dd
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
leaq 0x2020(%rsp), %r13
movq %r13, %rsi
leaq 0x1bf0(%rip), %rcx      # 0x13197
xorl %eax, %eax
pushq %r12
pushq $0x2f
callq 0x108b0
popq %rcx
popq %rdx
jmp 0x11688
movl $0x2000, %edx           # imm = 0x2000
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
jmp 0x11546
movq %rbx, %rdi
leaq 0x29(%rsp), %rsi
callq 0x11760
jmp 0x113e3
movq %r14, %rdi
leaq 0x22b6(%rip), %rsi      # 0x1389d
movq %r12, %rdx
xorl %eax, %eax
callq 0x5470
cmpl $0x1, %eax
leaq 0x2020(%rsp), %r13
jne 0x1160b
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %r13, %rsi
jmp 0x11677
movq %r14, %rdi
leaq 0x2296(%rip), %rsi      # 0x138ab
movq %r12, %rdx
xorl %eax, %eax
callq 0x5470
cmpl $0x1, %eax
jne 0x11723
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x2133(%rip), %rcx      # 0x1376d
movq (%rsp), %r8
xorl %eax, %eax
callq 0x108b0
movq %r13, %rdi
pushq $0x2f
popq %rsi
callq 0x5520
testq %rax, %rax
je 0x11659
movb $0x0, 0x1(%rax)
movq %r13, %rdi
callq 0x51e0
leaq (%rsp,%rax), %rsi
addq $0x2020, %rsi           # imm = 0x2020
movl $0x1000, %edx           # imm = 0x1000
subq %rax, %rdx
movq %rbx, %rdi
leaq 0x20ef(%rip), %rcx      # 0x1376d
movq %r12, %r8
xorl %eax, %eax
callq 0x108b0
movq %r13, %rdi
leaq 0x1ed0(%rip), %rsi      # 0x13562
callq 0x55a0
testq %rax, %rax
je 0x116d9
movq %rax, %r12
movq %rax, %rdi
callq 0x54e0
movl %eax, %edi
callq 0xdd7d
movq 0x458(%rbx), %rax
movq 0x40(%rax), %rsi
movq %r13, %rdi
callq 0x10ca6
movq %rbx, %rdi
testl %eax, %eax
je 0x11704
movq %r13, %rsi
movq %r12, %rdx
movl 0xc(%rsp), %ecx
callq 0x11398
jmp 0x11716
callq 0x5050
movl (%rax), %edi
callq 0x5170
movq %rbx, %rdi
leaq 0x21dc(%rip), %rsi      # 0x138cb
movq %r14, %rdx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xcd67
jmp 0x113e3
movq %r12, %rsi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
callq 0x1121e
movq %r12, %rdi
callq 0x5490
jmp 0x113e3
movq %rbx, %rdi
leaq 0x2187(%rip), %rsi      # 0x138b4
movq %r14, %rdx
xorl %eax, %eax
callq 0xcd67
jmp 0x113e3
testl %r14d, %r14d
jle 0x1174e
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0xbac3
addq $0x5028, %rsp           # imm = 0x5028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq