// File: /workspace/github_cpp_makefile_star2_O1/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 0x3a037
xorl %ebx, %ebx
jmp 0x3a80b
movq %rdi, %r12
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x78(%rdi), %rbx
movq %rbx, %rdi
callq 0x22390
testb %al, %al
je 0x3a078
leaq 0x28(%r12), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x218e0
jmp 0x3a106
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x40b7(%rip), %rsi      # 0x3e13f
leaq 0x40bc(%rip), %rdx      # 0x3e14b
leaq 0x60(%rsp), %rdi
callq 0x215e0
leaq 0x48(%r12), %rdi
leaq 0x60(%rsp), %rsi
callq 0x23330
movq 0x8(%rax), %rdx
leaq 0x690a(%rip), %rcx      # 0x409bd
movl $0x1f, %r8d
movq %rax, %rdi
xorl %esi, %esi
callq 0x22ca0
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a0d2
callq 0x22130
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22640
leaq 0xc0(%rsp), %rdi
leaq 0x60(%rsp), %rbx
movq %rbx, %rsi
callq 0x22620
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x3a106
callq 0x22130
movl (%r12), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x3a165
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x3a15c
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x3a162
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x3a165
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x3a129
addl $-0x3, %r14d
jmp 0x3a165
addl $-0x2, %r14d
jmp 0x3a165
decl %r14d
shrl $0x1f, %ebx
leal (%r14,%rbx), %esi
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x40(%rsp), %rdi
movl $0x2d, %edx
callq 0x22520
leaq 0x40(%rsp), %r15
addq (%r15), %rbx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x22a70
leaq 0x6808(%rip), %rcx      # 0x409a8
movl $0x9, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22460
leaq 0x30(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a1d9
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3a1e1
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 0x4efc(%rip), %rsi      # 0x3f100
callq 0x233d0
leaq 0x10(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a22f
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a237
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 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
callq 0x21440
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a287
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x3a291
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 0x66fe(%rip), %rsi      # 0x409b2
callq 0x233d0
leaq 0xb0(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a2e9
movq %rdx, 0xa0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb0(%rsp)
jmp 0x3a2f1
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 0x3a31b
callq 0x22130
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x3a329
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a33d
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a351
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 0x6596(%rip), %xmm0, %xmm0 # 0x4091c
vcvtss2sd %xmm0, %xmm0, %xmm0
movq 0x13997(%rip), %rsi     # 0x4dd28
leaq 0x669c(%rip), %rcx      # 0x40a34
leaq 0x20(%rsp), %rdi
movl $0x3a, %edx
movb $0x1, %al
callq 0x23080
leaq 0x662d(%rip), %rcx      # 0x409dd
leaq 0x20(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x22460
movq %rbx, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a3e5
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a3ed
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 0x65d7(%rip), %rsi      # 0x409e5
callq 0x233d0
movq %r13, 0x60(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a436
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x3a440
vmovups (%rcx), %xmm0
vmovups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
movq %rax, (%rdi)
leaq 0x61e3(%rip), %rsi      # 0x4064f
leaq 0x61e2(%rip), %rdx      # 0x40655
callq 0x215e0
leaq 0x48(%r12), %r14
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x23330
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rax, %rdi
callq 0x21440
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a4b0
callq 0x22130
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a4bf
callq 0x22130
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x3a4cd
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a4e1
callq 0x22130
movq 0xc8(%rsp), %rbx
movl $0x1, %eax
cmpq $0xa, %rbx
jb 0x3a542
movl $0x4, %eax
movabsq $0x346dc5d63886594b, %rcx # imm = 0x346DC5D63886594B
movq %rbx, %rdx
cmpq $0x63, %rdx
jbe 0x3a53b
cmpq $0x3e7, %rdx            # imm = 0x3E7
jbe 0x3a540
cmpq $0x2710, %rdx           # imm = 0x2710
jb 0x3a542
mulxq %rcx, %rsi, %rsi
shrq $0xb, %rsi
addl $0x4, %eax
cmpq $0x1869f, %rdx          # imm = 0x1869F
movq %rsi, %rdx
ja 0x3a506
addl $-0x3, %eax
jmp 0x3a542
addl $-0x2, %eax
jmp 0x3a542
decl %eax
movl %eax, %esi
leaq 0x60(%rsp), %rdi
movq %r13, (%rdi)
xorl %edx, %edx
callq 0x22520
leaq 0x60(%rsp), %r15
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq %rbx, %rdx
callq 0x22110
leaq 0x3bc2(%rip), %rsi      # 0x3e130
movq %r14, %rdi
movq %r15, %rdx
callq 0x21800
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a588
callq 0x22130
xorl %edi, %edi
callq 0x22090
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x220f0
leaq 0x6412(%rip), %rsi      # 0x409b5
leaq 0x60(%rsp), %rdx
movq %r14, %rdi
callq 0x216f0
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a5bf
callq 0x22130
movq 0x60(%r12), %r14
movq %r12, 0xe0(%rsp)
leaq 0x50(%r12), %r13
cmpq %r13, %r14
je 0x3a76e
leaq 0x40(%rsp), %r12
leaq 0x63cc(%rip), %rbp      # 0x409b2
leaq 0x20(%rsp), %rbx
leaq 0xa0(%rsp), %r15
leaq 0x20(%r14), %rsi
leaq 0x60(%rsp), %rdi
callq 0x21f40
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x21600
movq %r12, %rdi
leaq 0x6390(%rip), %rsi      # 0x409ba
callq 0x233d0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %r12, %rdi
callq 0x21440
leaq 0x30(%rsp), %rsi
movq %rsi, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a66f
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3a677
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 0x233d0
leaq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3a6c0
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3a6c8
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 (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x21440
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a704
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a718
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a72c
callq 0x22130
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3a746
callq 0x22130
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x3a75a
callq 0x22130
movq %r14, %rdi
callq 0x21be0
movq %rax, %r14
cmpq %r13, %rax
jne 0x3a5f3
leaq 0x623d(%rip), %rsi      # 0x409b2
leaq 0xa0(%rsp), %rdi
callq 0x233d0
movq 0xe0(%rsp), %r14
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x21440
movl 0x98(%r14), %edi
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movl $0x4040, %ecx           # imm = 0x4040
callq 0x217e0
movq %rax, %rbx
movl 0x98(%r14), %edi
callq 0x23470
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
leaq 0xd0(%rsp), %r14
je 0x3a7f9
callq 0x22130
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a80b
callq 0x22130
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a8c5
jmp 0x3a8c5
jmp 0x3a8c5
jmp 0x3a836
jmp 0x3a934
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
jne 0x3a92b
jmp 0x3a992
jmp 0x3a934
movq %rax, %rbx
jmp 0x3a8fa
movq %rax, %rbx
jmp 0x3a909
movq %rax, %rbx
jmp 0x3a91c
jmp 0x3a934
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a885
callq 0x22130
jmp 0x3a885
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a89d
callq 0x22130
jmp 0x3a89d
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a8b6
callq 0x22130
jmp 0x3a8b6
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
jmp 0x3a9a2
movq %rax, %rbx
jmp 0x3a9ac
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
jne 0x3a9a7
jmp 0x3a9ac
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a8fa
callq 0x22130
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a909
callq 0x22130
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a91c
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a992
callq 0x22130
jmp 0x3a992
jmp 0x3a934
movq %rax, %rbx
jmp 0x3a992
movq %rax, %rbx
jmp 0x3a988
jmp 0x3a940
movq %rax, %rbx
jmp 0x3a974
movq %rax, %rbx
jmp 0x3a960
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3a960
callq 0x22130
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3a974
callq 0x22130
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3a988
callq 0x22130
leaq 0x60(%rsp), %rdi
callq 0x21220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x3a9ac
callq 0x22130
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x3a9c6
callq 0x22130
movq %rbx, %rdi
callq 0x23170