// File: /workspace/github_cpp_makefile_star2_O1/dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::resendCheckStatus(int, int, int, std::vector<char, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void resendCheckStatus(int client_id, int client_fd, int server_fd, const std::vector<char> & content_to_send, const std::string & url)
	{
		// re-send the inserted message to the server
		int sent_length = 0;
		int N = content_to_send.size();
		while(sent_length < N)
		{
			int len = send(server_fd, &content_to_send.data()[0] + sent_length, N - sent_length, 0);
			if(len == -1)
			{
				throw ProxyException("Send with If-None-Match/If-Modified-Since error");
			}
			sent_length += len;
		}

		// receive header from server and decide by the status code
		std::vector<char> buffer(BUFFER_SIZE, '\0'); // buffer to store header temporarily
		int len = recv(server_fd, &buffer.data()[0], BUFFER_SIZE, 0);
		if(len == -1)
		{
			throw ProxyException("Receive with If-None-Match/If-Modified-Since error");
		}
		buffer[len] = '\0';

		// check header status
		const std::string header(buffer.begin(), buffer.begin() + len);
		bool status_304 = checkStatusCode(header);

		// if get true(status code 304), directly return cached content
		if(status_304)
		{
			// write first line of response to log
			std::string first_line = parser.extractFirstLine(header);
			std::string log_content = std::to_string(client_id) + ": Received " + first_line + " from " + url;
			logger.log(log_content);
			log_content = std::to_string(client_id) + ": Responding " + first_line;
			logger.log(log_content);

			// respond to the client with client
			respondCached(client_fd, url);
			return;
		}

		// if get false(status code 200), receive all the sent, and send to the client
		std::vector<std::vector<char>> segment;
		segment.push_back(std::vector<char>(buffer.begin(), buffer.begin() + len));

		// respond header to client, send every character in the buffer to client
		// true for send success, false for send error
		bool respondClient_suc = respondClient(client_fd, buffer, len);
		if(!respondClient_suc) 
		{
			throw ProxyException("Respond header to client error");
		}

		// receive content from server and send it to client segment by segment
		try
		{
			std::string httpAction = "GET"; // for resend, the http action has to be "GET"
			getResponse(client_id, client_fd, server_fd, url, header, segment, len, httpAction);	
		}
		catch(std::exception & e)
		{
			throw e;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, %rbp
movl %ecx, %r14d
movl %edx, 0xc(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movl 0x8(%r8), %r15d
subl (%r8), %r15d
testl %r15d, %r15d
jle 0x77db
movq %r8, %rbx
xorl %r12d, %r12d
movslq %r12d, %rax
movq (%rbx), %rsi
addq %rax, %rsi
movl %r15d, %ecx
subl %eax, %ecx
movslq %ecx, %rdx
movl %r14d, %edi
xorl %ecx, %ecx
callq 0x31b0
cmpl $-0x1, %eax
je 0x7ed4
addl %eax, %r12d
cmpl %r15d, %r12d
jl 0x77af
movl $0x10000, %edi          # imm = 0x10000
callq 0x3330
movq %rax, %rbx
movl $0x10000, %edx          # imm = 0x10000
movq %rax, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x10000, %edx          # imm = 0x10000
movl %r14d, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x3100
movq %rax, %r15
cmpl $-0x1, %r15d
je 0x7f38
movslq %r15d, %rax
leaq (%rbx,%rax), %r13
movb $0x0, (%rbx,%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xc8(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xa5fc
leaq 0xc8(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x91fa
testb %al, %al
je 0x78f2
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
movl $0xd, %esi
xorl %edx, %edx
callq 0x33e0
movslq %eax, %rcx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3360
movq 0x30(%rsp), %r14
movl %r14d, %r13d
negl %r13d
cmovsl %r14d, %r13d
movl $0x1, %r15d
cmpl $0xa, %r13d
jb 0x7a1f
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0x7a16
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x7a1c
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x7a1f
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x78b0
addl $-0x3, %r15d
jmp 0x7a1f
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rcx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x6e9e
movq %rbp, 0xa0(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa66c
movq %rbx, %rbp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x794c
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3340
movslq %r15d, %r13
xorl %r12d, %r12d
xorl %ecx, %ecx
cmpl %r15d, %ecx
jge 0x7988
movl %ecx, %ebx
movslq %ecx, %rsi
addq %rbp, %rsi
movl 0xc(%rsp), %edi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x31b0
cmpl $-0x1, %eax
movl %eax, %ecx
cmovel %r12d, %ecx
addl %ebx, %ecx
cmpl $-0x1, %eax
jne 0x7954
cmpl %r15d, %ebx
jl 0x7f9f
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x57a2(%rip), %rsi      # 0xd13b
leaq 0x579e(%rip), %rdx      # 0xd13e
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x3c86
subq $0x8, %rsp
leaq 0xd0(%rsp), %r9
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x14(%rsp), %edx
movl %r14d, %ecx
movq 0xa8(%rsp), %r8
pushq %r13
pushq %r15
leaq 0x58(%rsp), %rax
pushq %rax
callq 0x9258
addq $0x20, %rsp
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x79fc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3340
leaq 0x40(%rsp), %rdi
callq 0x3f6a
movq %rbp, %rbx
leaq 0xd8(%rsp), %r12
jmp 0x7e98
addl $-0x2, %r15d
jmp 0x7a1f
decl %r15d
movq %rbp, %r12
shrl $0x1f, %r14d
leal (%r15,%r14), %esi
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xe8(%rsp), %rdi
movl $0x2d, %edx
callq 0x3390
movq %r14, %rbp
movl %r14d, %eax
leaq 0xe8(%rsp), %r14
movq (%r14), %rdi
movq %rax, 0x30(%rsp)
addq %rax, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x71bb
leaq 0x59c2(%rip), %rsi      # 0xd435
movq %r14, %rdi
callq 0x3550
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7aa2
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x7aa9
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rbp, %r14
movq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x30e0
movq %r12, %rbp
leaq 0xb8(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7b0d
movq %rsi, %r12
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x7b16
movups (%rcx), %xmm0
movq %rsi, %r12
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0xa8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x55ce(%rip), %rsi      # 0xd10a
callq 0x3550
leaq 0x90(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7b71
movq %rdx, 0x80(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
jmp 0x7b77
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x80(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
callq 0x30e0
leaq 0x50(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7bca
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x7bd0
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x7c0d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7c2a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x7c41
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x7c66
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0x38(%rsp), %rax
leaq 0x8(%rax), %rdi
leaq 0x40(%rsp), %rsi
movq %rdi, 0xa0(%rsp)
callq 0x5714
movl $0x1, %r15d
cmpl $0xa, %r13d
jb 0x7cd7
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0x7cce
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x7cd4
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x7cd7
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x7c9b
addl $-0x3, %r15d
jmp 0x7cd7
addl $-0x2, %r15d
jmp 0x7cd7
decl %r15d
addl %r15d, %r14d
leaq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
movq %rax, (%rdi)
movq %r14, %rsi
movl $0x2d, %edx
callq 0x3390
leaq 0x60(%rsp), %r14
movq 0x30(%rsp), %rdi
addq (%r14), %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x71bb
leaq 0x572e(%rip), %rsi      # 0xd441
movq %r14, %rdi
callq 0x3550
movq %r12, 0xa8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x70(%rsp), %r15
leaq 0x90(%rsp), %r13
je 0x7d54
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x7d5c
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0xa8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x30e0
movq %r13, 0x80(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7db6
movq %rdx, 0x80(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
jmp 0x7dbe
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x80(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x33b0
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x7e02
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7e1f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e36
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3340
leaq 0x40(%rsp), %rsi
movq 0xa0(%rsp), %rdi
callq 0x5714
movq 0x38(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %rbp, %rdx
callq 0x7452
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7e75
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3340
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0xd8(%rsp), %r12
je 0x7e98
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3340
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7eb5
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3340
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdi
callq 0x3340
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x158(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x54de(%rip), %rsi      # 0xd3d2
leaq 0x5506(%rip), %rdx      # 0xd401
leaq 0x148(%rsp), %rdi
callq 0x3c86
movb $0x1, %bpl
leaq 0x148(%rsp), %rsi
movq %rbx, %rdi
callq 0x6aa8
xorl %ebp, %ebp
leaq 0x9de4(%rip), %rsi      # 0x11d08
leaq -0x1439(%rip), %rdx     # 0x6af2
movq %rbx, %rdi
callq 0x34e0
jmp 0x80a4
movq %rbx, %rbp
movl $0x28, %edi
callq 0x31a0
movq %rax, %r15
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x54a6(%rip), %rsi      # 0xd402
leaq 0x54d1(%rip), %rdx      # 0xd434
leaq 0x128(%rsp), %rdi
callq 0x3c86
movb $0x1, %bl
leaq 0x128(%rsp), %rsi
movq %r15, %rdi
callq 0x6aa8
xorl %ebx, %ebx
leaq 0x9d7d(%rip), %rsi      # 0x11d08
leaq -0x14a0(%rip), %rdx     # 0x6af2
movq %r15, %rdi
callq 0x34e0
jmp 0x80a4
movl $0x28, %edi
callq 0x31a0
movq %rax, %r15
leaq 0x118(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x548f(%rip), %rsi      # 0xd44f
leaq 0x54a6(%rip), %rdx      # 0xd46d
leaq 0x108(%rsp), %rdi
callq 0x3c86
movb $0x1, %bl
leaq 0x108(%rsp), %rsi
movq %r15, %rdi
callq 0x6aa8
xorl %ebx, %ebx
leaq 0x9d19(%rip), %rsi      # 0x11d08
leaq -0x1504(%rip), %rdx     # 0x6af2
movq %r15, %rdi
callq 0x34e0
jmp 0x80a4
movq %rax, %r14
movq 0x108(%rsp), %rdi
cmpq %r12, %rdi
je 0x802a
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x802a
movq %rax, %r14
movb $0x1, %bl
testb %bl, %bl
je 0x827f
movq %r15, %rdi
callq 0x3250
jmp 0x827f
movq %rdx, %r15
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x8064
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8064
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x827f
movq %r14, %rdi
callq 0x3130
movl $0x8, %edi
callq 0x31a0
movq 0x9f31(%rip), %rcx      # 0x11fb8
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x9f3b(%rip), %rsi      # 0x11fd0
movq 0x9f54(%rip), %rdx      # 0x11ff0
movq %rax, %rdi
callq 0x34e0
movq %rax, %r14
callq 0x34c0
jmp 0x827f
movq %rax, %rdi
callq 0x3d16
movq %rbx, %rbp
movq %rax, %r14
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
je 0x80e4
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x80e4
movq %rbx, %rbp
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x8243
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8243
jmp 0x823d
movq %rbx, %rbp
movq %rax, %r14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8141
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8141
movq %rbx, %rbp
movq %rax, %r14
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
je 0x8166
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8166
movq %rbx, %rbp
movq %rax, %r14
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x8185
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8185
movq %rbx, %rbp
movq %rax, %r14
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x825f
movq 0xf8(%rsp), %rsi
jmp 0x8257
movq %rbx, %rbp
movq %rax, %r14
jmp 0x825f
movq %rbx, %rbp
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x827f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3340
jmp 0x827f
movq %rbx, %rbp
jmp 0x827c
movq %rbx, %rbp
movq %rax, %r14
jmp 0x8289
movq %rax, %r14
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0x8216
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8216
movq %rax, %r14
movb $0x1, %bl
testb %bl, %bl
je 0x82ae
movq %r15, %rdi
callq 0x3250
jmp 0x82ae
jmp 0x822d
movq %rbx, %rbp
movq %rax, %r14
jmp 0x82ae
movq %rax, %r14
jmp 0x82f2
movq %rbx, %rbp
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x825f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3340
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8289
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x8289
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x3f6a
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x82ae
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3340
movl $0x10000, %esi          # imm = 0x10000
movq %rbp, %rdi
callq 0x3340
jmp 0x82f2
movq %rax, %r14
movq 0x148(%rsp), %rdi
cmpq %r15, %rdi
je 0x82e5
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3340
jmp 0x82e5
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x82f2
movq %rbx, %rdi
callq 0x3250
movq %r14, %rdi
callq 0x3510