// File: /workspace/github_c_makefile_star2_O1/MartinDrab[P]netpipe/netpipe.c
// Function: PrepareChannelEnd
static int _PrepareChannelEnd(PCHANNEL_END End, int KeepListening, int ReceiveDomain, int SendDomain)
{
	int ret = 0;
	int af = AF_UNSPEC;
	SOCKET sock = INVALID_SOCKET;
	struct addrinfo hints;
	struct addrinfo *addrs;
	struct sockaddr_storage acceptAddr;
	int acceptAddrLen = sizeof(acceptAddr);
	struct sockaddr *genAddr = NULL;
	socklen_t genAddrLen = 0;
#ifndef _WIN32
	struct sockaddr_un *unixAddress = NULL;

	if (End->AddressFamily != AF_UNIX) {
#endif
		memset(&hints, 0, sizeof(hints));
		hints.ai_family = End->AddressFamily;
		hints.ai_socktype = SOCK_STREAM;
		hints.ai_protocol = 0;
		if (ReceiveDomain || _sourceSuppliedDomain == NULL) {
			LogInfo("Looking for %s:%s", End->Address, End->Service);
			ret = getaddrinfo(End->Address, End->Service, &hints, &addrs);
		} else {
			char *service = _sourceSuppliedDomain + strlen(_sourceSuppliedDomain);

			LogInfo("Looking for %s", _sourceSuppliedDomain);
			while (service != _sourceSuppliedDomain && *service != ':')
				--service;

			if (*service == ':') {
				*service = '\0';
				++service;
			} else service = NULL;

			ret = getaddrinfo(_sourceSuppliedDomain, service, &hints, &addrs);
			if (service != NULL) {
				--service;
				*service = ':';
			}
		}

		if (ret == 0) {
			af = addrs->ai_family;
			if (af == AF_UNSPEC)
				af = End->AddressFamily;

			genAddr = addrs->ai_addr;
			genAddrLen = (socklen_t)addrs->ai_addrlen;
		} else LogError("getaddrinfo: %i", ret);

#ifndef _WIN32
	} else {
		af = AF_UNIX;
		unixAddress = (struct sockaddr_un *)malloc(sizeof(struct sockaddr_un));
		if (unixAddress != NULL) {
			memset(unixAddress, 0, sizeof(struct sockaddr_un));
			unixAddress->sun_family = AF_UNIX;
			memcpy(unixAddress->sun_path, End->Address, strlen(End->Address));
			genAddr = (struct sockaddr *)unixAddress;
			genAddrLen = SUN_LEN(unixAddress);
		} else ret = ENOMEM;
	}
#endif

	if (ret == 0) {
		LogInfo("Creating a socket");
		sock = socket(af, SOCK_STREAM, 0);
		if (sock != INVALID_SOCKET) {
			switch (End->Type) {
				case cetAccept:
					if (End->ListenSocket == INVALID_SOCKET) {
#ifndef _WIN32
						int reuse = 1;

						LogInfo("Allowing to reuse the socket address...");
						ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse));
						if (ret == SOCKET_ERROR) {
							LogError("Error %u", errno);
							ret = 0;
						}

						if (ret == 0) {
							LogInfo("Allowing to reuse the socket port...");
							ret = setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *)&reuse, sizeof(reuse));
							if (ret == SOCKET_ERROR) {
								LogError("Error %u", errno);
								ret = 0;
							}
						}
#endif
						if (ret == 0) {
							LogInfo("Binding the socket");
							ret = bind(sock, genAddr, genAddrLen);
							if (ret == 0) {
								LogInfo("Listening");
								ret = listen(sock, SOMAXCONN);
								if (ret == -1)
									LogError("Error %u", errno);
							} else LogError("Error %u", errno);
						}
					}

					if (ret == 0) {
#ifndef _WIN32
						struct pollfd fds;
#else
						pollfd fds;
#endif
						LogInfo("Accepting");
						memset(&fds, 0, sizeof(fds));
						fds.fd = End->ListenSocket != INVALID_SOCKET ? End->ListenSocket : sock;
						fds.events = POLLIN;
						do {
							fds.revents = 0;
							ret = poll(&fds, 1, 1000);
							if (ret > 0) {
								if (fds.revents & POLLERR) {
									ret = -1;
									break;
								}

								if (fds.revents & POLLIN) {
									End->EndSocket = accept(fds.fd, (struct sockaddr *)&acceptAddr, &acceptAddrLen);
									if (End->EndSocket != INVALID_SOCKET) {
										End->AcceptAddress = sockaddrstr((struct sockaddr *)&acceptAddr);
										if (End->AcceptAddress != NULL) {
											ret = 0;
											LogInfo("Accepted a connection from %s", End->AcceptAddress);
											if (KeepListening && End->ListenSocket == INVALID_SOCKET) {
												End->ListenSocket = sock;
												sock = INVALID_SOCKET;
											}
										} else ret = ENOMEM;

										if (End->AcceptAddress == NULL) {
											LogError("Out of memory");
											closesocket(End->EndSocket);
											End->EndSocket = INVALID_SOCKET;
										}
									} else ret = errno;

									if (ret == 0)
										break;
								}

								if (fds.revents & POLLHUP)
									break;
							} else if (ret == SOCKET_ERROR && errno == EINTR)
								ret = 0;
						} while (!_terminated && ret == 0);

						if (End->EndSocket == INVALID_SOCKET)
							ret = -1;
					}
					break;
				case cetConnect:
					End->AcceptAddress = sockaddrstr(genAddr);
					if (End->AcceptAddress != NULL) {
						LogInfo("Connesting to %s (%s)", End->Address, End->AcceptAddress);
						if (genAddr != NULL) {
							ret = connect(sock, genAddr, genAddrLen);
							if (ret == 0) {
								End->EndSocket = sock;
								sock = INVALID_SOCKET;
							}
						} else ret = EINVAL;
					} else {
						ret = ENOMEM;
						LogError("Out of memory");
					}
					break;
			}

			if (sock != INVALID_SOCKET)
				closesocket(sock);
		} else ret = errno;

