// File: nilnilnil[P]autocomplete/deps/mongoose/mongoose.c
// Function: log_access
static void log_access(const struct mg_connection *conn) {
  const struct mg_request_info *ri;
  FILE *fp;
  char date[64];

  fp = conn->ctx->config[ACCESS_LOG_FILE] == NULL ?  NULL :
    mg_fopen(conn->ctx->config[ACCESS_LOG_FILE], "a+");

  if (fp == NULL)
    return;

  (void) strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S %z",
      localtime(&conn->birth_time));

  ri = &conn->request_info;

  flockfile(fp);

  (void) fprintf(fp,
      "%s - %s [%s] \"%s %s HTTP/%s\" %d %" INT64_FMT,
      inet_ntoa(conn->client.rsa.u.sin.sin_addr),
      ri->remote_user == NULL ? "-" : ri->remote_user,
      date,
      ri->request_method ? ri->request_method : "-",
      ri->uri ? ri->uri : "-",
      ri->http_version,
      conn->request_info.status_code, conn->num_bytes_sent);
  log_header(conn, "Referer", fp);
  log_header(conn, "User-Agent", fp);
  (void) fputc('\n', fp);
  (void) fflush(fp);

  funlockfile(fp);
  (void) fclose(fp);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdi, 0xc8(%rsp)
movq 0xc8(%rsp), %rax
movq 0x458(%rax), %rax
cmpq $0x0, 0x48(%rax)
jne 0x1c06f
xorl %eax, %eax
movq %rax, 0x68(%rsp)
jmp 0x1c093
movq 0xc8(%rsp), %rax
movq 0x458(%rax), %rax
movq 0x48(%rax), %rdi
leaq 0x66f9(%rip), %rsi      # 0x22782
callq 0x56b0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0xb8(%rsp)
cmpq $0x0, 0xb8(%rsp)
jne 0x1c0b0
jmp 0x1c2b0
leaq 0x70(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xc8(%rsp), %rdi
addq $0x4a8, %rdi            # imm = 0x4A8
callq 0x53c0
movq 0x50(%rsp), %rdi
movq %rax, %rcx
movl $0x40, %esi
leaq 0x6e56(%rip), %rdx      # 0x22f38
callq 0x5440
movq 0xc8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xc0(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x51a0
movq 0xb8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xc8(%rsp), %rax
movl 0x490(%rax), %edi
callq 0x5240
movq %rax, 0x60(%rsp)
movq 0xc0(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x1c14a
leaq 0x6e42(%rip), %rax      # 0x22f85
movq %rax, 0x48(%rsp)
jmp 0x1c15b
movq 0xc0(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1c191
movq 0xc0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x1c19f
leaq 0x6ded(%rip), %rax      # 0x22f85
movq %rax, 0x30(%rsp)
jmp 0x1c19f
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xc0(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1c1cb
movq 0xc0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x1c1d9
leaq 0x6db3(%rip), %rax      # 0x22f85
movq %rax, 0x20(%rsp)
jmp 0x1c1d9
movq 0x28(%rsp), %r9
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rcx
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rbx
movq 0xc0(%rsp), %rax
movq 0x18(%rax), %r11
movq 0xc8(%rsp), %rax
movl 0x4c(%rax), %r10d
movq 0xc8(%rsp), %rax
movq 0x4b0(%rax), %rax
leaq 0x6d28(%rip), %rsi      # 0x22f4d
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x5850
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %rdx
leaq 0x6d1b(%rip), %rsi      # 0x22f71
callq 0x1d120
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %rdx
leaq 0x6d07(%rip), %rsi      # 0x22f79
callq 0x1d120
movq 0xb8(%rsp), %rsi
movl $0xa, %edi
callq 0x5730
movq 0xb8(%rsp), %rdi
callq 0x56a0
movq 0xb8(%rsp), %rdi
callq 0x5460
movq 0xb8(%rsp), %rdi
callq 0x5560
addq $0xd0, %rsp
popq %rbx
retq
nopl (%rax)