// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/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[IOBUF_SIZE];
  int ch, offset, len, in_ssi_tag;

  if (include_level > 10) {
    mg_printf(conn, "SSI #include level is too deep (%s)", path);
    return;
  }

  in_ssi_tag = len = offset = 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(MONGOOSE_NO_POPEN)
        } else if (!memcmp(buf + 5, "exec", 4)) {
          do_ssi_exec(conn, buf + 9);
#endif // !NO_POPEN
        } else {
          mg_printf(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) {
        mg_printf(conn, "%s: SSI tag is too large", path);
        len = 0;
      }
      buf[len++] = ch & 0xff;
    } else if (ch == '<') {
      in_ssi_tag = 1;
      if (len > 0) {
        mg_write(conn, buf, (size_t) len);
      }
      len = 0;
      buf[len++] = ch & 0xff;
    } else {
      buf[len++] = ch & 0xff;
      if (len == (int) sizeof(buf)) {
        mg_write(conn, buf, (size_t) len);
        len = 0;
      }
    }
  }

  // Send the rest of buffered data
  if (len > 0) {
    mg_write(conn, buf, (size_t) len);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2030, %rsp           # imm = 0x2030
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpl $0xa, -0x1c(%rbp)
jle 0xb84ab
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xf5e3(%rip), %rsi      # 0xc7a82
movb $0x0, %al
callq 0xb0cb0
jmp 0xb87c4
movl $0x0, -0x2028(%rbp)
movl $0x0, -0x202c(%rbp)
movl $0x0, -0x2030(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd830
movl %eax, -0x2024(%rbp)
cmpl $-0x1, %eax
je 0xb87a4
cmpl $0x0, -0x2030(%rbp)
je 0xb8646
cmpl $0x3e, -0x2024(%rbp)
jne 0xb8646
movl $0x0, -0x2030(%rbp)
movl -0x2024(%rbp), %eax
movb %al, %cl
movl -0x202c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x202c(%rbp)
cltq
movb %cl, -0x2020(%rbp,%rax)
movslq -0x202c(%rbp), %rax
movb $0x0, -0x2020(%rbp,%rax)
cmpl $0x2000, -0x202c(%rbp)  # imm = 0x2000
jg 0xb8544
jmp 0xb8563
leaq 0xf55b(%rip), %rdi      # 0xc7aa6
leaq 0xe609(%rip), %rsi      # 0xc6b5b
movl $0x1125, %edx           # imm = 0x1125
leaq 0xf561(%rip), %rcx      # 0xc7abf
callq 0xd280
cmpl $0x6, -0x202c(%rbp)
jl 0xb8589
leaq -0x2020(%rbp), %rdi
leaq 0xf58b(%rip), %rsi      # 0xc7b05
movl $0x5, %edx
callq 0xddb0
cmpl $0x0, %eax
je 0xb85a5
movq -0x8(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movslq -0x202c(%rbp), %rdx
callq 0xb1580
jmp 0xb8637
leaq -0x2020(%rbp), %rdi
addq $0x5, %rdi
leaq 0xc1eb(%rip), %rsi      # 0xc47a2
movl $0x7, %edx
callq 0xddb0
cmpl $0x0, %eax
jne 0xb85e3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x2020(%rbp), %rdx
addq $0xc, %rdx
movl -0x1c(%rbp), %ecx
callq 0xb87d0
jmp 0xb8635
leaq -0x2020(%rbp), %rax
addq $0x5, %rax
movl (%rax), %eax
subl $0x63657865, %eax       # imm = 0x63657865
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb8616
movq -0x8(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
addq $0x9, %rsi
callq 0xb8ac0
jmp 0xb8633
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq -0x2020(%rbp), %rcx
leaq 0xf4e4(%rip), %rsi      # 0xc7b10
movb $0x0, %al
callq 0xb0cb0
jmp 0xb8635
jmp 0xb8637
movl $0x0, -0x202c(%rbp)
jmp 0xb879f
cmpl $0x0, -0x2030(%rbp)
je 0xb86df
cmpl $0x5, -0x202c(%rbp)
jne 0xb8685
leaq -0x2020(%rbp), %rdi
leaq 0xf49b(%rip), %rsi      # 0xc7b05
movl $0x5, %edx
callq 0xddb0
cmpl $0x0, %eax
je 0xb8685
movl $0x0, -0x2030(%rbp)
jmp 0xb86b3
cmpl $0x1ffe, -0x202c(%rbp)  # imm = 0x1FFE
jne 0xb86b1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xf48e(%rip), %rsi      # 0xc7b2e
movb $0x0, %al
callq 0xb0cb0
movl $0x0, -0x202c(%rbp)
jmp 0xb86b3
movl -0x2024(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movl -0x202c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x202c(%rbp)
cltq
movb %cl, -0x2020(%rbp,%rax)
jmp 0xb879d
cmpl $0x3c, -0x2024(%rbp)
jne 0xb8745
movl $0x1, -0x2030(%rbp)
cmpl $0x0, -0x202c(%rbp)
jle 0xb8712
movq -0x8(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movslq -0x202c(%rbp), %rdx
callq 0xb1580
movl $0x0, -0x202c(%rbp)
movl -0x2024(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movl -0x202c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x202c(%rbp)
cltq
movb %cl, -0x2020(%rbp,%rax)
jmp 0xb879b
movl -0x2024(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movl -0x202c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x202c(%rbp)
cltq
movb %cl, -0x2020(%rbp,%rax)
cmpl $0x2000, -0x202c(%rbp)  # imm = 0x2000
jne 0xb8799
movq -0x8(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movslq -0x202c(%rbp), %rdx
callq 0xb1580
movl $0x0, -0x202c(%rbp)
jmp 0xb879b
jmp 0xb879d
jmp 0xb879f
jmp 0xb84c9
cmpl $0x0, -0x202c(%rbp)
jle 0xb87c4
movq -0x8(%rbp), %rdi
leaq -0x2020(%rbp), %rsi
movslq -0x202c(%rbp), %rdx
callq 0xb1580
addq $0x2030, %rsp           # imm = 0x2030
popq %rbp
retq
nopl (%rax)