// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/io/drivers/driver_socks5.cpp
// Function: smooth::IO::DriverSOCKS5::DriverSOCKS5(smooth::String const&, int, smooth::String const&, int, smooth::String const&, smooth::String const&)
S::IO::DriverSOCKS5::DriverSOCKS5(const String &proxy, Int socksPort, const String &hostName, Int port, const String &uname, const String &passwd) : Driver()
{
	closeStream = False;

	stream	    = -1;
	size	    = -1;

	if (hostName == NIL || hostName.Length() > 255) { lastError = IO_ERROR_BADPARAM; return; }

	/* Open TCP/IP socket.
	 */
	stream = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

	if (stream == (unsigned) (~0)) { lastError = IO_ERROR_UNEXPECTED; return; }

	closeStream = True;

	/* Get proxy hostname.
	 */
	hostent		*host = gethostbyname(proxy);

	if (host == NIL) { Close(); lastError = IO_ERROR_UNEXPECTED; return; }

	/* Connect to proxy.
	 */
	sockaddr_in	 saddr;

	saddr.sin_family = AF_INET;
	saddr.sin_addr	 = *((in_addr *) *host->h_addr_list);
	saddr.sin_port	 = htons((short) socksPort);

	memset(&saddr.sin_zero, 0, sizeof(saddr.sin_zero));

	if (connect(stream, (sockaddr *) &saddr, sizeof(struct sockaddr)) == -1) { Close(); lastError = IO_ERROR_UNEXPECTED; return; }

	/* Send connect request.
	 */
	if (uname == NIL)
	{
		unsigned char	*socksdata = new unsigned char [3];

		socksdata[0] = 5;	// SOCKS version 5
		socksdata[1] = 1;	// One authentication method
		socksdata[2] = 0x00;	// Method 1: No authentication

		if (send(stream, (char *) socksdata, 3, 0) < 3) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		/* Read and evaluate response.
		 */
		int	 recbytes = 0;

		while (recbytes != 2)
		{
			int	 bytes = recv(stream, (char *) socksdata + recbytes, 2 - recbytes, 0);

			if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

			recbytes += bytes;
		}

		/* Check if proxy requires authentication.
		 */
		if (socksdata[1] == 0xFF) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		delete [] socksdata;
	}
	else
	{
		unsigned char	*socksdata = new unsigned char [4];

		socksdata[0] = 5;	// SOCKS version 5
		socksdata[1] = 2;	// Two authentication methods
		socksdata[2] = 0x00;	// Method 0x00: No authentication
		socksdata[3] = 0x02;	// Method 0x02: Username / password

		if (send(stream, (char *) socksdata, 4, 0) < 4) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		/* Read and evaluate response.
		 */
		int	 recbytes = 0;

		while (recbytes != 2)
		{
			int	 bytes = recv(stream, (char *) socksdata + recbytes, 2 - recbytes, 0);

			if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

			recbytes += bytes;
		}

		/* Check if proxy accepted authentication method.
		 */
		if (socksdata[1] == 0xFF) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		if (socksdata[1] == 0x02)
		{
			/* Method 0x02: Username / password
			 */
			delete [] socksdata;

			Int	 unameLen  = strlen(uname);
			Int	 passwdLen = passwd != NIL ? strlen(passwd) : 0;

			socksdata = new unsigned char [3 + unameLen + passwdLen];

			socksdata[0] = 1;
			socksdata[1] = unameLen;

			for (Int i = 0; i < unameLen; i++) socksdata[2 + i] = uname[i];

			socksdata[2 + unameLen] = passwdLen;

			for (Int i = 0; i < passwdLen; i++) socksdata[3 + unameLen + i] = passwd[i];

			if (send(stream, (char *) socksdata, 3 + unameLen + passwdLen, 0) < 3 + unameLen + passwdLen) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

			/* Read and evaluate response.
			 */
			int	 recbytes = 0;

			while (recbytes != 2)
			{
				int	 bytes = recv(stream, (char *) socksdata + recbytes, 2 - recbytes, 0);

				if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

				recbytes += bytes;
			}

			/* Check if proxy accepted username/password.
			 */
			if (socksdata[1] != 0x00) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }
		}

		delete [] socksdata;
	}

	/* Send connect request.
	 */
	unsigned char	*socksdata = new unsigned char [5 + 255 + 2];

	Int	 hostNameLen = strlen(hostName);

	socksdata[0] = 5;	// SOCKS version 5
	socksdata[1] = 0x01;	// Command: Connect
	socksdata[2] = 0x00;	// Reserved field
	socksdata[3] = 0x03;	// Connect type: Domain name
	socksdata[4] = hostNameLen;

	for (Int i = 0; i < hostNameLen; i++) socksdata[5 + i] = hostName[i];

	socksdata[5 + hostNameLen] = htons((short) port) % 256;
	socksdata[6 + hostNameLen] = htons((short) port) / 256;

	if (send(stream, (char *) socksdata, 7 + hostNameLen, 0) < 7 + hostNameLen) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

	/* Receive and evaluate first 4 bytes of answer.
	 */
	int	 recbytes = 0;

	while (recbytes != 4)
	{
		int	 bytes = recv(stream, (char *) socksdata + recbytes, 4 - recbytes, 0);

		if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		recbytes += bytes;
	}

	/* Check if connect attempt was successful.
	 */
	if (socksdata[1] != 0x00) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

	/* Receive rest of answer.
	 */
	if (socksdata[3] == 0x01)
	{
		/* Read IP address and port.
		 */
		int	 recbytes = 0;

		while (recbytes != 6)
		{
			int	 bytes = recv(stream, (char *) socksdata + 4 + recbytes, 6 - recbytes, 0);

			if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

			recbytes += bytes;
		}
	}
	else if (socksdata[3] == 0x03)
	{
		/* Read length of hostname.
		 */
		if (recv(stream, (char *) socksdata + 4, 1, 0) <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

		/* Read hostname and port.
		 */
		int	 neededbytes = Math::Min(255, socksdata[4]) + 2;
		int	 recbytes    = 0;

		while (recbytes != neededbytes)
		{
			int	 bytes = recv(stream, (char *) socksdata + 5 + recbytes, neededbytes - recbytes, 0);

			if (bytes <= 0) { delete [] socksdata; Close(); lastError = IO_ERROR_UNEXPECTED; return; }

			recbytes += bytes;
		}
	}

	delete [] socksdata;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x5cff0
movq -0xd0(%rbp), %rax
movq 0x11d673(%rip), %rcx    # 0x208c28
addq $0x10, %rcx
movq %rcx, (%rax)
movb $0x0, 0x3c(%rax)
movl $0xffffffff, 0x38(%rax) # imm = 0xFFFFFFFF
movq $-0x1, 0x8(%rax)
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x59320
movb %al, -0xc5(%rbp)
jmp 0xeb5e2
movb -0xc5(%rbp), %al
testb $0x1, %al
jne 0xeb60c
jmp 0xeb5ee
movq -0x28(%rbp), %rdi
callq 0x5b800
movl %eax, -0xd4(%rbp)
jmp 0xeb5ff
movl -0xd4(%rbp), %eax
cmpl $0xff, %eax
jle 0xeb63c
movq -0xd0(%rbp), %rax
movl $0x2, 0x18(%rax)
jmp 0xec3a7
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x5b1a0
jmp 0xec3b1
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x5ab00
movl %eax, %ecx
movq -0xd0(%rbp), %rax
movl %ecx, 0x38(%rax)
cmpl $-0x1, 0x38(%rax)
jne 0xeb675
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0xd0(%rbp), %rax
movb $0x1, 0x3c(%rax)
movq -0x18(%rbp), %rdi
callq 0x5d090
movq %rax, -0xe0(%rbp)
jmp 0xeb692
movq -0xe0(%rbp), %rdi
callq 0x5a990
movq %rax, -0xe8(%rbp)
jmp 0xeb6a7
movq -0xe8(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xeb6de
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb6cb
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movw $0x2, -0x60(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movzwl -0x1c(%rbp), %edi
callq 0x5ba50
movw %ax, %cx
movq -0xd0(%rbp), %rax
movw %cx, -0x5e(%rbp)
movq $0x0, -0x58(%rbp)
movl 0x38(%rax), %edi
leaq -0x60(%rbp), %rsi
movl $0x10, %edx
callq 0x5a630
movl %eax, -0xec(%rbp)
jmp 0xeb72c
movl -0xec(%rbp), %eax
cmpl $-0x1, %eax
jne 0xeb75c
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb749
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x59320
movb %al, -0xed(%rbp)
jmp 0xeb76f
movb -0xed(%rbp), %al
testb $0x1, %al
jne 0xeb77e
jmp 0xeb93a
movl $0x3, %edi
callq 0x5ab20
movq %rax, -0xf8(%rbp)
jmp 0xeb791
movq -0xd0(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movq -0x68(%rbp), %rcx
movb $0x5, (%rcx)
movq -0x68(%rbp), %rcx
movb $0x1, 0x1(%rcx)
movq -0x68(%rbp), %rcx
movb $0x0, 0x2(%rcx)
movl 0x38(%rax), %edi
movq -0x68(%rbp), %rsi
movl $0x3, %edx
xorl %ecx, %ecx
callq 0x5a4f0
movq %rax, -0x100(%rbp)
jmp 0xeb7d6
movq -0x100(%rbp), %rax
cmpq $0x3, %rax
jge 0xeb825
movq -0x68(%rbp), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, %rax
je 0xeb800
movq -0x108(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb812
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl $0x0, -0x6c(%rbp)
cmpl $0x2, -0x6c(%rbp)
je 0xeb8c7
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x68(%rbp), %rsi
movslq -0x6c(%rbp), %rax
movl %eax, %ecx
addq %rax, %rsi
movl $0x2, %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x110(%rbp)
jmp 0xeb867
movq -0x110(%rbp), %rax
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
jg 0xeb8b9
movq -0x68(%rbp), %rax
movq %rax, -0x118(%rbp)
cmpq $0x0, %rax
je 0xeb894
movq -0x118(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb8a6
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0x70(%rbp), %eax
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0xeb82c
movq -0x68(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xff, %eax
jne 0xeb918
movq -0x68(%rbp), %rax
movq %rax, -0x120(%rbp)
cmpq $0x0, %rax
je 0xeb8f3
movq -0x120(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb905
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0x68(%rbp), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0xeb935
movq -0x128(%rbp), %rdi
callq 0x5a5e0
jmp 0xebe68
movl $0x4, %edi
callq 0x5ab20
movq %rax, -0x130(%rbp)
jmp 0xeb94d
movq -0xd0(%rbp), %rax
movq -0x130(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq -0x78(%rbp), %rcx
movb $0x5, (%rcx)
movq -0x78(%rbp), %rcx
movb $0x2, 0x1(%rcx)
movq -0x78(%rbp), %rcx
movb $0x0, 0x2(%rcx)
movq -0x78(%rbp), %rcx
movb $0x2, 0x3(%rcx)
movl 0x38(%rax), %edi
movq -0x78(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x5a4f0
movq %rax, -0x138(%rbp)
jmp 0xeb99a
movq -0x138(%rbp), %rax
cmpq $0x4, %rax
jge 0xeb9e9
movq -0x78(%rbp), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, %rax
je 0xeb9c4
movq -0x140(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeb9d6
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl $0x0, -0x7c(%rbp)
cmpl $0x2, -0x7c(%rbp)
je 0xeba8b
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x78(%rbp), %rsi
movslq -0x7c(%rbp), %rax
movl %eax, %ecx
addq %rax, %rsi
movl $0x2, %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x148(%rbp)
jmp 0xeba2b
movq -0x148(%rbp), %rax
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
jg 0xeba7d
movq -0x78(%rbp), %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, %rax
je 0xeba58
movq -0x150(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xeba6a
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0x80(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0xeb9f0
movq -0x78(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xff, %eax
jne 0xebadc
movq -0x78(%rbp), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, %rax
je 0xebab7
movq -0x158(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xebac9
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0x78(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x2, %eax
jne 0xebe49
movq -0x78(%rbp), %rax
movq %rax, -0x160(%rbp)
cmpq $0x0, %rax
je 0xebb0a
movq -0x160(%rbp), %rdi
callq 0x5a5e0
movq -0x38(%rbp), %rdi
callq 0x5d090
movq %rax, -0x168(%rbp)
jmp 0xebb1c
movq -0x168(%rbp), %rdi
callq 0x5a790
movl %eax, -0x84(%rbp)
movq 0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x5b110
movb %al, -0x169(%rbp)
jmp 0xebb41
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0xebb4d
jmp 0xebb74
movq 0x10(%rbp), %rdi
callq 0x5d090
movq %rax, -0x178(%rbp)
jmp 0xebb5f
movq -0x178(%rbp), %rdi
callq 0x5a790
movq %rax, -0x180(%rbp)
jmp 0xebb7f
xorl %eax, %eax
movq %rax, -0x180(%rbp)
jmp 0xebb7f
movq -0x180(%rbp), %rax
movl %eax, -0x88(%rbp)
movl -0x84(%rbp), %edx
movl -0x88(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x3(%rax,%rcx), %eax
movslq %eax, %rdi
callq 0x5ab20
movq %rax, -0x188(%rbp)
jmp 0xebbb1
movq -0x188(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movb $0x1, (%rax)
movl -0x84(%rbp), %eax
movb %al, %cl
movq -0x78(%rbp), %rax
movb %cl, 0x1(%rax)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jge 0xebc2d
movq -0x38(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x5c900
movl %eax, -0x18c(%rbp)
jmp 0xebc01
movl -0x18c(%rbp), %eax
movb %al, %dl
movq -0x78(%rbp), %rax
movl -0x8c(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0xebbdc
movl -0x88(%rbp), %eax
movb %al, %dl
movq -0x78(%rbp), %rax
movl -0x84(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
cmpl -0x88(%rbp), %eax
jge 0xebca9
movq 0x10(%rbp), %rdi
movl -0x90(%rbp), %esi
callq 0x5c900
movl %eax, -0x190(%rbp)
jmp 0xebc77
movl -0x190(%rbp), %eax
movb %al, %dl
movq -0x78(%rbp), %rax
movl -0x84(%rbp), %ecx
addl $0x3, %ecx
addl -0x90(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0xebc52
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x78(%rbp), %rsi
movl -0x84(%rbp), %edx
movl -0x88(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x3(%rax,%rcx), %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5a4f0
movq %rax, -0x198(%rbp)
jmp 0xebcde
movq -0x198(%rbp), %rax
movl -0x84(%rbp), %ecx
addl $0x3, %ecx
addl -0x88(%rbp), %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0xebd3e
movq -0x78(%rbp), %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x0, %rax
je 0xebd19
movq -0x1a0(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xebd2b
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl $0x0, -0x94(%rbp)
cmpl $0x2, -0x94(%rbp)
je 0xebdf8
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x78(%rbp), %rsi
movslq -0x94(%rbp), %rax
movl %eax, %ecx
addq %rax, %rsi
movl $0x2, %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x1a8(%rbp)
jmp 0xebd89
movq -0x1a8(%rbp), %rax
movl %eax, -0x98(%rbp)
cmpl $0x0, -0x98(%rbp)
jg 0xebde1
movq -0x78(%rbp), %rax
movq %rax, -0x1b0(%rbp)
cmpq $0x0, %rax
je 0xebdbc
movq -0x1b0(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xebdce
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0x98(%rbp), %eax
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0xebd48
movq -0x78(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0xebe47
movq -0x78(%rbp), %rax
movq %rax, -0x1b8(%rbp)
cmpq $0x0, %rax
je 0xebe22
movq -0x1b8(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xebe34
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
jmp 0xebe49
movq -0x78(%rbp), %rax
movq %rax, -0x1c0(%rbp)
cmpq $0x0, %rax
je 0xebe66
movq -0x1c0(%rbp), %rdi
callq 0x5a5e0
jmp 0xebe68
movl $0x106, %edi            # imm = 0x106
callq 0x5ab20
movq %rax, -0x1c8(%rbp)
jmp 0xebe7b
movq -0x1c8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5d090
movq %rax, -0x1d0(%rbp)
jmp 0xebe9b
movq -0x1d0(%rbp), %rdi
callq 0x5a790
movl %eax, -0xa4(%rbp)
movq -0xa0(%rbp), %rax
movb $0x5, (%rax)
movq -0xa0(%rbp), %rax
movb $0x1, 0x1(%rax)
movq -0xa0(%rbp), %rax
movb $0x0, 0x2(%rax)
movq -0xa0(%rbp), %rax
movb $0x3, 0x3(%rax)
movl -0xa4(%rbp), %eax
movb %al, %cl
movq -0xa0(%rbp), %rax
movb %cl, 0x4(%rax)
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0xebf48
movq -0x28(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x5c900
movl %eax, -0x1d4(%rbp)
jmp 0xebf19
movl -0x1d4(%rbp), %eax
movb %al, %dl
movq -0xa0(%rbp), %rax
movl -0xa8(%rbp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0xebef4
movzwl -0x2c(%rbp), %edi
callq 0x5ba50
movb %al, %dl
movq -0xa0(%rbp), %rcx
movslq -0xa4(%rbp), %rax
movb %dl, 0x5(%rax,%rcx)
movzwl -0x2c(%rbp), %edi
callq 0x5ba50
movw %ax, %cx
movq -0xd0(%rbp), %rax
movw %cx, %bx
movq -0xa0(%rbp), %rdx
movslq -0xa4(%rbp), %rcx
movb %bh, %bl
movb %bl, 0x6(%rcx,%rdx)
movl 0x38(%rax), %edi
movq -0xa0(%rbp), %rsi
movl -0xa4(%rbp), %eax
addl $0x7, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5a4f0
movq %rax, -0x1e0(%rbp)
jmp 0xebfb5
movq -0x1e0(%rbp), %rax
movl -0xa4(%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0xec012
movq -0xa0(%rbp), %rax
movq %rax, -0x1e8(%rbp)
cmpq $0x0, %rax
je 0xebfed
movq -0x1e8(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xebfff
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl $0x0, -0xac(%rbp)
cmpl $0x4, -0xac(%rbp)
je 0xec0d2
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0xa0(%rbp), %rsi
movslq -0xac(%rbp), %rax
movl %eax, %ecx
addq %rax, %rsi
movl $0x4, %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x1f0(%rbp)
jmp 0xec060
movq -0x1f0(%rbp), %rax
movl %eax, -0xb0(%rbp)
cmpl $0x0, -0xb0(%rbp)
jg 0xec0bb
movq -0xa0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
cmpq $0x0, %rax
je 0xec096
movq -0x1f8(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xec0a8
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0xb0(%rbp), %eax
addl -0xac(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0xec01c
movq -0xa0(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0xec127
movq -0xa0(%rbp), %rax
movq %rax, -0x200(%rbp)
cmpq $0x0, %rax
je 0xec102
movq -0x200(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xec114
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0xa0(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x1, %eax
jne 0xec202
movl $0x0, -0xb4(%rbp)
cmpl $0x6, -0xb4(%rbp)
je 0xec1fd
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0xa0(%rbp), %rax
movslq -0xb4(%rbp), %rdx
movl %edx, %ecx
leaq 0x4(%rax,%rdx), %rsi
movl $0x6, %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x208(%rbp)
jmp 0xec18b
movq -0x208(%rbp), %rax
movl %eax, -0xb8(%rbp)
cmpl $0x0, -0xb8(%rbp)
jg 0xec1e6
movq -0xa0(%rbp), %rax
movq %rax, -0x210(%rbp)
cmpq $0x0, %rax
je 0xec1c1
movq -0x210(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xec1d3
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0xb8(%rbp), %eax
addl -0xb4(%rbp), %eax
movl %eax, -0xb4(%rbp)
jmp 0xec145
jmp 0xec387
movq -0xa0(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x3, %eax
jne 0xec385
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0xa0(%rbp), %rsi
addq $0x4, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x218(%rbp)
jmp 0xec240
movq -0x218(%rbp), %rax
cmpq $0x0, %rax
jg 0xec292
movq -0xa0(%rbp), %rax
movq %rax, -0x220(%rbp)
cmpq $0x0, %rax
je 0xec26d
movq -0x220(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xec27f
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movq -0xa0(%rbp), %rax
movzbl 0x4(%rax), %esi
movl $0xff, %edi
callq 0x5b740
movl %eax, -0x224(%rbp)
jmp 0xec2af
movl -0x224(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xbc(%rbp)
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xbc(%rbp), %eax
je 0xec383
movq -0xd0(%rbp), %rax
movl 0x38(%rax), %edi
movq -0xa0(%rbp), %rax
movslq -0xc0(%rbp), %rdx
movl %edx, %ecx
leaq 0x5(%rax,%rdx), %rsi
movl -0xbc(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x5ccb0
movq %rax, -0x230(%rbp)
jmp 0xec314
movq -0x230(%rbp), %rax
movl %eax, -0xc4(%rbp)
cmpl $0x0, -0xc4(%rbp)
jg 0xec36c
movq -0xa0(%rbp), %rax
movq %rax, -0x238(%rbp)
cmpq $0x0, %rax
je 0xec34a
movq -0x238(%rbp), %rdi
callq 0x5a5e0
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq 0x38(%rax), %rax
callq *%rax
jmp 0xec35c
movq -0xd0(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0xec3a7
movl -0xc4(%rbp), %eax
addl -0xc0(%rbp), %eax
movl %eax, -0xc0(%rbp)
jmp 0xec2c8
jmp 0xec385
jmp 0xec387
movq -0xa0(%rbp), %rax
movq %rax, -0x240(%rbp)
cmpq $0x0, %rax
je 0xec3a7
movq -0x240(%rbp), %rdi
callq 0x5a5e0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5b6b0
nopw (%rax,%rax)