// File: /workspace/github_cpp_makefile_star2_O3/alfanick[P]rest-cpp/src/rest/response.cpp
// Function: REST::Response::send()
size_t Response::send() {
  if (is_streamed)
    return 0;

  size_t bytes_sent = 0;

  std::string payload;

  if (!data.empty()) {
    headers["Content-Type"] = "application/json; charset=utf-8";
    payload = data.dump();
  } else {
    payload = raw;
  }

  // start http
  std::string content = "HTTP/1.1 " + std::to_string(status) + " " + status_message + "\r\n";

  // content size
  headers["Server"] += ", took " + std::to_string(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_time).count() / 1000.0f) + "ms";
  headers.emplace("Content-Length", std::to_string(payload.size()));
  headers.emplace("Date", Utils::rfc1123_datetime(time(0)));

  // add headers
  for (auto header : headers)
    content += header.first + ": " + header.second + "\r\n";

  content += "\r\n";

  content += payload;

  // send every byte
  bytes_sent = ::send(handle, content.c_str(), content.size(), MSG_DONTWAIT | MSG_NOSIGNAL);

  // close connection with client
  close(handle);

  return bytes_sent;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
cmpb $0x0, 0x9c(%rdi)
je 0x39e59
xorl %ebx, %ebx
jmp 0x3a62d
leaq 0xd0(%rsp), %rax
leaq 0x78(%rdi), %rbx
movq %rdi, %r12
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movq %rbx, %rdi
movb $0x0, (%rax)
callq 0x22390
testb %al, %al
je 0x39e9a
leaq 0x28(%r12), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x218e0
jmp 0x39f28
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3295(%rip), %rsi      # 0x3d13f
leaq 0x329a(%rip), %rdx      # 0x3d14b
leaq 0x60(%rsp), %rdi
callq 0x215e0
leaq 0x48(%r12), %rdi
leaq 0x60(%rsp), %rsi
callq 0x23320
movq 0x8(%rax), %rdx
leaq 0x5ae8(%rip), %rcx      # 0x3f9bd
movl $0x1f, %r8d
movq %rax, %rdi
xorl %esi, %esi
callq 0x22ca0
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x39ef4
callq 0x22130
leaq 0x60(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbx, %rsi
callq 0x22640
leaq 0x60(%rsp), %rbx
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
callq 0x22620
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x39f28
callq 0x22130
movl (%r12), %ebx
movl $0x1, %r14d
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
cmpl $0xa, %ebp
jb 0x39f87
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x39f7e
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x39f84
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x39f87
movl %ecx, %edx
imulq %rax, %rdx
addl $0x4, %r14d
shrq $0x2d, %rdx
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x39f4b
addl $-0x3, %r14d
jmp 0x39f87
addl $-0x2, %r14d
jmp 0x39f87
decl %r14d
shrl $0x1f, %ebx
leaq 0x50(%rsp), %rax
leal (%r14,%rbx), %esi
movq %rax, -0x10(%rax)
leaq 0x40(%rsp), %rdi
movl $0x2d, %edx
callq 0x22520
leaq 0x40(%rsp), %r15
movl %r14d, %esi
movl %ebp, %edx
addq (%r15), %rbx
movq %rbx, %rdi
callq 0x22a70
leaq 0x59e6(%rip), %rcx      # 0x3f9a8
movl $0x9, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22460
leaq 0x30(%rsp), %rsi
movq %rax, %rcx
addq $0x10, %rcx
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x39ffb
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3a003
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x40da(%rip), %rsi      # 0x3e100
callq 0x233c0
leaq 0x10(%rsp), %rbx
movq %rax, %rcx
addq $0x10, %rcx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a051
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a059
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%r12), %rdx
movq 0x8(%r12), %rsi
callq 0x21440
leaq 0x70(%rsp), %r13
movq %rax, %rcx
addq $0x10, %rcx
movq %r13, -0x10(%r13)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a0a9
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x3a0b3
vmovups (%rcx), %xmm0
vmovups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x58dc(%rip), %rsi      # 0x3f9b2
callq 0x233c0
leaq 0xb0(%rsp), %rsi
movq %rax, %rcx
addq $0x10, %rcx
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a10b
movq %rdx, 0xa0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb0(%rsp)
jmp 0x3a113
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0xa8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a13d
callq 0x22130
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x3a14b
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a15f
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a173
callq 0x22130
callq 0x210d0
subq 0x88(%r12), %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
vcvtsi2ss %rdx, %xmm1, %xmm0
vdivss 0x5774(%rip), %xmm0, %xmm0 # 0x3f91c
vcvtss2sd %xmm0, %xmm0, %xmm0
movq 0x12b75(%rip), %rsi     # 0x4cd28
leaq 0x587a(%rip), %rcx      # 0x3fa34
leaq 0x20(%rsp), %rdi
movl $0x3a, %edx
movb $0x1, %al
callq 0x23070
leaq 0x580b(%rip), %rcx      # 0x3f9dd
leaq 0x20(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x22460
movq %rbx, (%rsp)
movq %rax, %rcx
addq $0x10, %rcx
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a207
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a20f
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x57b5(%rip), %rsi      # 0x3f9e5
callq 0x233c0
movq %r13, 0x60(%rsp)
movq %rax, %rcx
addq $0x10, %rcx
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a258
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x3a262
vmovups (%rcx), %xmm0
vmovups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rdi
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
leaq 0x50(%rsp), %rcx
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rcx, (%rdi)
leaq 0x53c1(%rip), %rsi      # 0x3f64f
leaq 0x53c0(%rip), %rdx      # 0x3f655
callq 0x215e0
leaq 0x48(%r12), %r14
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x23320
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq %rax, %rdi
callq 0x21440
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a2d2
callq 0x22130
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a2e1
callq 0x22130
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x3a2ef
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a303
callq 0x22130
movq 0xc8(%rsp), %rbx
movl $0x1, %eax
cmpq $0xa, %rbx
jb 0x3a364
movl $0x4, %eax
movabsq $0x346dc5d63886594b, %rcx # imm = 0x346DC5D63886594B
movq %rbx, %rdx
cmpq $0x63, %rdx
jbe 0x3a35d
cmpq $0x3e7, %rdx            # imm = 0x3E7
jbe 0x3a362
cmpq $0x2710, %rdx           # imm = 0x2710
jb 0x3a364
mulxq %rcx, %rsi, %rsi
addl $0x4, %eax
shrq $0xb, %rsi
cmpq $0x1869f, %rdx          # imm = 0x1869F
movq %rsi, %rdx
ja 0x3a328
addl $-0x3, %eax
jmp 0x3a364
addl $-0x2, %eax
jmp 0x3a364
decl %eax
leaq 0x60(%rsp), %rdi
movl %eax, %esi
movq %r13, (%rdi)
xorl %edx, %edx
callq 0x22520
leaq 0x60(%rsp), %r15
movq %rbx, %rdx
movq (%r15), %rdi
movl 0x8(%r15), %esi
callq 0x22110
leaq 0x2da0(%rip), %rsi      # 0x3d130
movq %r14, %rdi
movq %r15, %rdx
callq 0x21800
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a3aa
callq 0x22130
xorl %edi, %edi
callq 0x22090
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x220f0
leaq 0x55f0(%rip), %rsi      # 0x3f9b5
leaq 0x60(%rsp), %rdx
movq %r14, %rdi
callq 0x216f0
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a3e1
callq 0x22130
movq 0x60(%r12), %r14
leaq 0x50(%r12), %r13
movq %r12, 0xe0(%rsp)
cmpq %r13, %r14
je 0x3a590
leaq 0x40(%rsp), %r12
leaq 0x55aa(%rip), %rbp      # 0x3f9b2
leaq 0x20(%rsp), %rbx
leaq 0xa0(%rsp), %r15
leaq 0x20(%r14), %rsi
leaq 0x60(%rsp), %rdi
callq 0x21f40
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
addq %rsi, %rdx
movq %r12, %rdi
callq 0x21600
leaq 0x5571(%rip), %rsi      # 0x3f9ba
movq %r12, %rdi
callq 0x233c0
movq 0x88(%rsp), %rdx
movq 0x80(%rsp), %rsi
movq %r12, %rdi
callq 0x21440
leaq 0x30(%rsp), %rsi
movq %rax, %rcx
addq $0x10, %rcx
movq %rsi, 0x20(%rsp)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a491
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3a499
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x233c0
leaq 0x10(%rsp), %rsi
movq %rax, %rcx
addq $0x10, %rcx
movq %rsi, (%rsp)
movq (%rax), %rdx
cmpq %rcx, %rdx
je 0x3a4e2
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a4ea
vmovups (%rcx), %xmm0
vmovups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdx
movq (%rsp), %rsi
movq %r15, %rdi
callq 0x21440
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a526
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a53a
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a54e
callq 0x22130
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3a568
callq 0x22130
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x3a57c
callq 0x22130
movq %r14, %rdi
callq 0x21be0
movq %rax, %r14
cmpq %r13, %rax
jne 0x3a415
leaq 0x541b(%rip), %rsi      # 0x3f9b2
leaq 0xa0(%rsp), %rdi
callq 0x233c0
movq 0xe0(%rsp), %r14
movq 0xc8(%rsp), %rdx
movq 0xc0(%rsp), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x21440
movq 0xa8(%rsp), %rdx
movl 0x98(%r14), %edi
movq 0xa0(%rsp), %rsi
movl $0x4040, %ecx           # imm = 0x4040
callq 0x217e0
movl 0x98(%r14), %edi
movq %rax, %rbx
callq 0x23460
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
leaq 0xd0(%rsp), %r14
cmpq %rax, %rdi
je 0x3a61b
callq 0x22130
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a62d
callq 0x22130
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a6e7
jmp 0x3a6e7
jmp 0x3a6e7
jmp 0x3a658
jmp 0x3a756
movq 0x60(%rsp), %rdi
movq %rax, %rbx
cmpq %r13, %rdi
jne 0x3a74d
jmp 0x3a7b4
jmp 0x3a756
movq %rax, %rbx
jmp 0x3a71c
movq %rax, %rbx
jmp 0x3a72b
movq %rax, %rbx
jmp 0x3a73e
jmp 0x3a756
movq 0x60(%rsp), %rdi
movq %rax, %rbx
cmpq %r13, %rdi
je 0x3a6a7
callq 0x22130
jmp 0x3a6a7
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a6bf
callq 0x22130
jmp 0x3a6bf
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a6d8
callq 0x22130
jmp 0x3a6d8
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
jmp 0x3a7c4
movq %rax, %rbx
jmp 0x3a7ce
movq 0x60(%rsp), %rdi
movq %rax, %rbx
cmpq %r14, %rdi
jne 0x3a7c9
jmp 0x3a7ce
movq 0x40(%rsp), %rdi
movq %rax, %rbx
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a71c
callq 0x22130
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a72b
callq 0x22130
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a73e
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a7b4
callq 0x22130
jmp 0x3a7b4
jmp 0x3a756
movq %rax, %rbx
jmp 0x3a7b4
movq %rax, %rbx
jmp 0x3a7aa
jmp 0x3a762
movq %rax, %rbx
jmp 0x3a796
movq %rax, %rbx
jmp 0x3a782
movq (%rsp), %rdi
movq %rax, %rbx
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a782
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a796
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a7aa
callq 0x22130
leaq 0x60(%rsp), %rdi
callq 0x21220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x3a7ce
callq 0x22130
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x3a7e8
callq 0x22130
movq %rbx, %rdi
callq 0x23160