// File: m1c0l[P]http-client-server/web-client.cpp
// Function: processRequest(sockaddr*, HttpRequest*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int processRequest(sockaddr *serverAddr, HttpRequest* req, string filename) {

	// create a socket using TCP IP
	int sockfd = socket(AF_INET, SOCK_STREAM, 0);
	if (sockfd == -1) {
		perror("socket");
		return -1;
	}

	// connect to the server
	future<int> connectFut = async(launch::async, connect, sockfd,
					serverAddr, sizeof(*serverAddr));
	if (waitFor(connectFut) == -1) {
		close(sockfd);
		return -1;
	}
	if (connectFut.get() == -1) {
		perror("connect");
		return -1;
	}

	// send request
	string msg = req->encode();
	future<ssize_t> sendFut = async(launch::async, send, sockfd,
					msg.c_str(), msg.size(), 0);
	if (waitFor(sendFut) == -1) {
		close(sockfd);
		return -1;
	}
	if (sendFut.get() == -1) {
		perror("send");
		close(sockfd);
		return -1;
	}

	char buf[BUFFER_SIZE + 1] = {0};
	string resBuf;
	HttpResponse* res = new HttpResponse();

	const string eoh = "\r\n\r\n"; // end of header
	int bytesRead = 0;

	// get response's header
	while (true) {
		memset(buf, '\0', sizeof(buf));

		future<ssize_t> recvFut = async(launch::async, recv, sockfd,
						buf, BUFFER_SIZE, 0);
		if (waitFor(recvFut) == -1) {
			close(sockfd);
			return -1;
		}
		bytesRead = recvFut.get();
		if (bytesRead == -1) {
			perror("recv");
			return -1;
		}
		resBuf.append(buf, bytesRead);

		// when the entire header has been read, decode it
		size_t pos = resBuf.find(eoh);
		if (pos != string::npos) {
			size_t end = pos + eoh.size();

			// decode the header
			res->decode(resBuf.substr(0, end));

			// discard the header but keep the rest of the buffer
			resBuf = resBuf.substr(end, resBuf.size());
			break;
		}

		// if end of header is not detected but no incoming data
		if (bytesRead == 0) {
			cerr << "Incomplete HTTP response" << '\n';
			close(sockfd);
			return 7;
		}
	}

	// output the status and description
	cout << req->getHeader("Host") << " " << req->getUrl() << ": " + res->getStatus() + " " + res->getDescription() << '\n';

	// 200 OK
	if (res->getStatus() == "200") {
		// get file name
		string filenameCopy = filename.c_str();
		string base = basename((char*)filenameCopy.c_str());
		if (filename[filename.size() - 1] == '/') {
			base = "index.html";
		}

		// save retrieved file
		ofstream of;
		of.open(base);

		// leftover data from reading header
		of.write(resBuf.c_str(), resBuf.size());

		while (true) {
			memset(buf, '\0', sizeof(buf));

			future<ssize_t> recvFut = async(launch::async, recv,
					sockfd, buf, BUFFER_SIZE, 0);
			if (waitFor(recvFut) == -1) {
				close(sockfd);
				return -1;
			}

			bytesRead = recvFut.get();
			if (bytesRead == -1) {
				perror("recv");
				close(sockfd);
				of.close();
				return 8;
			}
			if (bytesRead == 0) {
				of.close();
				close(sockfd);
				return 0;
			}

			of.write(buf, bytesRead);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x710, %rsp            # imm = 0x710
movq %rdx, -0x5b0(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x50e0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
jne 0x9250
leaq 0xff00(%rip), %rdi      # 0x1913f
callq 0x52f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa038
movq $0x10, -0x40(%rbp)
movq 0x1dd39(%rip), %rdx     # 0x26f98
leaq -0x38(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
movl $0x1, %esi
leaq -0x24(%rbp), %rcx
leaq -0x10(%rbp), %r8
leaq -0x40(%rbp), %r9
callq 0xa9a0
movq -0x5c0(%rbp), %rdi
callq 0xab80
movl %eax, -0x5b4(%rbp)
jmp 0x9294
movl -0x5b4(%rbp), %eax
cmpl $-0x1, %eax
jne 0x92cd
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x92a9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0xa022
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xa02d
leaq -0x38(%rbp), %rdi
callq 0xabf0
movl %eax, -0x5c4(%rbp)
jmp 0x92de
movl -0x5c4(%rbp), %eax
cmpl $-0x1, %eax
jne 0x930a
leaq 0xfe56(%rip), %rdi      # 0x19146
callq 0x52f0
jmp 0x92f7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0xa022
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5eb0
jmp 0x9319
leaq -0x70(%rbp), %rdi
movq %rdi, -0x5d0(%rbp)
callq 0x5150
movq -0x5d0(%rbp), %rdi
movq %rax, -0x88(%rbp)
callq 0x5280
movq %rax, -0x90(%rbp)
movl $0x0, -0x94(%rbp)
movq %rsp, %rax
leaq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq 0x1dc0f(%rip), %rdx     # 0x26f70
leaq -0x80(%rbp), %rdi
movl $0x1, %esi
leaq -0x24(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x90(%rbp), %r9
callq 0xac60
jmp 0x9383
leaq -0x80(%rbp), %rdi
callq 0xae50
movl %eax, -0x5d4(%rbp)
jmp 0x9394
movl -0x5d4(%rbp), %eax
cmpl $-0x1, %eax
jne 0x93de
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x93a9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x9ffa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xa017
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xa00e
leaq -0x80(%rbp), %rdi
callq 0xaec0
movq %rax, -0x5e0(%rbp)
jmp 0x93f0
movq -0x5e0(%rbp), %rax
cmpq $-0x1, %rax
jne 0x9428
leaq 0xfd4a(%rip), %rdi      # 0x1914e
callq 0x52f0
jmp 0x940b
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9415
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x9ffa
xorps %xmm0, %xmm0
movaps %xmm0, -0x600(%rbp)
movups %xmm0, -0xa7(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movaps %xmm0, -0x130(%rbp)
movaps %xmm0, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
movaps %xmm0, -0x160(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x5530
movl $0xa0, %edi
callq 0x53a0
movq %rax, -0x5e8(%rbp)
jmp 0x94ac
movq -0x5e8(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0x620(%rbp)
movaps %xmm0, 0x90(%rdi)
movaps %xmm0, 0x80(%rdi)
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0xaf30
movq -0x5e8(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x5630
movq -0x608(%rbp), %rdx
leaq 0xfc35(%rip), %rsi      # 0x19153
leaq -0x1a8(%rbp), %rdi
callq 0x6180
jmp 0x952c
leaq -0x1a9(%rbp), %rdi
callq 0x5420
movl $0x0, -0x1b0(%rbp)
jmp 0x9544
xorps %xmm0, %xmm0
movaps %xmm0, -0x630(%rbp)
movups %xmm0, -0xa7(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movaps %xmm0, -0x130(%rbp)
movaps %xmm0, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
movaps %xmm0, -0x160(%rbp)
movl $0x0, -0x1c4(%rbp)
movq %rsp, %rax
leaq -0x1c4(%rbp), %rcx
movq %rcx, (%rax)
movq 0x1d991(%rip), %rdx     # 0x26f58
leaq 0xfc06(%rip), %r9       # 0x191d4
leaq -0x1c0(%rbp), %rdi
movl $0x1, %esi
leaq -0x24(%rbp), %rcx
leaq -0x160(%rbp), %r8
callq 0xaf80
jmp 0x95ec
leaq -0x1c0(%rbp), %rdi
callq 0xae50
movl %eax, -0x634(%rbp)
jmp 0x9600
movl -0x634(%rbp), %eax
cmpl $-0x1, %eax
jne 0x9678
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9615
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x9867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9fec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1a9(%rbp), %rdi
callq 0x5420
jmp 0x9fec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9fe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9897
leaq -0x1c0(%rbp), %rdi
callq 0xaec0
movq %rax, -0x640(%rbp)
jmp 0x968d
movq -0x640(%rbp), %rax
movl %eax, -0x1b0(%rbp)
cmpl $-0x1, -0x1b0(%rbp)
jne 0x96c4
leaq 0xfaae(%rip), %rdi      # 0x19158
callq 0x52f0
jmp 0x96b1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x9867
movslq -0x1b0(%rbp), %rdx
leaq -0x180(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x5090
jmp 0x96e0
leaq -0x180(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x56c0
movq %rax, -0x1d0(%rbp)
cmpq $-0x1, -0x1d0(%rbp)
je 0x980e
movq -0x1d0(%rbp), %rax
movq %rax, -0x650(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x5280
movq %rax, %rcx
movq -0x650(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movq -0x188(%rbp), %rax
movq %rax, -0x648(%rbp)
movq -0x1d8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1f8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x53e0
jmp 0x9768
movq -0x648(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x5bd0
jmp 0x977d
leaq -0x1f8(%rbp), %rdi
callq 0x5240
movq -0x1d8(%rbp), %rax
movq %rax, -0x658(%rbp)
leaq -0x180(%rbp), %rdi
movq %rdi, -0x660(%rbp)
callq 0x5280
movq -0x660(%rbp), %rsi
movq -0x658(%rbp), %rdx
movq %rax, %rcx
leaq -0x218(%rbp), %rdi
callq 0x53e0
jmp 0x97c9
leaq -0x180(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x5480
leaq -0x218(%rbp), %rdi
callq 0x5240
movl $0x3, -0x50(%rbp)
jmp 0x9867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x5240
jmp 0x9897
cmpl $0x0, -0x1b0(%rbp)
jne 0x9860
movq 0x1d7d2(%rip), %rdi     # 0x26ff0
leaq 0xf938(%rip), %rsi      # 0x1915d
callq 0x5390
movq %rax, -0x668(%rbp)
jmp 0x9833
movq -0x668(%rbp), %rdi
movl $0xa, %esi
callq 0x5460
jmp 0x9846
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9850
movl $0x7, -0x4(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x9867
movl $0x0, -0x50(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xb170
movl -0x50(%rbp), %eax
movl %eax, -0x66c(%rbp)
testl %eax, %eax
je 0x9892
jmp 0x9882
movl -0x66c(%rbp), %eax
subl $0x3, %eax
je 0x98a8
jmp 0x9fc6
jmp 0x9542
leaq -0x1c0(%rbp), %rdi
callq 0xb170
jmp 0x9fe0
movq -0x18(%rbp), %rax
movq %rax, -0x680(%rbp)
leaq -0x259(%rbp), %rdi
movq %rdi, -0x678(%rbp)
callq 0x5630
movq -0x678(%rbp), %rdx
leaq 0xf8a2(%rip), %rsi      # 0x19176
leaq -0x258(%rbp), %rdi
callq 0x6180
jmp 0x98e2
movq -0x680(%rbp), %rsi
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rdx
callq 0x5900
jmp 0x98fe
movq 0x1d6ab(%rip), %rdi     # 0x26fb0
leaq -0x238(%rbp), %rsi
callq 0x5330
movq %rax, -0x688(%rbp)
jmp 0x991a
movq -0x688(%rbp), %rdi
leaq 0xf868(%rip), %rsi      # 0x19190
callq 0x5390
movq %rax, -0x690(%rbp)
jmp 0x9936
movq -0x18(%rbp), %rsi
leaq -0x280(%rbp), %rdi
callq 0x7f00
jmp 0x9948
movq -0x690(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x5330
movq %rax, -0x698(%rbp)
jmp 0x9964
movq -0x188(%rbp), %rsi
leaq -0x300(%rbp), %rdi
callq 0x89e0
jmp 0x9979
leaq 0xf80f(%rip), %rsi      # 0x1918f
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rdx
callq 0xb190
jmp 0x9995
leaq 0xf7f4(%rip), %rdx      # 0x19190
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x6350
jmp 0x99b1
movq -0x188(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x8a10
jmp 0x99c6
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
leaq -0x320(%rbp), %rdx
callq 0x8630
jmp 0x99e2
movq -0x698(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x5330
movq %rax, -0x6a0(%rbp)
jmp 0x99fe
movq -0x6a0(%rbp), %rdi
movl $0xa, %esi
callq 0x5460
jmp 0x9a11
leaq -0x2a0(%rbp), %rdi
callq 0x5240
leaq -0x320(%rbp), %rdi
callq 0x5240
leaq -0x2c0(%rbp), %rdi
callq 0x5240
leaq -0x2e0(%rbp), %rdi
callq 0x5240
leaq -0x300(%rbp), %rdi
callq 0x5240
leaq -0x280(%rbp), %rdi
callq 0x5240
leaq -0x238(%rbp), %rdi
callq 0x5240
leaq -0x258(%rbp), %rdi
callq 0x5240
leaq -0x259(%rbp), %rdi
callq 0x5420
movq -0x188(%rbp), %rsi
leaq -0x340(%rbp), %rdi
callq 0x89e0
jmp 0x9a92
leaq 0xf6e2(%rip), %rsi      # 0x1917b
leaq -0x340(%rbp), %rdi
callq 0x85d0
movb %al, -0x6a1(%rbp)
jmp 0x9aad
leaq -0x340(%rbp), %rdi
callq 0x5240
movb -0x6a1(%rbp), %al
testb $0x1, %al
jne 0x9ac8
jmp 0x9fb8
movq -0x5b0(%rbp), %rdi
callq 0x5150
movq %rax, -0x6b8(%rbp)
leaq -0x361(%rbp), %rdi
movq %rdi, -0x6b0(%rbp)
callq 0x5630
movq -0x6b8(%rbp), %rsi
movq -0x6b0(%rbp), %rdx
leaq -0x360(%rbp), %rdi
callq 0x6180
jmp 0x9b0a
leaq -0x361(%rbp), %rdi
callq 0x5420
leaq -0x360(%rbp), %rdi
callq 0x5150
movq %rax, %rdi
callq 0x5610
movq %rax, -0x6c8(%rbp)
leaq -0x389(%rbp), %rdi
movq %rdi, -0x6c0(%rbp)
callq 0x5630
movq -0x6c8(%rbp), %rsi
movq -0x6c0(%rbp), %rdx
leaq -0x388(%rbp), %rdi
callq 0x6180
jmp 0x9b60
leaq -0x389(%rbp), %rdi
callq 0x5420
movq -0x5b0(%rbp), %rdi
callq 0x5280
movq -0x5b0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x56b0
movq %rax, -0x6d0(%rbp)
jmp 0x9b93
movq -0x6d0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x9d21
leaq 0xf5d2(%rip), %rsi      # 0x1917f
leaq -0x388(%rbp), %rdi
callq 0x5520
jmp 0x9bbb
jmp 0x9d21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9ca8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9c54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x5240
leaq -0x320(%rbp), %rdi
callq 0x5240
leaq -0x2c0(%rbp), %rdi
callq 0x5240
leaq -0x2e0(%rbp), %rdi
callq 0x5240
leaq -0x300(%rbp), %rdi
callq 0x5240
leaq -0x280(%rbp), %rdi
callq 0x5240
leaq -0x238(%rbp), %rdi
callq 0x5240
leaq -0x258(%rbp), %rdi
callq 0x5240
leaq -0x259(%rbp), %rdi
callq 0x5420
jmp 0x9fe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x5240
jmp 0x9fe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x361(%rbp), %rdi
callq 0x5420
jmp 0x9fe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x389(%rbp), %rdi
callq 0x5420
jmp 0x9faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9f9e
leaq -0x590(%rbp), %rdi
callq 0x5600
jmp 0x9d2f
leaq -0x590(%rbp), %rdi
leaq -0x388(%rbp), %rsi
movl $0x10, %edx
callq 0x51b0
jmp 0x9d49
leaq -0x180(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x5150
movq -0x6e0(%rbp), %rdi
movq %rax, -0x6d8(%rbp)
callq 0x5280
movq -0x6d8(%rbp), %rsi
movq %rax, %rdx
leaq -0x590(%rbp), %rdi
callq 0x54f0
jmp 0x9d87
jmp 0x9d89
jmp 0x9d8b
xorps %xmm0, %xmm0
movaps %xmm0, -0x6f0(%rbp)
movups %xmm0, -0xa7(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movaps %xmm0, -0x130(%rbp)
movaps %xmm0, -0x140(%rbp)
movaps %xmm0, -0x150(%rbp)
movaps %xmm0, -0x160(%rbp)
movl $0x0, -0x5a4(%rbp)
movq %rsp, %rax
leaq -0x5a4(%rbp), %rcx
movq %rcx, (%rax)
movq 0x1d14a(%rip), %rdx     # 0x26f58
leaq 0xf3bf(%rip), %r9       # 0x191d4
leaq -0x5a0(%rbp), %rdi
movl $0x1, %esi
leaq -0x24(%rbp), %rcx
leaq -0x160(%rbp), %r8
callq 0xaf80
jmp 0x9e33
leaq -0x5a0(%rbp), %rdi
callq 0xae50
movl %eax, -0x6f4(%rbp)
jmp 0x9e47
movl -0x6f4(%rbp), %eax
cmpl $-0x1, %eax
jne 0x9e9d
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9e5c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x9f52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9f92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0xb170
jmp 0x9f92
leaq -0x5a0(%rbp), %rdi
callq 0xaec0
movq %rax, -0x700(%rbp)
jmp 0x9eb2
movq -0x700(%rbp), %rax
movl %eax, -0x1b0(%rbp)
cmpl $-0x1, -0x1b0(%rbp)
jne 0x9efe
leaq 0xf289(%rip), %rdi      # 0x19158
callq 0x52f0
jmp 0x9ed6
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9ee0
leaq -0x590(%rbp), %rdi
callq 0x5560
jmp 0x9eee
movl $0x8, -0x4(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x9f52
cmpl $0x0, -0x1b0(%rbp)
jne 0x9f2f
leaq -0x590(%rbp), %rdi
callq 0x5560
jmp 0x9f15
movl -0x24(%rbp), %edi
callq 0x5680
jmp 0x9f1f
movl $0x0, -0x4(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x9f52
movslq -0x1b0(%rbp), %rdx
leaq -0x590(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x54f0
jmp 0x9f4b
movl $0x0, -0x50(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0xb170
movl -0x50(%rbp), %eax
testl %eax, %eax
jne 0x9f6c
jmp 0x9f67
jmp 0x9d89
leaq -0x590(%rbp), %rdi
callq 0x5590
leaq -0x388(%rbp), %rdi
callq 0x5240
leaq -0x360(%rbp), %rdi
callq 0x5240
jmp 0x9fc6
leaq -0x590(%rbp), %rdi
callq 0x5590
leaq -0x388(%rbp), %rdi
callq 0x5240
leaq -0x360(%rbp), %rdi
callq 0x5240
jmp 0x9fe0
movl $0x0, -0x4(%rbp)
movl $0x1, -0x50(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x5240
leaq -0x180(%rbp), %rdi
callq 0x5240
jmp 0x9ffa
leaq -0x1a8(%rbp), %rdi
callq 0x5240
leaq -0x180(%rbp), %rdi
callq 0x5240
jmp 0xa00e
leaq -0x80(%rbp), %rdi
callq 0xb170
leaq -0x70(%rbp), %rdi
callq 0x5240
jmp 0xa022
leaq -0x80(%rbp), %rdi
callq 0xb170
leaq -0x70(%rbp), %rdi
callq 0x5240
jmp 0xa02d
leaq -0x38(%rbp), %rdi
callq 0xb1e0
jmp 0xa038
leaq -0x38(%rbp), %rdi
callq 0xb1e0
jmp 0xa044
movl -0x4(%rbp), %eax
addq $0x710, %rsp            # imm = 0x710
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x5620
nopl (%rax)