LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::insertSectionToContent(std::vector<char, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::vector<char> insertSectionToContent(const std::vector<char> & content, const std::string & section)
	{
		int idx = findFirstLine(content); // idx is the index of the '\r' in the first line of response
		std::vector<char> content_to_send(content.begin(), content.begin() + idx);
		for(char c : section) content_to_send.push_back(c);
		content_to_send.insert(content_to_send.end(), content.begin() + idx, content.end());
		return content_to_send;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0xb8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xf780
movl %eax, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9e20
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9e20
movq %rax, -0x40(%rbp)
movslq -0x24(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xf800
movq %rax, -0x38(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x4650
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rcx
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xf840
jmp 0xb928
leaq -0x41(%rbp), %rdi
callq 0x4420
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x43b0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x4690
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xf8c0
testb $0x1, %al
jne 0xb966
jmp 0xb9ca
leaq -0x68(%rbp), %rdi
callq 0xf900
movq -0xb8(%rbp), %rdi
movb (%rax), %al
movb %al, -0x71(%rbp)
leaq -0x71(%rbp), %rsi
callq 0xf920
jmp 0xb986
jmp 0xb988
leaq -0x68(%rbp), %rdi
callq 0xf990
jmp 0xb953
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x4420
jmp 0xba7f
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x6130
jmp 0xba7f
movq -0xb8(%rbp), %rdi
callq 0xa650
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xfa60
movq -0x18(%rbp), %rdi
callq 0x9e20
movq %rax, -0x98(%rbp)
movslq -0x24(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xf800
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9e50
movq -0xb8(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movq -0x80(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0xa0(%rbp), %rcx
callq 0xf9b0
movq %rax, -0xc8(%rbp)
jmp 0xba4b
movq -0xc8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movb $0x1, -0x25(%rbp)
testb $0x1, -0x25(%rbp)
jne 0xba6f
movq -0xb8(%rbp), %rdi
callq 0x6130
movq -0xc0(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4640
nopl (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/./Response.hpp
// Function: Response::Response()
Response() : 
		status_code { -1 },
		no_store { false },
		no_cache { false },
		has_expiration { false },
		cur_time { 0 },
		expiration_time { 0 },
		last_modified { 0 }
		{}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
addq $0x8, %rdi
callq 0x4510
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x4510
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x4510
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0xd730
movq -0x10(%rbp), %rdi
addq $0x80, %rdi
callq 0xd750
movq -0x10(%rbp), %rdi
movb $0x0, 0xb8(%rdi)
movb $0x0, 0xb9(%rdi)
movb $0x0, 0xba(%rdi)
movq $0x0, 0xc0(%rdi)
movq $0x0, 0xc8(%rdi)
movq $0x0, 0xd0(%rdi)
addq $0xd8, %rdi
callq 0x4510
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::findFirstLine(std::vector<char, std::allocator<char>> const&)
int findFirstLine(const std::vector<char> & content)
	{
		int i = 0;
		int N = content.size();
		for(; i + 1 <= N - 1; ++i)
		{
			if(content[i] == '\r' && content[i + 1] == '\n')
			{
				break;
			}
		}
		return i;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9d80
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0xf7f1
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0xfaa0
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0xf7e4
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xfaa0
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0xf7e4
jmp 0xf7f1
jmp 0xf7e6
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf7a3
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::checkStatusCode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool checkStatusCode(const std::string & header)
	{
		int idx = header.find("\r\n");
		int i = 0;
		for(; i + 2 <= idx; ++i)
		{
			if(header[i] == '3' && header[i + 1] == '0' && header[i + 2] == '4')
			{
				return true;
			}
		}
		return false;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x87d4(%rip), %rsi      # 0x1951f
xorl %eax, %eax
movl %eax, %edx
callq 0x46f0
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl $0x2, %eax
cmpl -0x1c(%rbp), %eax
jg 0x10dc5
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x4440
movsbl (%rax), %eax
cmpl $0x33, %eax
jne 0x10db8
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x4440
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x10db8
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0x4440
movsbl (%rax), %eax
cmpl $0x34, %eax
jne 0x10db8
movb $0x1, -0x1(%rbp)
jmp 0x10dc9
jmp 0x10dba
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x10d5e
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::respondClient(int, std::vector<char, std::allocator<char>> const&, int)
bool respondClient(int client_fd, const std::vector<char> & buffer, int received_length)
	{
		int sent_length = 0;
		while(sent_length < received_length)
		{
			int len = send(client_fd, &buffer.data()[0] + sent_length, received_length, 0);	
			if(len == -1)
			{
				return false;
			}
			sent_length += len;
		}
		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x10ed6
movl -0x14(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0xf710
movl -0x30(%rbp), %edi
movq %rax, %rsi
movslq -0x28(%rbp), %rax
addq %rax, %rsi
movslq -0x24(%rbp), %rdx
xorl %ecx, %ecx
callq 0x41c0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x10ecb
movb $0x0, -0x1(%rbp)
jmp 0x10eda
movl -0x2c(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x10e8d
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: dentiny[P]HTTP-Cache-Proxy/./Parser.hpp
// Function: Parser::extractContentLength(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int extractContentLength(const std::string & header)
	{
		// start extract content length
		int res = 0;
		int idx = header.find("Content-Length");
		int N = header.length();
		bool digit_found = false;
		for(int i = idx; i < N; ++i)
		{
			char c = header[i];
			if(digit_found && isdigit(c))
			{
				res = res * 10 + (c - '0');
			}
			else if(digit_found && !isdigit(c))
			{
				break;
			}
			else if(!digit_found && isdigit(c))
			{
				digit_found = true;
				res = c - '0';
			}
		}
		return res;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x69e4(%rip), %rsi      # 0x19456
xorl %eax, %eax
movl %eax, %edx
callq 0x46f0
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4580
movl %eax, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x12b24
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x4440
movb (%rax), %al
movb %al, -0x25(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x12ad8
movsbl -0x25(%rbp), %edi
callq 0x4370
cmpl $0x0, %eax
je 0x12ad8
imull $0xa, -0x14(%rbp), %eax
movsbl -0x25(%rbp), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x12b14
testb $0x1, -0x1d(%rbp)
je 0x12aee
movsbl -0x25(%rbp), %edi
callq 0x4370
cmpl $0x0, %eax
jne 0x12aee
jmp 0x12b24
testb $0x1, -0x1d(%rbp)
jne 0x12b10
movsbl -0x25(%rbp), %edi
callq 0x4370
cmpl $0x0, %eax
je 0x12b10
movb $0x1, -0x1d(%rbp)
movsbl -0x25(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x14(%rbp)
jmp 0x12b12
jmp 0x12b14
jmp 0x12b16
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x12a94
movl -0x14(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: dentiny[P]HTTP-Cache-Proxy/./Response.hpp
// Function: Response::Response(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::vector<char, std::allocator<char>>, std::allocator<std::vector<char, std::allocator<char>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Response(const std::string _url, std::vector<std::vector<char>> buffer, const std::string h) : 
		status_code { -1 },
		url { _url },
		header { h },
		content { buffer },
		no_store { false }, // default can be stored in the cache
		no_cache { false }, // default can be cached in the cache(need to check e-tag)
		has_expiration { false }, // has expiration calculation machanism
		cur_time { time(NULL) },
		expiration_time { 0 },
		last_modified { 0 }
		{}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x40(%rbp)
movq %rdx, -0x60(%rbp)
movq %rcx, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
addq $0x8, %rdi
movq %rdi, -0x50(%rbp)
callq 0x4510
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x28, %rdi
movq %rdi, -0x38(%rbp)
callq 0x4150
jmp 0x12b86
movq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x68(%rbp)
callq 0x4150
jmp 0x12b9d
movq -0x60(%rbp), %rsi
movq -0x48(%rbp), %rdi
addq $0x68, %rdi
callq 0xddf0
jmp 0x12bb0
movq -0x48(%rbp), %rdi
addq $0x80, %rdi
callq 0xd750
movq -0x48(%rbp), %rax
movb $0x0, 0xb8(%rax)
movb $0x0, 0xb9(%rax)
movb $0x0, 0xba(%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x4390
movq -0x48(%rbp), %rdi
movq %rax, 0xc0(%rdi)
movq $0x0, 0xc8(%rdi)
movq $0x0, 0xd0(%rdi)
addq $0xd8, %rdi
callq 0x4510
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x12c4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x12c46
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4250
movq -0x38(%rbp), %rdi
callq 0x4250
movq -0x50(%rbp), %rdi
callq 0x4250
movq -0x28(%rbp), %rdi
callq 0x4640
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/./Parser.hpp
// Function: Parser::parseResponse(Response&)
void parseResponse(Response & response)
	{
		extractFirstLine(response);
		extractKV(response);
		extractAttri(response);	
		calcExpiration(response);
		extractLastModified(response);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
callq 0x12eb0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13030
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13420
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x137d0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13a50
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/./LRUCache.hpp
// Function: LRUCache::put(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Response const&)
void put(const std::string & url, const Response & response) 
    {
        std::unique_lock<std::mutex> lck(mtx1);
        if(existsUrl(url))
        {
            cache.remove(url);
            kv[url] = response;
        }
        else
        {
            if(sz == capacity)
            {
                const std::string & url = cache.front(); cache.pop_front();
                kv.erase(url);
            }
            else
            {
                ++sz;
            }
            kv.insert(std::make_pair(url, response));
        }
        cache.push_back(url);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq 0x116bf(%rip), %rsi     # 0x243b8
leaq -0x28(%rbp), %rdi
callq 0xb0e0
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xb2a0
movb %al, -0x169(%rbp)
jmp 0x12d1a
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0x12d26
jmp 0x12d8d
movq -0x178(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
callq 0xcdf0
movq -0x178(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x188(%rbp)
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
callq 0xcc60
movq %rax, -0x180(%rbp)
jmp 0x12d62
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdi
callq 0x14ce0
jmp 0x12d77
jmp 0x12e74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x12e9c
movq -0x178(%rbp), %rcx
movl (%rcx), %eax
cmpl 0x4(%rcx), %eax
jne 0x12dda
movq -0x178(%rbp), %rdi
addq $0x8, %rdi
movq %rdi, -0x190(%rbp)
callq 0x14e10
movq -0x190(%rbp), %rdi
movq %rax, -0x40(%rbp)
callq 0x14e40
movq -0x178(%rbp), %rdi
addq $0x20, %rdi
movq -0x40(%rbp), %rsi
callq 0x14e70
jmp 0x12dd8
jmp 0x12de8
movq -0x178(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x178(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x198(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x158(%rbp), %rdi
callq 0x14ee0
jmp 0x12e10
movq -0x198(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x14ea0
movb %dl, -0x1a1(%rbp)
movq %rax, -0x1a0(%rbp)
jmp 0x12e32
movb -0x1a1(%rbp), %al
movq -0x1a0(%rbp), %rcx
movq %rcx, -0x168(%rbp)
movb %al, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x14f20
jmp 0x12e74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x14f20
jmp 0x12e9c
movq -0x178(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
callq 0xcee0
jmp 0x12e8a
leaq -0x28(%rbp), %rdi
callq 0xb120
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0xb120
movq -0x30(%rbp), %rdi
callq 0x4640
nop
// File: dentiny[P]HTTP-Cache-Proxy/./Parser.hpp
// Function: Parser::extractFirstLine(Response&)
void extractFirstLine(Response & response)
	{
		// first line
		const std::string header = response.header;
		for(char c : header)
		{
			if(c == '\r')
			{
				break;
			}
			else
			{
				response.first_line += c;
			}
		}

		// status code
		// eg: first line: HTTP/1.1 200 OK
		const std::string & first_line = response.first_line;
		int idx1 = first_line.find_first_of(' ');
		int idx2 = first_line.find_last_of(' ');
		response.status_code = std::stoi(first_line.substr(idx1, idx2 - idx1)); // [idx1, idx2)
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
addq $0x48, %rsi
leaq -0x30(%rbp), %rdi
callq 0x4150
leaq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x43b0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x4690
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xf8c0
testb $0x1, %al
jne 0x12f09
jmp 0x12f55
leaq -0x40(%rbp), %rdi
callq 0xf900
movb (%rax), %al
movb %al, -0x49(%rbp)
movsbl -0x49(%rbp), %eax
cmpl $0xd, %eax
jne 0x12f22
jmp 0x12f55
movsbl -0x49(%rbp), %esi
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x4260
jmp 0x12f35
jmp 0x12f48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x13014
jmp 0x12f4a
leaq -0x40(%rbp), %rdi
callq 0xf990
jmp 0x12ef6
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x20, %esi
movl %esi, -0x94(%rbp)
callq 0x4270
movl -0x94(%rbp), %esi
movl %eax, -0x6c(%rbp)
movq -0x68(%rbp), %rdi
movq $-0x1, %rdx
callq 0x46b0
movl %eax, -0x70(%rbp)
movq -0x68(%rbp), %rsi
movslq -0x6c(%rbp), %rdx
movl %edx, %ecx
movl -0x70(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq -0x90(%rbp), %rdi
callq 0x43f0
jmp 0x12fb5
xorl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdi
movl $0xa, %edx
callq 0x13c50
movl %eax, -0x98(%rbp)
jmp 0x12fd2
movl -0x98(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x4250
leaq -0x30(%rbp), %rdi
callq 0x4250
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4250
leaq -0x30(%rbp), %rdi
callq 0x4250
movq -0x58(%rbp), %rdi
callq 0x4640
nopw %cs:(%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/./Parser.hpp
// Function: Parser::extractLastModified(Response&)
void extractLastModified(Response & response)
	{
		std::unordered_map<std::string, std::string> & kv = response.kv;
		if(kv.find("Last-Modified") != kv.end())
		{
			const char * time = kv["Last-Modified"].c_str();
			struct tm tm;
			memset(&tm, 0, sizeof(struct tm));
			strptime(time, "%a, %d %b %Y %H:%M:%S %z", &tm);
			response.last_modified = mktime(&tm);
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x4650
movq -0xd0(%rbp), %rdx
leaq 0x588b(%rip), %rsi      # 0x19323
leaq -0x40(%rbp), %rdi
callq 0x4bf0
jmp 0x13aa3
movq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x14be0
movq %rax, -0xe0(%rbp)
jmp 0x13abc
movq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x14c10
movq %rax, -0x60(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x14bb0
movb %al, -0xe1(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4250
leaq -0x41(%rbp), %rdi
callq 0x4420
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x13b08
jmp 0x13c3c
movq -0x18(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x4650
movq -0xf0(%rbp), %rdx
leaq 0x57ef(%rip), %rsi      # 0x19323
leaq -0x88(%rbp), %rdi
callq 0x4bf0
jmp 0x13b42
movq -0xf8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xc4c0
movq %rax, -0x100(%rbp)
jmp 0x13b5e
movq -0x100(%rbp), %rdi
callq 0x4130
movq %rax, -0x108(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4250
leaq -0x89(%rbp), %rdi
callq 0x4420
movq -0x108(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x4200
movq -0x68(%rbp), %rdi
leaq 0x598f(%rip), %rsi      # 0x19541
leaq -0xc8(%rbp), %rdx
callq 0x4060
leaq -0xc8(%rbp), %rdi
callq 0x4280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xd0(%rax)
jmp 0x13c3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x13bfd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4250
leaq -0x41(%rbp), %rdi
callq 0x4420
jmp 0x13c45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x13c2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4250
leaq -0x89(%rbp), %rdi
callq 0x4420
jmp 0x13c45
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4640
nop
// File: dentiny[P]HTTP-Cache-Proxy/./Response.hpp
// Function: Response::operator=(Response const&)
Response & operator=(const Response & rhs)
	{
		if(this != &rhs)
		{
			status_code = rhs.status_code;
			first_line = rhs.first_line;
			url = rhs.url;
			header = rhs.header;
			content = rhs.content;
			kv = rhs.kv;
			no_store = rhs.no_store;
			no_cache = rhs.no_cache;
			has_expiration = rhs.has_expiration;
			cur_time = rhs.cur_time;
			expiration_time = rhs.expiration_time;
			last_modified = rhs.last_modified;
			etag = rhs.etag;
		}
		return *this;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq -0x10(%rbp), %rax
je 0x14e00
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, (%rdi)
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
addq $0x8, %rdi
callq 0x4030
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
addq $0x28, %rdi
callq 0x4030
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x48, %rsi
addq $0x48, %rdi
callq 0x4030
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x68, %rsi
addq $0x68, %rdi
callq 0x14f50
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x80, %rsi
addq $0x80, %rdi
callq 0x151a0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movb 0xb8(%rax), %al
andb $0x1, %al
movb %al, 0xb8(%rdi)
movq -0x10(%rbp), %rax
movb 0xb9(%rax), %al
andb $0x1, %al
movb %al, 0xb9(%rdi)
movq -0x10(%rbp), %rax
movb 0xba(%rax), %al
andb $0x1, %al
movb %al, 0xba(%rdi)
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, 0xc0(%rdi)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq %rax, 0xc8(%rdi)
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rax
movq %rax, 0xd0(%rdi)
movq -0x10(%rbp), %rsi
addq $0xd8, %rsi
addq $0xd8, %rdi
callq 0x4030
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::sendRequest(int, Request const&)
void sendRequest(int server_fd, const Request & request)
	{
		int sent_length = 0;
		int request_length = request.content.size();
		const char * content = &request.content.data()[0];
		while(sent_length < request_length)
		{
			int len = send(server_fd, content + sent_length, request_length - sent_length, 0);
			if(len == -1)
		    {
		        throw ProxyException("Proxy send client request error");
		    }
		    sent_length += len;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
addq $0xc0, %rdi
callq 0x9d80
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0xc0, %rdi
callq 0xf710
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x16dd9
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rsi
movslq -0x1c(%rbp), %rax
addq %rax, %rsi
movl -0x20(%rbp), %eax
subl -0x1c(%rbp), %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x41c0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x16dcb
movb $0x1, -0x65(%rbp)
movl $0x28, %edi
callq 0x41b0
movq %rax, -0x78(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x4650
movq -0x70(%rbp), %rdx
leaq 0x2805(%rip), %rsi      # 0x1955a
leaq -0x50(%rbp), %rdi
callq 0x4bf0
jmp 0x16d60
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x9240
jmp 0x16d6f
movq -0x78(%rbp), %rdi
movb $0x0, -0x65(%rbp)
leaq 0xcf7a(%rip), %rsi      # 0x23cf8
leaq -0xdad5(%rip), %rdx     # 0x92b0
callq 0x4610
jmp 0x16deb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x16daf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4250
leaq -0x51(%rbp), %rdi
callq 0x4420
testb $0x1, -0x65(%rbp)
jne 0x16dc0
jmp 0x16dc9
movq -0x78(%rbp), %rdi
callq 0x42d0
jmp 0x16de2
movl -0x2c(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x16cf4
addq $0x80, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x4640
nopl (%rax,%rax)
// File: dentiny[P]HTTP-Cache-Proxy/Proxy.cpp
// Function: Proxy::getResponseHeader(int, std::vector<char, std::allocator<char>>&)
int getResponseHeader(int server_fd, std::vector<char> & buffer)
	{
		int len = recv(server_fd, &buffer.data()[0], BUFFER_SIZE, 0);
	    if(len == -1)
	    {
	    	throw ProxyException("Receive header error");
	    }
	    buffer[len] = '\0';
	    return len;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9410
movl -0x5c(%rbp), %edi
movq %rax, %rsi
movl $0x10000, %edx          # imm = 0x10000
xorl %ecx, %ecx
callq 0x40f0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0x173f1
movb $0x1, -0x55(%rbp)
movl $0x28, %edi
callq 0x41b0
movq %rax, -0x70(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x4650
movq -0x68(%rbp), %rdx
leaq 0x221a(%rip), %rsi      # 0x19595
leaq -0x40(%rbp), %rdi
callq 0x4bf0
jmp 0x17386
movq -0x70(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9240
jmp 0x17395
movq -0x70(%rbp), %rdi
movb $0x0, -0x55(%rbp)
leaq 0xc954(%rip), %rsi      # 0x23cf8
leaq -0xe0fb(%rip), %rdx     # 0x92b0
callq 0x4610
jmp 0x17413
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x173d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4250
leaq -0x41(%rbp), %rdi
callq 0x4420
testb $0x1, -0x55(%rbp)
jne 0x173e6
jmp 0x173ef
movq -0x70(%rbp), %rdi
callq 0x42d0
jmp 0x1740a
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x9430
movb $0x0, (%rax)
movl -0x1c(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4640
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/cps-tss.cc
// Function: parseargs(int, char**)
void parseargs(int argc, char *argv[]) {
    int	c;
    while ((c = getopt(argc, argv, "r:")) != -1) {
        switch (c) {
            case 'r':
                fpr = fopen(optarg, "r");
                break;
            default:
                break;
        }
    }

    
    if(fpr == NULL){
        printf("can't open ruleset file\n");
        exit(-1);
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xabe7(%rip), %rdx      # 0xd004
callq 0x2050
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x2457
movl -0x14(%rbp), %eax
subl $0x72, %eax
jne 0x2453
jmp 0x2434
movq 0xfb8d(%rip), %rax      # 0x11fc8
movq (%rax), %rdi
leaq 0xad9f(%rip), %rsi      # 0xd1e4
callq 0x2180
movq %rax, 0xfcf7(%rip)      # 0x12148
jmp 0x2455
jmp 0x2455
jmp 0x240f
cmpq $0x0, 0xfce9(%rip)      # 0x12148
jne 0x2479
leaq 0xab9f(%rip), %rdi      # 0xd007
movb $0x0, %al
callq 0x2030
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2190
addq $0x20, %rsp
popq %rbp
retq
nop
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/cps-tss.cc
// Function: print_bitstring(std::vector<pc_rule*, std::allocator<pc_rule*>>&)
void print_bitstring(vector<pc_rule*> &pc) 
{
    array<char, MAX_BITS> bitstring;
    int old_priority;
    for(auto rule = pc.begin(); rule != pc.end(); rule ++) {
        if((*rule)->priority != old_priority) {
            old_priority = (*rule)->priority;
            cout<<endl;
            cout<<(*rule)->priority<<endl;
        }
        bitstring = bitstring_from_rule(*rule);
        for_each(bitstring.begin(), bitstring.begin() + 32, [](char c){cout<<c<<" ";});
        cout<<endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3460
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x34d0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3490
testb $0x1, %al
jne 0x2e2f
jmp 0x2f11
leaq -0x38(%rbp), %rdi
callq 0x3500
movq (%rax), %rax
movl (%rax), %eax
cmpl -0x2c(%rbp), %eax
je 0x2e8f
leaq -0x38(%rbp), %rdi
callq 0x3500
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq 0xf17e(%rip), %rdi      # 0x11fd8
movq 0xf15f(%rip), %rsi      # 0x11fc0
callq 0x2150
leaq -0x38(%rbp), %rdi
callq 0x3500
movq (%rax), %rax
movl (%rax), %esi
movq 0xf15d(%rip), %rdi      # 0x11fd8
callq 0x2200
movq %rax, %rdi
movq 0xf136(%rip), %rsi      # 0x11fc0
callq 0x2150
leaq -0x38(%rbp), %rdi
callq 0x3500
movq (%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2ac0
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x36e0
movq %rax, -0x78(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x36e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
addq $0x20, %rsi
callq 0x2f20
movq 0xf0e7(%rip), %rdi      # 0x11fd8
movq 0xf0c8(%rip), %rsi      # 0x11fc0
callq 0x2150
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x3630
movq %rax, -0x70(%rbp)
jmp 0x2e0c
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/cps-tss.cc
// Function: get_tuple(std::array<char, 32ul>&)
array<int, MAXDIMENSIONS> get_tuple(array<char, MAX_BITS> &bitstring) 
{
    array<int, MAXDIMENSIONS> field_prefixlen;
    field_prefixlen.fill(0);
    int start_pos[MAXDIMENSIONS] = {0, 32, 64, 80, 96}; 
    int bits[MAXDIMENSIONS] = {32,32,16,16,8};
    for(int i = 0; i < MAXDIMENSIONS; i++) {    
        int spos = start_pos[i];
        for(int j = spos; j < spos + bits[i]; j++) {
            if(bitstring[j] != '*') {
                field_prefixlen[i]++;
            }
        }

    }
    return move(field_prefixlen);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x80(%rbp)
movq %rdi, -0x78(%rbp)
movq %rsi, -0x8(%rbp)
movl $0x0, -0x20(%rbp)
leaq -0x1c(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3700
movq 0xa0fe(%rip), %rax      # 0xd090
movq %rax, -0x40(%rbp)
movq 0xa0fb(%rip), %rax      # 0xd098
movq %rax, -0x38(%rbp)
movl 0xa0f9(%rip), %eax      # 0xd0a0
movl %eax, -0x30(%rbp)
movq 0xa0ff(%rip), %rax      # 0xd0b0
movq %rax, -0x60(%rbp)
movq 0xa0fc(%rip), %rax      # 0xd0b8
movq %rax, -0x58(%rbp)
movl 0xa0fa(%rip), %eax      # 0xd0c0
movl %eax, -0x50(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x5, -0x64(%rbp)
jge 0x303c
movslq -0x64(%rbp), %rax
movl -0x40(%rbp,%rax,4), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl -0x68(%rbp), %ecx
movslq -0x64(%rbp), %rdx
addl -0x60(%rbp,%rdx,4), %ecx
cmpl %ecx, %eax
jge 0x302f
movq -0x8(%rbp), %rdi
movslq -0x6c(%rbp), %rsi
callq 0x36b0
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0x3022
movslq -0x64(%rbp), %rsi
leaq -0x1c(%rbp), %rdi
callq 0x3520
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x3024
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2fe7
jmp 0x3031
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2fd0
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
movq -0x1c(%rbp), %rdx
movq %rdx, (%rcx)
movq -0x14(%rbp), %rdx
movq %rdx, 0x8(%rcx)
movl -0xc(%rbp), %edx
movl %edx, 0x10(%rcx)
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/cps-tss.cc
// Function: main
int main(int argc, char *argv[])
{

    vector<pc_rule> pc_orig;
    vector<pc_rule> pc_prefix;
    vector<pc_rule*> pc;

    parseargs(argc, argv);
    loadrules(fpr, pc_orig);

    vector<pc_rule*> pc_r = remove_redund_pkg(pc_orig, pc_prefix);
    cout<<"load "<<pc_r.size()<<" rules"<<endl;

    //freopen ("tuple.txt","w",stdout);
    tuples_num(pc_r);
    freopen ("prefix.txt","w",stdout);
    print_bitstring(pc_r);
    fclose(stdout);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3740
leaq -0x40(%rbp), %rdi
callq 0x3740
leaq -0x58(%rbp), %rdi
callq 0x3300
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2400
jmp 0x30b2
movq 0xf08f(%rip), %rdi      # 0x12148
leaq -0x28(%rbp), %rsi
callq 0x6360
jmp 0x30c4
leaq -0x80(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x2480
jmp 0x30d7
movq 0xeefa(%rip), %rdi      # 0x11fd8
leaq 0x9f77(%rip), %rsi      # 0xd05c
callq 0x2110
movq %rax, -0x88(%rbp)
jmp 0x30f3
leaq -0x80(%rbp), %rdi
callq 0x3760
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x2060
movq %rax, -0x90(%rbp)
jmp 0x3114
movq -0x90(%rbp), %rdi
leaq 0x9f40(%rip), %rsi      # 0xd062
callq 0x2110
movq %rax, -0x98(%rbp)
jmp 0x3130
movq -0x98(%rbp), %rdi
movq 0xee82(%rip), %rsi      # 0x11fc0
callq 0x2150
jmp 0x3145
leaq -0x80(%rbp), %rdi
callq 0x27b0
jmp 0x3150
movq 0xee59(%rip), %rax      # 0x11fb0
movq (%rax), %rdx
leaq 0x9f08(%rip), %rdi      # 0xd069
leaq 0x9f0c(%rip), %rsi      # 0xd074
callq 0x2160
jmp 0x316f
leaq -0x80(%rbp), %rdi
callq 0x2df0
jmp 0x317a
movq 0xee2f(%rip), %rax      # 0x11fb0
movq (%rax), %rdi
callq 0x2120
jmp 0x318b
movl $0x0, -0x4(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x33e0
leaq -0x58(%rbp), %rdi
callq 0x33e0
leaq -0x40(%rbp), %rdi
callq 0x3780
leaq -0x28(%rbp), %rdi
callq 0x3780
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x31e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x33e0
leaq -0x58(%rbp), %rdi
callq 0x33e0
leaq -0x40(%rbp), %rdi
callq 0x3780
leaq -0x28(%rbp), %rdi
callq 0x3780
movq -0x60(%rbp), %rdi
callq 0x2220
nopl (%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: init_boundary(rule_boundary&)
void init_boundary(rule_boundary & rb)
{
    rb.field[0].low = 0;
    rb.field[0].high = 0xFFFFFFFF;
    rb.field[1].low = 0;
    rb.field[1].high = 0xFFFFFFFF;
    rb.field[2].low = 0;
    rb.field[2].high = 0xFFFF;
    rb.field[3].low = 0;
    rb.field[3].high = 0xFFFF;
    rb.field[4].low = 0;
    rb.field[4].high = 0xFF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
movq $0xffff, 0x28(%rax)     # imm = 0xFFFF
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movq $0xffff, 0x38(%rax)     # imm = 0xFFFF
movq -0x8(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x8(%rbp), %rax
movq $0xff, 0x48(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: CheckIPBounds(range)
int CheckIPBounds(range fld)
{
    if (fld.low > 0xFFFFFFFF)
    {
        printf("Error: IPRange is buggy!(%llu)\n",fld.low);
        return 1;
    }
    if (fld.high > 0xFFFFFFFF)
    {
        printf("Error: IPRange is buggy!(%llu)\n",fld.high);
        return 1;
    }
    if (fld.low > fld.high)
    {
        printf("Error: IPRange is buggy!(%llu - %llu)\n",fld.low,fld.high);
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x18(%rbp)
jbe 0x6086
movq -0x18(%rbp), %rsi
leaq 0x705a(%rip), %rdi      # 0xd0d0
movb $0x0, %al
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0x60dc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x10(%rbp)
jbe 0x60ac
movq -0x10(%rbp), %rsi
leaq 0x7034(%rip), %rdi      # 0xd0d0
movb $0x0, %al
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0x60dc
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jbe 0x60d5
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x702b(%rip), %rdi      # 0xd0f0
movb $0x0, %al
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0x60dc
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: range_in_boundary_1D(range, range)
range range_in_boundary_1D(range r, range boundary)
{
    range ret;
    if (r.low > boundary.low) {
        ret.low = r.low; 
    }
    else {
        ret.low = boundary.low;
    }

    if (r.high < boundary.high) {
        ret.high = r.high;
    }
    else {
        ret.high = boundary.high;
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x20(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x37e0
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x66e5
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x66ed
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x6701
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6709
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: is_equal(pc_rule, pc_rule, rule_boundary)
bool is_equal(pc_rule rule1, pc_rule rule2, rule_boundary boundary)
{
    int count = 0;
    range r1, r2;
    for (int i = 0;i < MAXDIMENSIONS;i++)
    {

        r1 = range_in_boundary_1D(rule1.field[i], boundary.field[i]);

        r2 = range_in_boundary_1D(rule2.field[i], boundary.field[i]);

        if (r1.low <= r2.low && r1.high >= r2.high)

        {
            count++;
        }
    }

    if (count == MAXDIMENSIONS)
        return true;
    else
        return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq 0x120(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0x0, -0x8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x37e0
leaq -0x28(%rbp), %rdi
callq 0x37e0
movl $0x0, -0x2c(%rbp)
cmpl $0x5, -0x2c(%rbp)
jge 0x689e
movq -0xa8(%rbp), %rax
movq -0x98(%rbp), %rcx
addq $0x8, %rcx
movslq -0x2c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
movq 0x8(%rcx), %rcx
movq %rcx, -0x48(%rbp)
movslq -0x2c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x66b0
movq -0xa0(%rbp), %rcx
movq %rax, %rsi
movq -0xa8(%rbp), %rax
movq %rsi, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq -0x40(%rbp), %rdx
movq %rdx, -0x18(%rbp)
movq -0x38(%rbp), %rdx
movq %rdx, -0x10(%rbp)
addq $0x8, %rcx
movslq -0x2c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
movq 0x8(%rcx), %rcx
movq %rcx, -0x78(%rbp)
movslq -0x2c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
callq 0x66b0
movq %rax, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
ja 0x688e
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
jb 0x688e
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x6890
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6772
cmpl $0x5, -0x8(%rbp)
jne 0x68aa
movb $0x1, -0x1(%rbp)
jmp 0x68ae
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: init_rnode(rnode*, rule_boundary&)
void init_rnode(rnode *n, rule_boundary &b) 
{
    rg sip(b.field[0].low, b.field[0].high);
    rg dip(b.field[1].low, b.field[1].high);

    n[0].setb(sip);
    n[1].setb(dip);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edx
leaq -0x18(%rbp), %rdi
callq 0x91d0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq -0x20(%rbp), %rdi
callq 0x91d0
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x91f0
movq -0x8(%rbp), %rdi
addq $0x30, %rdi
leaq -0x20(%rbp), %rsi
callq 0x91f0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: check_cmpl(prefix*)
bool check_cmpl(struct prefix *pf) 
{
    int rangelen = 0;
    if(pf->nvalid != 1) {
        for(size_t i = 0; i < pf->nvalid; i ++) {
            rangelen += (int)pow(2, 16 - pf->length[i]);
        }
        for(size_t i = 0; i < pf->ninvalid; i ++) {
            rangelen += (int)pow(2, 16 - pf->cmpllength[i]);
        }
    }
    else {
        rangelen = (int)pow(2, 16 - pf->length[0]);
    }
    if(rangelen == (int)pow(2, 16 - pf->fpf_len)) {
        return true;
    }
    else {
        cout<<pf->nvalid<<endl;
        cout<<rangelen<<" "<<pf->fpf_len<<" "<<(int)pow(2, 16 - pf->fpf_len)<<endl;
        return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x108(%rax)
je 0x7fb5
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x108(%rcx), %ecx
cmpq %rcx, %rax
jae 0x7f62
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x10, %esi
subl 0x40(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
cvttsd2si %xmm0, %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x7f1c
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x10c(%rcx), %ecx
cmpq %rcx, %rax
jae 0x7fb3
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movl $0x10, %esi
subl 0xc0(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
cvttsd2si %xmm0, %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x7f6a
jmp 0x7fd2
movq -0x10(%rbp), %rax
movl $0x10, %esi
subl 0x40(%rax), %esi
movl $0x2, %edi
callq 0x94b0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x2c(%rbp), %eax
cvttsd2si %xmm0, %ecx
cmpl %ecx, %eax
jne 0x8005
movb $0x1, -0x1(%rbp)
jmp 0x80a6
movq -0x10(%rbp), %rax
movl 0x108(%rax), %esi
movq 0x9fc2(%rip), %rdi      # 0x11fd8
callq 0x21a0
movq %rax, %rdi
movq 0x9f9b(%rip), %rsi      # 0x11fc0
callq 0x2150
movl -0x14(%rbp), %esi
movq 0x9fa4(%rip), %rdi      # 0x11fd8
callq 0x2200
movq %rax, %rdi
leaq 0x5007(%rip), %rsi      # 0xd04a
callq 0x2110
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x104(%rax), %esi
callq 0x21a0
movq %rax, %rdi
leaq 0x4fe6(%rip), %rsi      # 0xd04a
callq 0x2110
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movq -0x38(%rbp), %rdi
cvttsd2si %xmm0, %esi
callq 0x2200
movq %rax, %rdi
movq 0x9f23(%rip), %rsi      # 0x11fc0
callq 0x2150
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rtrie.cc
// Function: rt_insert(rnode*, rg, pc_rule*)
void rt_insert(rnode *n, rg r, pc_rule* index)
{
    if(r.high >= n->b.high && r.low <= n->b.low) {
        n->rlist.push_back(index);
        return;
    }

    uint32_t m = (n->b.high -  n->b.low + 1ULL)/2 + n->b.low - 1;

    if(r.low <= m) {
        if(!n->left) {
            n->left = new rnode(rg(n->b.low, m));
        }

        rt_insert(n->left, r, index);
    }

    if(r.high > m) {
        if(!n->right) {
            n->right = new rnode(rg(m+1, n->b.high)); 
        }
        rt_insert(n->right, r, index);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rsi, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl 0x4(%rsi), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0xb5db
movq -0x58(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
ja 0xb5db
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq -0x18(%rbp), %rsi
callq 0x93c0
jmp 0xb73c
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x8(%rbp), %rdx
subl (%rdx), %ecx
movl %ecx, %ecx
addq $0x1, %rcx
shrq %rcx
movq -0x8(%rbp), %rdx
movl (%rdx), %edx
addq %rdx, %rcx
subq $0x1, %rcx
movl %ecx, -0x1c(%rbp)
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
ja 0xb69e
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xb674
movl $0x30, %edi
callq 0x2130
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %esi
movl -0x1c(%rbp), %edx
leaq -0x24(%rbp), %rdi
callq 0x91d0
jmp 0xb63d
movq -0x60(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0xc820
jmp 0xb64c
movq -0x60(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0xb674
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2100
jmp 0xb745
movq -0x58(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x68(%rbp)
leaq -0x3c(%rbp), %rdi
callq 0xc870
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x3c(%rbp), %rsi
callq 0xb590
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x1c(%rbp), %eax
jbe 0xb73c
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb712
movl $0x30, %edi
callq 0x2130
movq %rax, -0x70(%rbp)
movl -0x1c(%rbp), %esi
incl %esi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x44(%rbp), %rdi
callq 0x91d0
jmp 0xb6de
movq -0x70(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0xc820
jmp 0xb6ed
movq -0x70(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0xb712
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x2100
jmp 0xb745
movq -0x58(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x4c(%rbp), %rdi
callq 0xc870
movq -0x78(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x4c(%rbp), %rsi
callq 0xb590
addq $0x80, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x2220
nop
// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rtrie.cc
// Function: rt_destory(rnode*)
void rt_destory(rnode *n)
{
    if(!n)
        return;

    if(n->right){
        rt_destory(n->right);
        n->right = NULL;
    }

    if(n->left){
        rt_destory(n->left);
        n->left = NULL;
    }

    n->rlist.clear();
    delete n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xb765
jmp 0xb7da
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xb789
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xb750
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xb7ad
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xb750
movq -0x8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x9280
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0xb7da
movq -0x10(%rbp), %rdi
callq 0x9260
movq -0x10(%rbp), %rdi
callq 0x2100
addq $0x10, %rsp
popq %rbp
retq
// File: suhasjains[P]AMR-Solver/src/octreegrid.cpp
// Function: myOctree::create_list_of_leaf_nodes()
void create_list_of_leaf_nodes() {

	leaf_nodes.clear();

	for (std::list<Octree*>::iterator i = nodes.begin(), end = nodes.end(); i != end; ++i) {
		if((*i)->isLeafNode()) 
			leaf_nodes.push_back(*i);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x21971(%rip), %rdi     # 0x262b0
callq 0x5a50
leaq 0x2194d(%rip), %rdi     # 0x26298
callq 0x4490
movq %rax, -0x8(%rbp)
leaq 0x2193d(%rip), %rdi     # 0x26298
callq 0x44c0
movq %rax, -0x10(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x44f0
testb $0x1, %al
jne 0x4977
jmp 0x49b3
leaq -0x8(%rbp), %rdi
callq 0x4520
movq (%rax), %rdi
callq 0x6da0
testb $0x1, %al
jne 0x498e
jmp 0x49a6
leaq -0x8(%rbp), %rdi
callq 0x4520
movq %rax, %rsi
leaq 0x2190f(%rip), %rdi     # 0x262b0
callq 0x5a80
jmp 0x49a8
leaq -0x8(%rbp), %rdi
callq 0x4550
jmp 0x4964
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)