// File: nilnilnil[P]autocomplete/deps/mongoose/mongoose.c
// Function: send_http_error
static void send_http_error(struct mg_connection *conn, int status,
                            const char *reason, const char *fmt, ...) {
  char buf[BUFSIZ];
  va_list ap;
  int len;

  conn->request_info.status_code = status;

  if (call_user(conn, MG_HTTP_ERROR) == NULL) {
    buf[0] = '\0';
    len = 0;

    /* Errors 1xx, 204 and 304 MUST NOT send a body */
    if (status > 199 && status != 204 && status != 304) {
      len = mg_snprintf(conn, buf, sizeof(buf), "Error %d: %s", status, reason);
      cry(conn, "%s", buf);
      buf[len++] = '\n';

      va_start(ap, fmt);
      len += mg_vsnprintf(conn, buf + len, sizeof(buf) - len, fmt, ap);
      va_end(ap);
    }
    DEBUG_TRACE(("[%s]", buf));

    mg_printf(conn, "HTTP/1.1 %d %s\r\n"
              "Content-Type: text/plain\r\n"
              "Content-Length: %d\r\n"
              "Connection: %s\r\n\r\n", status, reason, len,
              suggest_connection_header(conn));
    conn->num_bytes_sent += mg_printf(conn, "%s", buf);
  }
}

// Assembly:
subq $0x2128, %rsp           # imm = 0x2128
testb %al, %al
je 0x1bc82
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %r9, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq %rdi, 0x2120(%rsp)
movl %esi, 0x211c(%rsp)
movq %rdx, 0x2110(%rsp)
movq %rcx, 0x2108(%rsp)
movl 0x211c(%rsp), %ecx
movq 0x2120(%rsp), %rax
movl %ecx, 0x4c(%rax)
movq 0x2120(%rsp), %rdi
movl $0x1, %esi
callq 0x1a7d0
cmpq $0x0, %rax
jne 0x1beaa
movb $0x0, 0x100(%rsp)
movl $0x0, 0xdc(%rsp)
cmpl $0xc7, 0x211c(%rsp)
jle 0x1be14
cmpl $0xcc, 0x211c(%rsp)
je 0x1be14
cmpl $0x130, 0x211c(%rsp) # imm = 0x130
je 0x1be14
movq 0x2120(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movl 0x211c(%rsp), %r8d
movq 0x2110(%rsp), %r9
movl $0x2000, %edx           # imm = 0x2000
leaq 0x7157(%rip), %rcx      # 0x22ea2
movb $0x0, %al
callq 0x1cc90
movl %eax, 0xdc(%rsp)
movq 0x2120(%rsp), %rdi
leaq 0x100(%rsp), %rdx
leaq 0x7a08(%rip), %rsi      # 0x23778
movb $0x0, %al
callq 0x184e0
movl 0xdc(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0xdc(%rsp)
cltq
movb $0xa, 0x100(%rsp,%rax)
leaq 0xe0(%rsp), %rax
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x2130(%rsp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq 0x2120(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movslq 0xdc(%rsp), %rax
addq %rax, %rsi
movslq 0xdc(%rsp), %rax
movl $0x2000, %edx           # imm = 0x2000
subq %rax, %rdx
movq 0x2108(%rsp), %rcx
leaq 0xe0(%rsp), %r8
callq 0x17120
addl 0xdc(%rsp), %eax
movl %eax, 0xdc(%rsp)
leaq 0xe0(%rsp), %rax
movq 0x2120(%rsp), %rax
movq %rax, (%rsp)
movl 0x211c(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x2110(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0xdc(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x2120(%rsp), %rdi
callq 0x1cd70
movq (%rsp), %rdi
movl 0xc(%rsp), %edx
movq 0x10(%rsp), %rcx
movl 0x1c(%rsp), %r8d
movq %rax, %r9
leaq 0x7043(%rip), %rsi      # 0x22eaf
movb $0x0, %al
callq 0x17030
movq 0x2120(%rsp), %rdi
leaq 0x100(%rsp), %rdx
leaq 0x78ee(%rip), %rsi      # 0x23778
movb $0x0, %al
callq 0x17030
movslq %eax, %rcx
movq 0x2120(%rsp), %rax
addq 0x4b0(%rax), %rcx
movq %rcx, 0x4b0(%rax)
addq $0x2128, %rsp           # imm = 0x2128
retq
nopw %cs:(%rax,%rax)