// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_template
void mg_template(struct mg_connection *conn, const char *s,
                 struct mg_expansion *expansions) {
  int i, j, pos = 0, inside_marker = 0;

  for (i = 0; s[i] != '\0'; i++) {
    if (inside_marker == 0 && !memcmp(&s[i], "{{", 2)) {
      if (i > pos) {
        mg_send_data(conn, &s[pos], i - pos);
      }
      pos = i;
      inside_marker = 1;
    }
    if (inside_marker == 1 && !memcmp(&s[i], "}}", 2)) {
      for (j = 0; expansions[j].keyword != NULL; j++) {
        const char *kw = expansions[j].keyword;
        if ((int) strlen(kw) == i - (pos + 2) &&
            memcmp(kw, &s[pos + 2], i - (pos + 2)) == 0) {
          expansions[j].handler(conn);
          pos = i + 2;
          break;
        }
      }
      inside_marker = 0;
    }
  }
  if (i > pos) {
    mg_send_data(conn, &s[pos], i - pos);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xb14ff
cmpl $0x0, -0x28(%rbp)
jne 0xb1410
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movw (%rax), %ax
subw $0x7b7b, %ax            # imm = 0x7B7B
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb1410
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0xb1403
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
movl -0x1c(%rbp), %edx
subl -0x24(%rbp), %edx
callq 0xb1530
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0x1, -0x28(%rbp)
jne 0xb14ef
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movw (%rax), %ax
subw $0x7d7d, %ax            # imm = 0x7D7D
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xb14ef
movl $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xb14e8
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xd550
movl -0x1c(%rbp), %ecx
movl -0x24(%rbp), %edx
addl $0x2, %edx
subl %edx, %ecx
cmpl %ecx, %eax
jne 0xb14d8
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %eax
addl $0x2, %eax
cltq
addq %rax, %rsi
movl -0x1c(%rbp), %eax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
subl %ecx, %eax
movslq %eax, %rdx
callq 0xddb0
cmpl $0x0, %eax
jne 0xb14d8
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0xb14e8
jmp 0xb14da
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xb1442
movl $0x0, -0x28(%rbp)
jmp 0xb14f1
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb13a9
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0xb1521
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x24(%rbp), %rax
addq %rax, %rsi
movl -0x1c(%rbp), %edx
subl -0x24(%rbp), %edx
callq 0xb1530
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)