// File: dentiny[P]HTTP-Cache-Proxy/./Parser.hpp
// Function: Parser::extractKV(Response&)
void extractKV(Response & response)
	{
		// extract k-v pair header
		const std::string & header = response.header;
		std::unordered_map<std::string, std::string> & kv = response.kv; 
		unsigned idx1 = header.find_first_of("\r\n"); // the first line status and kv-pair is seperated by \r\n
		unsigned idx2 = header.find_first_of("\r\n\r\n"); // header and content is seperated by \r\n\r\n
		std::string kv_header = header.substr(idx1 + 2, idx2 - idx1 - 2); // extract the real header in k-v pair

		// extract k-v pair to the unordered_map
		int N = kv_header.length();
		std::string key;
		std::string val;
		std::string temp;
		for(int idx = 0; idx < N; ++idx)
		{
			char c = kv_header[idx];

			// \r\n the seperator of lines
			if(c == '\r' && idx + 1 <= N - 1 && kv_header[idx + 1] == '\n')
			{
				pushClear(temp, val);
				kv.insert(std::make_pair(key, val));
				key.clear();
				val.clear();
				++idx;
			}

			// : the seperator of key-value pair
			else if(c == ':' && idx + 1 <= N - 1 && kv_header[idx + 1] == ' ')
			{
				pushClear(temp, key);
				++idx;
			}

			// normal characters
			else
			{
				temp += c;
			}
		}
		pushClear(temp, val);
		kv.insert(std::make_pair(key, val));
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x10(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x64ac(%rip), %rsi      # 0x1951f
xorl %eax, %eax
movl %eax, %edx
callq 0x41d0
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x6493(%rip), %rsi      # 0x1951d
xorl %eax, %eax
movl %eax, %edx
callq 0x41d0
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movl %eax, %edx
movl -0x28(%rbp), %eax
subl -0x24(%rbp), %eax
subl $0x2, %eax
movl %eax, %eax
movl %eax, %ecx
leaq -0x48(%rbp), %rdi
callq 0x43f0
leaq -0x48(%rbp), %rdi
callq 0x4580
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4510
leaq -0x90(%rbp), %rdi
callq 0x4510
leaq -0xb0(%rbp), %rdi
callq 0x4510
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x1330e
movslq -0xb4(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x4700
movq %rax, -0x178(%rbp)
jmp 0x13119
movq -0x178(%rbp), %rax
movb (%rax), %al
movb %al, -0xb5(%rbp)
movsbl -0xb5(%rbp), %eax
cmpl $0xd, %eax
jne 0x1326a
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x1326a
movl -0xb4(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x4700
movq %rax, -0x180(%rbp)
jmp 0x1316c
movq -0x180(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x1326a
movq -0x170(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0xa6e0
jmp 0x1319b
movq -0x20(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x13e70
jmp 0x131bf
movq -0x188(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x13e30
movb %dl, -0x191(%rbp)
movq %rax, -0x190(%rbp)
jmp 0x131e1
movb -0x191(%rbp), %al
movq -0x190(%rbp), %rcx
movq %rcx, -0x118(%rbp)
movb %al, -0x110(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x13eb0
leaq -0x70(%rbp), %rdi
callq 0x44e0
leaq -0x90(%rbp), %rdi
callq 0x44e0
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x132f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x133e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x13eb0
jmp 0x133e7
movsbl -0xb5(%rbp), %eax
cmpl $0x3a, %eax
jne 0x132df
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x132df
movl -0xb4(%rbp), %eax
incl %eax
movslq %eax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x4700
movq %rax, -0x1a0(%rbp)
jmp 0x132a6
movq -0x1a0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x132df
movq -0x170(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xa6e0
jmp 0x132ce
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x132f6
movsbl -0xb5(%rbp), %esi
leaq -0xb0(%rbp), %rdi
callq 0x4260
jmp 0x132f4
jmp 0x132f6
jmp 0x132f8
jmp 0x132fa
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x130f1
movq -0x170(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0xa6e0
jmp 0x1332a
movq -0x20(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x13e70
jmp 0x1334e
movq -0x1a8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x13e30
movb %dl, -0x1b1(%rbp)
movq %rax, -0x1b0(%rbp)
jmp 0x13370
movb -0x1b1(%rbp), %al
movq -0x1b0(%rbp), %rcx
movq %rcx, -0x168(%rbp)
movb %al, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x13eb0
leaq -0xb0(%rbp), %rdi
callq 0x4250
leaq -0x90(%rbp), %rdi
callq 0x4250
leaq -0x70(%rbp), %rdi
callq 0x4250
leaq -0x48(%rbp), %rdi
callq 0x4250
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x13eb0
leaq -0xb0(%rbp), %rdi
callq 0x4250
leaq -0x90(%rbp), %rdi
callq 0x4250
leaq -0x70(%rbp), %rdi
callq 0x4250
leaq -0x48(%rbp), %rdi
callq 0x4250
movq -0xc0(%rbp), %rdi
callq 0x4640
nopl (%rax)