// File: /workspace/github_c_makefile_star2_O3/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 %edx, %r14d
movl %esi, %r13d
movq %rdi, %rbx
movl $0x80, 0x2c(%rsp)
movl 0x20(%rdi), %eax
cmpl $0x1, %eax
jne 0x5c23
movl $0x1, %edi
movl $0x6e, %esi
callq 0x2140
testq %rax, %rax
je 0x5d0b
movq %rax, %r12
movl %r14d, 0x18(%rsp)
movl %r13d, 0x1c(%rsp)
movl %ebp, 0x14(%rsp)
movw $0x1, (%rax)
movq %rax, %r15
addq $0x2, %r15
movq 0x8(%rbx), %r13
movq %r13, %rdi
callq 0x20c0
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2170
movq %r15, %rdi
callq 0x20c0
movq %rax, %r15
addl $0x2, %r15d
movl $0x1, %ebp
movq %r12, %r14
jmp 0x5d63
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movl %eax, 0x34(%rsp)
movl $0x1, 0x38(%rsp)
testl %r14d, %r14d
setne %al
movq 0xaee2(%rip), %r12      # 0x10b30
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
movl %r13d, 0x1c(%rsp)
jne 0x5c99
callq 0x2090
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %r8
leaq 0x7f38(%rip), %rsi      # 0xdbac
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x52e4
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
jmp 0x5d22
movq %r12, %rdi
callq 0x20c0
movq %rax, %r15
addq %r12, %r15
callq 0x2090
movq 0xae7d(%rip), %rcx      # 0x10b30
leaq 0x7f0b(%rip), %rsi      # 0xdbc5
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x52e4
movq 0xae61(%rip), %rdi      # 0x10b30
cmpq %rdi, %r15
je 0x5ce5
cmpb $0x3a, (%r15)
je 0x5ceb
decq %r15
cmpq %rdi, %r15
jne 0x5cd4
movq %rdi, %r15
cmpb $0x3a, (%r15)
jne 0x5d16
movb $0x0, (%r15)
leaq 0x1(%r15), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x2220
movl %eax, %r13d
movb $0x3a, (%r15)
jmp 0x5d2a
movl $0xc, %r13d
jmp 0x61aa
leaq 0x30(%rsp), %rdx
leaq 0x20(%rsp), %rcx
xorl %esi, %esi
callq 0x2220
movl %eax, %r13d
testl %r13d, %r13d
je 0x5d40
callq 0x2090
leaq 0x7ea0(%rip), %rsi      # 0xdbdb
jmp 0x6199
movl %r14d, 0x18(%rsp)
movl %ebp, 0x14(%rsp)
movq 0x20(%rsp), %rax
movl 0x4(%rax), %ebp
testl %ebp, %ebp
jne 0x5d58
movl 0x20(%rbx), %ebp
movq 0x18(%rax), %r12
movl 0x10(%rax), %r15d
xorl %r14d, %r14d
callq 0x2090
leaq 0x7e83(%rip), %rsi      # 0xdbf2
xorl %r13d, %r13d
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl %ebp, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2260
cmpl $-0x1, %eax
je 0x5f1d
movl %eax, %ebp
movl (%rbx), %eax
testl %eax, %eax
je 0x5f2a
cmpl $0x1, %eax
jne 0x6114
cmpl $-0x1, 0x28(%rbx)
je 0x5f8a
callq 0x2090
leaq 0x7edd(%rip), %rsi      # 0xdca1
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl 0x28(%rbx), %eax
cmpl $-0x1, %eax
movl %ebp, %ecx
cmovnel %eax, %ecx
leaq 0xc(%rsp), %r15
movl %ecx, (%r15)
movw $0x1, 0x4(%r15)
leaq 0x68(%rsp), %r12
movw $0x0, 0x12(%rsp)
movl $0x1, %esi
movq %r15, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x21b0
movl %eax, %r13d
testl %eax, %eax
jle 0x5e9e
movzwl 0x12(%rsp), %eax
movzwl %ax, %ecx
testb $0x8, %cl
jne 0x60f2
testb $0x1, %cl
je 0x5f01
movl 0xc(%rsp), %edi
movq %r12, %rsi
leaq 0x2c(%rsp), %rdx
callq 0x21f0
movl %eax, 0x24(%rbx)
cmpl $-0x1, %eax
je 0x5eb8
movq %r12, %rdi
callq 0x5400
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x5ec2
callq 0x2090
movq 0x18(%rbx), %rcx
movl $0x4, %edi
leaq 0x7e42(%rip), %rsi      # 0xdcb2
movl %eax, %edx
xorl %eax, %eax
callq 0x52e4
movl 0x1c(%rsp), %eax
testl %eax, %eax
je 0x5e8f
cmpl $-0x1, 0x28(%rbx)
jne 0x5e8f
movl %ebp, 0x28(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
cmpq $0x0, 0x18(%rbx)
je 0x5ec8
jmp 0x6105
cmpl $-0x1, %r13d
jne 0x5f09
callq 0x2050
xorl %r13d, %r13d
cmpl $0x4, (%rax)
setne %r13b
negl %r13d
jmp 0x5f09
callq 0x2050
movl (%rax), %r13d
jmp 0x5ef3
movl $0xc, %r13d
callq 0x2090
movl $0x1, %edi
leaq 0x7dfe(%rip), %rsi      # 0xdcd7
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl 0x24(%rbx), %edi
callq 0x2110
movl $0xffffffff, 0x24(%rbx) # imm = 0xFFFFFFFF
testl %r13d, %r13d
je 0x6102
movzwl 0x12(%rsp), %eax
testb $0x10, %al
jne 0x6105
movl 0xabb1(%rip), %eax      # 0x10ac0
orl %r13d, %eax
je 0x5df3
jmp 0x6105
callq 0x2050
movl (%rax), %r13d
jmp 0x611b
movq %r12, %rdi
callq 0x5400
movq %rax, %r13
movq %rax, 0x18(%rbx)
callq 0x2090
testq %r13, %r13
je 0x60cb
movq 0x8(%rbx), %rcx
movq 0x18(%rbx), %r8
leaq 0x7d96(%rip), %rsi      # 0xdcec
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x52e4
testq %r12, %r12
je 0x60ea
movl %ebp, %edi
movq %r12, %rsi
movl %r15d, %edx
callq 0x2200
testl %eax, %eax
je 0x60fa
movl %eax, %r13d
jmp 0x6114
leaq 0x68(%rsp), %r13
movl $0x1, (%r13)
callq 0x2090
leaq 0x7c68(%rip), %rsi      # 0xdc0b
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl %ebp, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %r13, %rcx
movl $0x4, %r8d
callq 0x2080
testl %eax, %eax
je 0x6002
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0x6114
callq 0x2090
movl %eax, %r13d
callq 0x2050
movl (%rax), %ecx
leaq 0x7c47(%rip), %rsi      # 0xdc3a
movl $0x1, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x52e4
callq 0x2090
leaq 0x7c3c(%rip), %rsi      # 0xdc4a
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
leaq 0x68(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0xf, %edx
movl $0x4, %r8d
callq 0x2080
testl %eax, %eax
je 0x606f
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0x6114
callq 0x2090
movl %eax, %r13d
callq 0x2050
movl (%rax), %ecx
leaq 0x7bda(%rip), %rsi      # 0xdc3a
movl $0x1, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x52e4
callq 0x2090
leaq 0x7bfb(%rip), %rsi      # 0xdc76
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl %ebp, %edi
movq %r12, %rsi
movl %r15d, %edx
callq 0x21c0
movl %eax, %r13d
callq 0x2090
movl %eax, %r15d
testl %r13d, %r13d
je 0x6418
callq 0x2050
movl (%rax), %ecx
leaq 0x7b80(%rip), %rsi      # 0xdc3a
movl $0x1, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x52e4
jmp 0x6114
leaq 0x7c05(%rip), %rsi      # 0xdcd7
movl $0x1, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl $0xc, %r13d
jmp 0x6114
movl $0x16, %r13d
jmp 0x6114
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x6105
movl %ebp, 0x24(%rbx)
xorl %r13d, %r13d
jmp 0x611b
xorl %r13d, %r13d
movl 0x24(%rbx), %eax
cmpl $-0x1, %eax
cmovel %eax, %r13d
cmpl $-0x1, %ebp
je 0x611b
movl %ebp, %edi
callq 0x2110
cmpl $0x1, 0x20(%rbx)
jne 0x612b
movq %r14, %rdi
callq 0x2030
jmp 0x6135
movq 0x20(%rsp), %rdi
callq 0x2250
testl %r13d, %r13d
jne 0x6174
testb $0x1, 0xa9c3(%rip)      # 0x10b04
je 0x6174
movl 0x24(%rbx), %edi
movl $0x1, %esi
callq 0x756f
testl %eax, %eax
je 0x6179
movl %eax, %ebp
callq 0x2090
leaq 0x7ba7(%rip), %rsi      # 0xdd09
movl $0x2, %edi
movl %eax, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x52e4
jmp 0x6179
testl %r13d, %r13d
jne 0x61aa
movl 0x24(%rbx), %edi
movl $0x1388, %esi           # imm = 0x1388
callq 0x74f0
testl %eax, %eax
je 0x61ec
movl %eax, %r13d
callq 0x2090
leaq 0x7b8d(%rip), %rsi      # 0xdd26
movl $0x1, %edi
movl %eax, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x52e4
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x61c0
callq 0x2030
movq $0x0, 0x18(%rbx)
movl 0x24(%rbx), %edi
leal 0x1(%rdi), %eax
cmpl $0x2, %eax
jb 0x61d7
callq 0x2110
movl $0xffffffff, 0x24(%rbx) # imm = 0xFFFFFFFF
movl %r13d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x621d
leaq 0xc(%rsp), %r15
movl $0x0, (%r15)
movl 0x24(%rbx), %edi
movq %r15, %rdx
callq 0x4efd
movl (%r15), %ecx
orl %eax, %ecx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmovnel %eax, %r13d
jmp 0x6220
xorl %r13d, %r13d
movl 0x14(%rsp), %ebp
cmpl $0x0, 0x18(%rsp)
je 0x6291
testl %r13d, %r13d
jne 0x6291
leaq 0xc(%rsp), %r14
movl $0x0, (%r14)
callq 0x2090
leaq 0x7afa(%rip), %rsi      # 0xdd42
movl $0x4, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl 0x24(%rbx), %edi
movl $0x4, %edx
movq %r14, %rsi
callq 0x667f
movl %eax, %r13d
callq 0x2090
testl %r13d, %r13d
je 0x6379
leaq 0x7ada(%rip), %rsi      # 0xdd5a
movl $0x1, %edi
movl %eax, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x52e4
testl %ebp, %ebp
je 0x6368
testl %r13d, %r13d
jne 0x6368
movq 0xa87f(%rip), %rdi      # 0x10b28
callq 0x20c0
movq %rax, %r14
leaq 0xc(%rsp), %r15
movl %r14d, (%r15)
callq 0x2090
movq 0xa863(%rip), %rcx      # 0x10b28
leaq 0x7b56(%rip), %rsi      # 0xde22
movl $0x4, %edi
movl %eax, %edx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x52e4
movl 0x24(%rbx), %edi
movl $0x4, %edx
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x20d0
cmpq $0x4, %rax
je 0x631f
callq 0x2050
movl (%rax), %r13d
callq 0x2090
leaq 0x7b37(%rip), %rsi      # 0xde40
movl $0x1, %edi
movl %eax, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x52e4
testl %r13d, %r13d
jne 0x6368
movl 0x24(%rbx), %edi
movq 0xa7ff(%rip), %rsi      # 0x10b28
movl 0xc(%rsp), %edx
xorl %ecx, %ecx
callq 0x20d0
movl 0xc(%rsp), %ecx
movl $0x0, %r13d
cmpq %rcx, %rax
je 0x6368
callq 0x2050
movl (%rax), %r13d
callq 0x2090
leaq 0x7b11(%rip), %rsi      # 0xde68
movl $0x1, %edi
movl %eax, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x52e4
testl %r13d, %r13d
jne 0x61aa
xorl %r13d, %r13d
jmp 0x61d7
movl 0xc(%rsp), %ecx
leaq 0x7a04(%rip), %rsi      # 0xdd88
movl $0x4, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x52e4
movl 0xc(%rsp), %r15d
leal 0x1(%r15), %edi
callq 0x2180
testq %rax, %rax
je 0x63f1
movq %rax, %r14
movb $0x0, (%rax,%r15)
movl 0x24(%rbx), %edi
movq %rax, %rsi
movq %r15, %rdx
callq 0x667f
movl %eax, %r13d
callq 0x2090
testl %r13d, %r13d
je 0x6451
leaq 0x7a0c(%rip), %rsi      # 0xdddf
movl $0x1, %edi
movl %eax, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x52e4
movq %r14, %rdi
callq 0x2030
jmp 0x6291
callq 0x2090
leaq 0x79b3(%rip), %rsi      # 0xddb0
movl $0x1, %edi
movl %eax, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl $0xc, %r13d
jmp 0x6291
leaq 0x7871(%rip), %rsi      # 0xdc90
movl $0x4, %edi
movl %r15d, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x52e4
movl %ebp, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x21a0
cmpl $-0x1, %eax
je 0x6489
movl %eax, %r13d
testl %eax, %eax
jne 0x6114
jmp 0x5db8
leaq 0x79b0(%rip), %rsi      # 0xde08
xorl %r13d, %r13d
movl $0x4, %edi
movl %eax, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x52e4
movq 0xa6bd(%rip), %rdi      # 0x10b30
testq %rdi, %rdi
je 0x647d
callq 0x2030
movq %r14, 0xa6ac(%rip)      # 0x10b30
jmp 0x6291
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
callq 0x2090
movl %eax, %r15d
jmp 0x60ac