#ifndef _WIN32
		if (End->AddressFamily == AF_UNIX)
			free(unixAddress);
		else
#endif
			freeaddrinfo(addrs);
	}

	if (ret == 0 && _keepAlive) {
		ret = UtilsSetKeepAlive(End->EndSocket, _keepAlive);
		if (ret != 0)
			LogWarning("UtilsSetKeepAlive: %u", ret);

		ret = 0;
	}

	if (ret == 0) {
		ret = UtilsSetTimeouts(End->EndSocket, 5000);
		if (ret != 0)
			LogError("UtilsSetTimeouts: %u", ret);
	}

	if (ret == 0 && End->Password != NULL) {
		int success = 0;

		ret = AuthSocket(End->EndSocket, End->Password, &success);
		if (ret == 0 && !success)
			ret = -1;
	}

	if (ret == 0 && ReceiveDomain) {
		uint32_t domainLen = 0;
		char *domain = NULL;

		LogInfo("Receiving domain");
		ret = _recv_fixed(End->EndSocket, (char *)&domainLen, sizeof(domainLen), 0);
		if (ret != 0)
			LogError("Unable to get source domain length: %u", ret);

		if (ret == 0) {
			LogInfo("The domain len has %u characters", domainLen);
			domain = (char *)malloc(domainLen + 1);
			if (domain == NULL) {
				ret = ENOMEM;
				LogError("Unable to allocate space for the domain");
			}

			if (ret == 0) {
				domain[domainLen] = '\0';
				ret = _recv_fixed(End->EndSocket, domain, domainLen, 0);
				if (ret != 0)
					LogError("Failed to receive domain name: %u", ret);

				if (ret == 0) {
					LogInfo("Received domain %s", domain);
					if (_sourceSuppliedDomain != NULL)
						free(_sourceSuppliedDomain);

					_sourceSuppliedDomain = domain;
				}

				if (ret != 0)
					free(domain);
			}
		}
	}

	if (ret == 0 && SendDomain) {
		uint32_t domainLen = 0;

		domainLen = (uint32_t)strlen(_targetSendDomain);
		LogInfo("Sending domain %s (%u)", _targetSendDomain, domainLen);
		if (send(End->EndSocket, (char *)&domainLen, sizeof(domainLen), 0) != sizeof(domainLen)) {
			ret = errno;
			LogError("Failed to send domain length: %u", ret);
		}

		if (ret == 0 &&
			send(End->EndSocket, _targetSendDomain, domainLen, 0) != domainLen) {
			ret = errno;
			LogError("Failed to send domain: %u", ret);
		}
	}

	if (ret != 0) {
		if (End->AcceptAddress != NULL) {
			free(End->AcceptAddress);
			End->AcceptAddress = NULL;
		}

		if (End->EndSocket != INVALID_SOCKET &&
			End->EndSocket) {
			closesocket(End->EndSocket);
			End->EndSocket = INVALID_SOCKET;
		}
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %ecx, %ebp
movl %esi, 0x28(%rsp)
movq %rdi, %rbx
movl $0x80, 0x2c(%rsp)
movl 0x20(%rdi), %eax
cmpl $0x1, %eax
movl %edx, 0x14(%rsp)
jne 0x5ce3
movl %ebp, %r14d
movl $0x6e, %edi
callq 0x2170
movl $0x1, %r15d
testq %rax, %rax
je 0x5db7
movq %rax, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x5e(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movw $0x1, (%rax)
movq %rax, %r12
addq $0x2, %r12
movq 0x8(%rbx), %rbp
movq %rbp, %rdi
callq 0x20c0
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x2160
movq %r12, %rdi
callq 0x20c0
movq %rax, %rbp
addl $0x2, %ebp
xorl %r12d, %r12d
movq %r13, %rax
jmp 0x5e31
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movl %eax, 0x34(%rsp)
movq $0x1, 0x38(%rsp)
testl %edx, %edx
setne %al
movq 0xae12(%rip), %r12      # 0x10b20
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x5d5c
callq 0x2090
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %r8
leaq 0x7eda(%rip), %rsi      # 0xdc09
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x2210
movl %eax, %r12d
jmp 0x5de4
movq %r12, %rdi
callq 0x20c0
movq %rax, %r15
addq %r12, %r15
callq 0x2090
movq 0xadaa(%rip), %rcx      # 0x10b20
leaq 0x7ea5(%rip), %rsi      # 0xdc22
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
movq 0xad8e(%rip), %rdi      # 0x10b20
cmpq %rdi, %r15
je 0x5da8
cmpb $0x3a, (%r15)
je 0x5da8
decq %r15
cmpq %rdi, %r15
jne 0x5d97
movq %rdi, %r15
cmpb $0x3a, (%r15)
jne 0x5dc2
movb $0x0, (%r15)
incq %r15
jmp 0x5dc5
xorl %r13d, %r13d
movl $0xc, %r12d
jmp 0x5e0f
xorl %r15d, %r15d
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %r15, %rsi
callq 0x2210
movl %eax, %r12d
testq %r15, %r15
je 0x5de4
movb $0x3a, -0x1(%r15)
movl %ebp, %r14d
testl %r12d, %r12d
je 0x5e13
callq 0x2090
leaq 0x7e40(%rip), %rsi      # 0xdc38
xorl %r15d, %r15d
movl $0x1, %edi
movl %eax, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x530c
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x5e2f
movq 0x20(%rsp), %rax
movl 0x4(%rax), %r15d
testl %r15d, %r15d
jne 0x5e25
movl 0x20(%rbx), %r15d
movq 0x18(%rax), %r13
movl 0x10(%rax), %ebp
xorl %r12d, %r12d
xorl %eax, %eax
testl %r12d, %r12d
jne 0x6250
movq %rax, 0x18(%rsp)
callq 0x2090
leaq 0x7e04(%rip), %rsi      # 0xdc4f
xorl %r12d, %r12d
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl %r15d, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x5fe1
movl %eax, %r15d
movl (%rbx), %eax
testl %eax, %eax
je 0x5fee
cmpl $0x1, %eax
jne 0x6226
xorl %r12d, %r12d
cmpl $-0x1, 0x28(%rbx)
jne 0x60b1
leaq 0x68(%rsp), %r12
movl $0x1, (%r12)
callq 0x2090
leaq 0x7db6(%rip), %rsi      # 0xdc68
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl %r15d, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %r12, %rcx
movl $0x4, %r8d
callq 0x2080
movl %eax, %r12d
cmpl $-0x1, %eax
jne 0x5f0d
callq 0x2090
movl %eax, %r12d
callq 0x2050
movl (%rax), %ecx
leaq 0x7d9c(%rip), %rsi      # 0xdc97
movl $0x1, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x530c
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x5f7b
callq 0x2090
leaq 0x7d89(%rip), %rsi      # 0xdca7
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
leaq 0x68(%rsp), %rcx
movl %r15d, %edi
movl $0x1, %esi
movl $0xf, %edx
movl $0x4, %r8d
callq 0x2080
movl %eax, %r12d
cmpl $-0x1, %eax
jne 0x5f7b
callq 0x2090
movl %eax, %r12d
callq 0x2050
movl (%rax), %ecx
leaq 0x7d2e(%rip), %rsi      # 0xdc97
movl $0x1, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x530c
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x60b1
callq 0x2090
leaq 0x7d43(%rip), %rsi      # 0xdcd3
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl %r15d, %edi
movq %r13, %rsi
movl %ebp, %edx
callq 0x21b0
movl %eax, %r12d
callq 0x2090
movl %eax, %ebp
testl %r12d, %r12d
je 0x6081
callq 0x2050
movl (%rax), %ecx
leaq 0x7cc9(%rip), %rsi      # 0xdc97
movl $0x1, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x530c
jmp 0x60b1
callq 0x2050
movl (%rax), %r12d
jmp 0x6234
movq %r13, %rdi
callq 0x5428
movq %rax, %r12
movq %rax, 0x18(%rbx)
callq 0x2090
testq %r12, %r12
je 0x6042
movq 0x8(%rbx), %rcx
movq 0x18(%rbx), %r8
leaq 0x7d33(%rip), %rsi      # 0xdd49
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
testq %r13, %r13
je 0x6064
movl %r15d, %edi
movq %r13, %rsi
movl %ebp, %edx
callq 0x21f0
testl %eax, %eax
je 0x606f
movl %eax, %r12d
jmp 0x6226
leaq 0x7ceb(%rip), %rsi      # 0xdd34
movl $0x1, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl $0xc, %r12d
jmp 0x6226
movl $0x16, %r12d
jmp 0x6226
movl %r15d, 0x24(%rbx)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
jmp 0x6226
leaq 0x7c65(%rip), %rsi      # 0xdced
movl $0x4, %edi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl %r15d, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x2190
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x657f
testl %r12d, %r12d
jne 0x6226
callq 0x2090
leaq 0x7c38(%rip), %rsi      # 0xdcfe
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
leaq 0x8(%rsp), %r13
movq $0x0, (%r13)
movl 0x28(%rbx), %eax
cmpl $-0x1, %eax
movl %r15d, %ecx
cmovnel %eax, %ecx
movl %ecx, (%r13)
movw $0x1, 0x4(%r13)
leaq 0x68(%rsp), %rbp
movw $0x0, 0xe(%rsp)
movl $0x1, %esi
movq %r13, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x21a0
movl %eax, %r12d
testl %eax, %eax
jle 0x6198
movzwl 0xe(%rsp), %eax
testb $0x8, %al
jne 0x6211
testb $0x1, %al
je 0x61f9
movl 0x8(%rsp), %edi
movq %rbp, %rsi
leaq 0x2c(%rsp), %rdx
callq 0x21e0
movl %eax, 0x24(%rbx)
cmpl $-0x1, %eax
je 0x61b2
movq %rbp, %rdi
callq 0x5428
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x61bc
callq 0x2090
movq 0x18(%rbx), %rcx
xorl %r12d, %r12d
movl $0x4, %edi
leaq 0x7b99(%rip), %rsi      # 0xdd0f
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
cmpl $0x0, 0x28(%rsp)
je 0x61c2
cmpl $-0x1, 0x28(%rbx)
jne 0x61c2
movl %r15d, 0x28(%rbx)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x61c2
cmpl $-0x1, %r12d
jne 0x6200
callq 0x2050
xorl %r12d, %r12d
cmpl $0x4, (%rax)
setne %r12b
negl %r12d
jmp 0x6200
callq 0x2050
movl (%rax), %r12d
jmp 0x61f4
movl $0xc, %r12d
cmpq $0x0, 0x18(%rbx)
jne 0x61f4
callq 0x2090
movl $0x1, %edi
leaq 0x7b5a(%rip), %rsi      # 0xdd34
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl 0x24(%rbx), %edi
callq 0x2110
movl $0xffffffff, 0x24(%rbx) # imm = 0xFFFFFFFF
testl %r12d, %r12d
je 0x6219
testb $0x10, 0xe(%rsp)
jne 0x621c
movl 0xa8aa(%rip), %eax      # 0x10ab0
orl %r12d, %eax
je 0x60ff
jmp 0x621c
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x621c
xorl %r12d, %r12d
movl 0x24(%rbx), %eax
cmpl $-0x1, %eax
cmovel %eax, %r12d
cmpl $-0x1, %r15d
je 0x6234
movl %r15d, %edi
callq 0x2110
movq 0x18(%rsp), %rdi
cmpl $0x1, 0x20(%rbx)
jne 0x6246
callq 0x2030
jmp 0x6250
movq 0x20(%rsp), %rdi
callq 0x2240
testl %r12d, %r12d
jne 0x629a
testb $0x1, 0xa898(%rip)      # 0x10af4
movl %r14d, %r13d
movl 0x14(%rsp), %r14d
je 0x62a7
movl 0x24(%rbx), %edi
movl $0x1, %esi
callq 0x763d
testl %eax, %eax
je 0x62a4
movl %eax, %ebp
callq 0x2090
leaq 0x7ae1(%rip), %rsi      # 0xdd66
xorl %r12d, %r12d
movl $0x2, %edi
movl %eax, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x530c
jmp 0x62a7
movl %r14d, %r13d
movl 0x14(%rsp), %r14d
jmp 0x62a7
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x62e2
movl 0x24(%rbx), %edi
movl $0x1388, %esi           # imm = 0x1388
callq 0x75b8
testl %eax, %eax
je 0x62df
movl %eax, %r12d
callq 0x2090
leaq 0x7ab7(%rip), %rsi      # 0xdd83
movl $0x1, %edi
movl %eax, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x530c
jmp 0x62e2
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x631b
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x6318
leaq 0x8(%rsp), %r15
movl $0x0, (%r15)
movl 0x24(%rbx), %edi
movq %r15, %rdx
callq 0x4f29
movl (%r15), %ecx
orl %eax, %ecx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmovnel %eax, %r12d
jmp 0x631b
xorl %r12d, %r12d
testl %r14d, %r14d
je 0x645c
testl %r12d, %r12d
jne 0x645c
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
callq 0x2090
leaq 0x7a5a(%rip), %rsi      # 0xdd9f
xorl %r12d, %r12d
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl 0x24(%rbx), %edi
movl $0x4, %edx
movq %r14, %rsi
callq 0x676b
movl %eax, %ebp
callq 0x2090
testl %ebp, %ebp
je 0x638f
leaq 0x7a3d(%rip), %rsi      # 0xddb7
movl $0x1, %edi
movl %eax, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x530c
jmp 0x6459
movl 0x8(%rsp), %ecx
leaq 0x7a4b(%rip), %rsi      # 0xdde5
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
movl 0x8(%rsp), %edi
incl %edi
callq 0x2170
movq %rax, %r14
testq %rax, %rax
jne 0x63dd
callq 0x2090
leaq 0x7a46(%rip), %rsi      # 0xde0d
movl $0x1, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x530c
movl $0xc, %r12d
testq %r14, %r14
je 0x645c
movl 0x8(%rsp), %edx
movb $0x0, (%r14,%rdx)
movl 0x24(%rbx), %edi
movq %r14, %rsi
callq 0x676b
movl %eax, %ebp
callq 0x2090
testl %ebp, %ebp
je 0x641a
leaq 0x7a34(%rip), %rsi      # 0xde3c
movl $0x1, %edi
movl %eax, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x530c
jmp 0x6451
leaq 0x7a44(%rip), %rsi      # 0xde65
xorl %r12d, %r12d
movl $0x4, %edi
movl %eax, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x530c
movq 0xa6e4(%rip), %rdi      # 0x10b20
testq %rdi, %rdi
je 0x6446
callq 0x2030
movq %r14, 0xa6d3(%rip)      # 0x10b20
testl %ebp, %ebp
je 0x645c
movq %r14, %rdi
callq 0x2030
movl %ebp, %r12d
testl %r13d, %r13d
je 0x6538
testl %r12d, %r12d
jne 0x6538
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
movq 0xa697(%rip), %rdi      # 0x10b18
callq 0x20c0
movl %eax, (%r14)
callq 0x2090
movq 0xa683(%rip), %rcx      # 0x10b18
movl (%r14), %r8d
leaq 0x79e0(%rip), %rsi      # 0xde7f
xorl %r12d, %r12d
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x530c
movl 0x24(%rbx), %edi
movl $0x4, %edx
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x20d0
cmpq $0x4, %rax
je 0x64ed
callq 0x2050
movl (%rax), %r12d
callq 0x2090
leaq 0x79c1(%rip), %rsi      # 0xde9d
movl $0x1, %edi
movl %eax, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x530c
testl %r12d, %r12d
jne 0x6538
movl 0x24(%rbx), %edi
movq 0xa61c(%rip), %rsi      # 0x10b18
movl 0x8(%rsp), %edx
xorl %r12d, %r12d
xorl %ecx, %ecx
callq 0x20d0
movl 0x8(%rsp), %ecx
cmpq %rcx, %rax
je 0x6538
callq 0x2050
movl (%rax), %r12d
callq 0x2090
leaq 0x799e(%rip), %rsi      # 0xdec5
movl $0x1, %edi
movl %eax, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x530c
testl %r12d, %r12d
je 0x656a
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x6553
callq 0x2030
movq $0x0, 0x18(%rbx)
movl 0x24(%rbx), %edi
leal 0x1(%rdi), %eax
cmpl $0x2, %eax
jb 0x656a
callq 0x2110
movl $0xffffffff, 0x24(%rbx) # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
callq 0x2090
movl %eax, %ebp
jmp 0x5fc0