// File: /workspace/github_cpp_makefile_star2_O3/akw0088[P]openssl/rsync_upload.c
// Function: rsync_file_download
int rsync_file_download(char *ip_str, unsigned short int port, char *response, int size, unsigned int *final_size, char *file_name, unsigned int block_size)
{
	struct sockaddr_in	servaddr;
	SOCKET sock;
	int ret;

	sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

	memset(&servaddr, 0, sizeof(struct sockaddr_in));
	servaddr.sin_family = AF_INET;
	servaddr.sin_addr.s_addr = inet_addr(ip_str);
	servaddr.sin_port = htons(port);

	// 3 way handshake
	printf("Attempting to connect to %s\n", ip_str);
	ret = connect(sock, (struct sockaddr *)&servaddr, sizeof(struct sockaddr_in));
	if (ret == SOCKET_ERROR)
	{
#ifdef _WIN32
		ret = WSAGetLastError();

		switch (ret)
		{
		case WSAETIMEDOUT:
			printf("Fatal Error: Connection timed out.\n");
			break;
		case WSAECONNREFUSED:
			printf("Fatal Error: Connection refused\n");
			break;
		case WSAEHOSTUNREACH:
			printf("Fatal Error: Router sent ICMP packet (destination unreachable)\n");
			break;
		default:
			printf("Fatal Error: %d\n", ret);
			break;
		}
#else
		ret = errno;

	        switch(ret)
	        {
		case ENETUNREACH:
			printf("Fatal Error: The network is unreachable from this host at this time.\n(Bad IP address)\n");
			break;
	        case ETIMEDOUT:
	                printf("Fatal Error: Connecting timed out.\n");
	                break;
	        case ECONNREFUSED:
	                printf("Fatal Error: Connection refused\n");
	                break;
	        case EHOSTUNREACH:
	                printf("Fatal Error: router sent ICMP packet (destination unreachable)\n");
	                break;
	        default:
	                printf("Fatal Error: %d\n", ret);
	                break;
	        }
#endif
		return -1;
	}
	printf("TCP handshake completed\n");

	memset(response, 0, size);

	unsigned int rnum_block = 0;
	unsigned int rfile_size = 0;
	if (Recv(sock, (char *)&rfile_size, sizeof(unsigned int), 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	if ( Recv(sock, (char *)file_name, PATH_SIZE, 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	char temp[PATH_SIZE] = {0};
	StripChars(file_name, temp, ".\\/;:*?\"<>|");
	strcpy(file_name, temp);

	unsigned char rfile_hash[MD5_SIZE + 1] = {0};
	if ( Recv(sock, (char *)rfile_hash, MD5_SIZE, 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}


	printf("Opening local %s file for compare\r\n", file_name);
	unsigned int file_size = 0;
	char *data = get_file(file_name, &file_size);
	if (data == NULL)
	{
		printf("Unable to open %s\r\n", file_name);
	}

	unsigned char file_hash[MD5_SIZE + 1] = {0};
	if (data != NULL)
	{
		md5sum((char *)&data[0], file_size, (char *)file_hash);
	}

	if ( Send(sock, (char *)file_hash, MD5_SIZE, 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	if (rfile_size == file_size)
	{
		printf("Our file is same size\r\n");
		if (strcmp((char *)file_hash, (char *)rfile_hash) == 0)
		{
			printf("Files have the same hash\r\n");
			*final_size = 0;
			return 0;
		}

	}
	else if (rfile_size > file_size)
	{
		printf("Our file is smaller by %d bytes\r\n", rfile_size - file_size);
	}
	else
	{
		printf("Our file is larger by %d bytes\r\n", file_size - rfile_size);
	}

	if (data == NULL)
	{
		file_size = rfile_size;
	}

	// Calculate block size first
	unsigned int num_block = file_size / block_size;
	int remainder = file_size - num_block * block_size;
	if (remainder > 0)
	{
		num_block++;
	}


	printf("File has %d blocks %d bytes remainder %d\r\n", num_block, file_size, remainder);

	char **md5_array = (char **)malloc(num_block * sizeof(char *));
	if (md5_array == NULL)
	{
		perror("malloc failed");
		return -1;
	}

	unsigned int *checksum_adler32 = (unsigned int *)malloc(num_block * sizeof(unsigned int));
	if (checksum_adler32 == NULL)
	{
		perror("malloc failed");
		return -1;
	}

	for (unsigned int i = 0; i < num_block; i++)
	{
		checksum_adler32[i] = -1;
		md5_array[i] = md5_array[i] = malloc(MD5_SIZE + 1);
		if (md5_array[i] == NULL)
		{
			perror("malloc failed");
			return -1;
		}

		memset(md5_array[i], 0, MD5_SIZE + 1);
	}

	if (data)
	{
		printf("Calculating adler32 and md5 hashes for each block\r\n");
		for (unsigned int i = 0; i < num_block; i++)
		{
			unsigned int rsize = block_size;

			if (i == num_block - 1)
			{
				rsize = file_size - block_size * i;
			}
			checksum_adler32[i] = adler32((unsigned char *)&data[block_size * i], rsize);
			md5sum((char *)&data[block_size * i], rsize, md5_array[i]);
		}
	}
	
	printf("Sending hashes to server\r\n");	
	block_t *block = (block_t *)malloc(num_block * sizeof(block_t));
	if (block == NULL)
	{
		perror("malloc failed");
		return -1;
	}

	Send(sock, (char *)&num_block, sizeof(int), 0);
	Send(sock, (char *)&block_size, sizeof(int), 0);
	Send(sock, (char *)checksum_adler32, num_block * sizeof(int), 0);
	for (unsigned int i = 0; i < num_block; i++)
	{
		Send(sock, (char *)md5_array[i], MD5_SIZE, 0);
	}

	if ( Recv(sock, (char *)&block[0], sizeof(block_t) * num_block, 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	printf("Got offsets for each block\r\n");
	for (unsigned int i = 0; i < num_block; i++)
	{
		int rsize = block_size;

		if (i == num_block - 1)
		{
			rsize = rfile_size - (num_block - 1) * block_size;
		}

		if (block[i].offset == -1)
		{
			printf("\tmissing block %d [%d bytes]\r\n", i, rsize);
		}
	}

	unsigned int diff_size = 0;
	if ( Recv(sock, (char *)&diff_size, sizeof(unsigned int), 0) == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	printf("Delta size is %d bytes\r\n", diff_size);

	unsigned char *diff = (unsigned char *)malloc(diff_size + block_size);
	if (diff == NULL)
	{
		perror("malloc failed");
	}

	unsigned int download_size = 0;
	download_size = Recv(sock, (char *)diff, diff_size, 0);
	if (download_size == -1)
	{
		printf("recv failed\r\n");
		return -1;
	}

	printf("Downloaded delta\r\n");
	closesocket(sock);

	assemble_download(response, rfile_size, data, file_size, block, num_block, block_size, (char *)diff, diff_size);
	*final_size = rfile_size;

	// Calculate final hash to be sure it matches
	memset(file_hash, 0, MD5_SIZE + 1);
	md5sum(response, *final_size, (char *)file_hash);


	if (strcmp((char *)file_hash, (char *)rfile_hash) != 0)
	{
		printf("Rsync failed\r\n");
		printf("hashes dont match\r\n\tremote: %s\r\n\tlocal : %s\r\n", file_hash, rfile_hash);
		printf("file size\r\n\tremote: %d\r\n\tlocal : %d\r\n", *final_size, rfile_size);
		printf("First 8 bytes\r\n");
		for (int i = 0; i < 8; i++)
		{
			printf("%02X ", response[i]);
		}

		printf("\r\nLast 8 bytes\r\n");
		for (int i = 0; i < 8; i++)
		{
			printf("%02X ", response[i + *final_size - 8]);
		}
		return -1;
	}

	printf("Rsync successful\r\n");
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %r9, %rbx
movq %r8, 0x18(%rsp)
movl %ecx, 0x20(%rsp)
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %r12
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x1240
movl %eax, %ebp
leaq 0x90(%rsp), %r13
movq $0x0, 0x8(%r13)
movw $0x2, (%r13)
movq %r12, %rdi
callq 0x1130
movl %eax, 0x4(%r13)
rolw $0x8, %r14w
movw %r14w, 0x2(%r13)
leaq 0x24fa(%rip), %rdi      # 0x4064
xorl %r14d, %r14d
movq %r12, %rsi
xorl %eax, %eax
callq 0x10e0
movl %ebp, %edi
movq %r13, %rsi
movl $0x10, %edx
callq 0x1210
cmpl $-0x1, %eax
je 0x1bdc
leaq 0x27a0(%rip), %rdi      # 0x4332
callq 0x1070
movslq 0x20(%rsp), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movl $0x0, 0xc(%rsp)
movq %r15, %r12
movl %r14d, %eax
leaq (%rsp,%rax), %rsi
addq $0xc, %rsi
movl $0x4, %edx
subl %r14d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x1040
testl %eax, %eax
jle 0x1c0a
addl %eax, %r14d
cmpl $0x4, %r14d
jb 0x1bb1
jmp 0x1c13
callq 0x1050
movl (%rax), %esi
cmpl $0x6e, %esi
jg 0x1d30
cmpl $0x65, %esi
je 0x1e0f
cmpl $0x6e, %esi
jne 0x1dfc
leaq 0x288f(%rip), %rdi      # 0x4494
jmp 0x2145
cmpl $-0x1, %eax
je 0x213e
xorl %r14d, %r14d
movl %r14d, %esi
addq %rbx, %rsi
movl $0x80, %edx
subl %r14d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x1040
testl %eax, %eax
jle 0x1c3f
addl %eax, %r14d
cmpl $0x80, %r14d
jb 0x1c16
jmp 0x1c48
cmpl $-0x1, %eax
je 0x213e
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %r14
movaps %xmm0, 0x70(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0x2411(%rip), %rdx      # 0x4092
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2321
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movb $0x0, 0x80(%rsp)
xorl %r14d, %r14d
movl %r14d, %eax
leaq (%rsp,%rax), %rsi
addq $0x60, %rsi
movl $0x20, %edx
subl %r14d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x1040
testl %eax, %eax
jle 0x1cda
addl %eax, %r14d
cmpl $0x20, %r14d
jb 0x1caf
jmp 0x1ce3
cmpl $-0x1, %eax
je 0x213e
leaq 0x23b4(%rip), %rdi      # 0x409e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10e0
leaq 0x10(%rsp), %rsi
movl $0x0, (%rsi)
movq %rbx, %rdi
callq 0x190f
movq %rax, %r15
testq %rax, %rax
je 0x1d4e
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, (%rdx)
movb $0x0, 0x20(%rdx)
movl 0x10(%rsp), %esi
movq %r15, %rdi
callq 0x2b50
jmp 0x1d71
cmpl $0x6f, %esi
je 0x1e1b
cmpl $0x71, %esi
jne 0x1dfc
leaq 0x26ec(%rip), %rdi      # 0x4435
jmp 0x2145
leaq 0x236d(%rip), %rdi      # 0x40c2
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movb $0x0, 0x50(%rsp)
movq 0x18(%rsp), %r14
xorl %ebx, %ebx
movl %ebx, %eax
leaq (%rsp,%rax), %rsi
addq $0x30, %rsi
movl $0x20, %edx
subl %ebx, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x10d0
testl %eax, %eax
jle 0x1d9f
addl %eax, %ebx
cmpl $0x20, %ebx
jl 0x1d78
jmp 0x1da8
cmpl $-0x1, %eax
je 0x213e
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %esi
movl %ecx, %eax
subl %esi, %eax
jne 0x1def
leaq 0x258d(%rip), %rdi      # 0x434a
callq 0x1070
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1140
testl %eax, %eax
jne 0x1e37
leaq 0x263f(%rip), %rdi      # 0x441b
callq 0x1070
movl $0x0, (%r14)
xorl %ebx, %ebx
jmp 0x214f
jbe 0x1e27
leaq 0x22de(%rip), %rdi      # 0x40d6
movl %eax, %esi
jmp 0x1e30
leaq 0x227e(%rip), %rdi      # 0x4081
xorl %eax, %eax
callq 0x10e0
jmp 0x214a
leaq 0x26a1(%rip), %rdi      # 0x44b7
jmp 0x2145
leaq 0x2652(%rip), %rdi      # 0x4474
jmp 0x2145
subl %ecx, %esi
leaq 0x22c8(%rip), %rdi      # 0x40f8
xorl %eax, %eax
callq 0x10e0
testq %r15, %r15
je 0x1e43
movl 0x10(%rsp), %r8d
jmp 0x1e4d
movl 0xc(%rsp), %r8d
movl %r8d, 0x10(%rsp)
movl %r8d, %eax
xorl %edx, %edx
divl 0x160(%rsp)
movl %edx, %ecx
xorl %esi, %esi
testl %edx, %edx
setg %sil
addl %eax, %esi
movl %esi, 0x8(%rsp)
leaq 0x22a9(%rip), %rdi      # 0x4119
movl %r8d, %edx
xorl %eax, %eax
callq 0x10e0
movl 0x8(%rsp), %r14d
leaq (,%r14,8), %rdi
callq 0x1180
testq %rax, %rax
je 0x22e4
movq %rax, %r13
leaq (,%r14,4), %rdi
callq 0x1180
testq %rax, %rax
je 0x22e4
movq %rax, %rbx
movq %r15, 0x20(%rsp)
testq %r14, %r14
je 0x1eeb
xorl %r15d, %r15d
movl $0xffffffff, (%rbx,%r15,4) # imm = 0xFFFFFFFF
movl $0x1, %edi
movl $0x21, %esi
callq 0x1120
movq %rax, (%r13,%r15,8)
testq %rax, %rax
je 0x22e4
incq %r15
cmpq %r15, %r14
jne 0x1ebe
movq %r12, 0x28(%rsp)
movq 0x20(%rsp), %r15
testq %r15, %r15
je 0x1fba
leaq 0x245c(%rip), %rdi      # 0x4361
callq 0x1070
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x1fba
xorl %r14d, %r14d
movl $0x80078071, %r12d      # imm = 0x80078071
movl 0x160(%rsp), %ecx
decl %eax
movl 0x10(%rsp), %esi
movl %ecx, %edi
imull %r14d, %edi
subl %edi, %esi
cmpq %rax, %r14
cmovnel %ecx, %esi
testl %esi, %esi
je 0x1f94
movl %esi, %eax
leaq (%r15,%rdi), %rdx
movl $0x1, %r8d
xorl %r9d, %r9d
xorl %ecx, %ecx
movzwl %r8w, %r8d
movzbl (%rdx,%r9), %r10d
addl %r8d, %r10d
movl %r10d, %r8d
subl $0xfff1, %r8d           # imm = 0xFFF1
cmovbl %r10d, %r8d
addl %r8d, %ecx
movq %rcx, %r10
imulq %r12, %r10
shrq $0x2f, %r10
imull $0xfff1, %r10d, %r10d   # imm = 0xFFF1
subl %r10d, %ecx
incq %r9
cmpq %r9, %rax
jne 0x1f4f
shll $0x10, %ecx
movzwl %r8w, %eax
orl %ecx, %eax
jmp 0x1f99
movl $0x1, %eax
addq %r15, %rdi
movl %eax, (%rbx,%r14,4)
movq (%r13,%r14,8), %rdx
callq 0x2b50
incq %r14
movl 0x8(%rsp), %eax
cmpq %rax, %r14
jb 0x1f1f
leaq 0x23d3(%rip), %rdi      # 0x4394
callq 0x1070
movl 0x8(%rsp), %edi
shlq $0x3, %rdi
callq 0x1180
testq %rax, %rax
je 0x22e4
movq %rax, %r12
xorl %r14d, %r14d
movl %r14d, %eax
leaq (%rsp,%rax), %rsi
addq $0x8, %rsi
movl $0x4, %edx
subl %r14d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x10d0
testl %eax, %eax
jle 0x200b
addl %eax, %r14d
cmpl $0x4, %r14d
jl 0x1fe2
xorl %r14d, %r14d
movl %r14d, %eax
leaq (%rsp,%rax), %rsi
addq $0x160, %rsi            # imm = 0x160
movl $0x4, %edx
subl %r14d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x10d0
testl %eax, %eax
jle 0x203a
addl %eax, %r14d
cmpl $0x4, %r14d
jl 0x200e
movl 0x8(%rsp), %edx
shll $0x2, %edx
xorl %r14d, %r14d
movl %ebp, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x1888
cmpl $0x0, 0x8(%rsp)
je 0x209b
xorl %ebx, %ebx
movq (%r13,%rbx,8), %r14
xorl %r15d, %r15d
movl %r15d, %esi
addq %r14, %rsi
movl $0x20, %edx
subl %r15d, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x10d0
testl %eax, %eax
jle 0x2085
addl %eax, %r15d
cmpl $0x20, %r15d
jl 0x2061
incq %rbx
movl 0x8(%rsp), %r14d
cmpq %r14, %rbx
jb 0x2059
shll $0x3, %r14d
movq 0x20(%rsp), %r15
movl %ebp, %edi
movq %r12, %rsi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x1804
cmpl $-0x1, %eax
je 0x213e
leaq 0x22f4(%rip), %rdi      # 0x43ae
callq 0x1070
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x210d
leaq 0x2084(%rip), %rbx      # 0x4152
xorl %r13d, %r13d
cmpl $-0x1, (%r12,%r13,8)
jne 0x2103
decl %eax
movl 0xc(%rsp), %edx
movl 0x160(%rsp), %ecx
movl %eax, %esi
imull %ecx, %esi
subl %esi, %edx
cmpq %rax, %r13
cmovnel %ecx, %edx
movq %rbx, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x10e0
movl 0x8(%rsp), %eax
incq %r13
movl %eax, %ecx
cmpq %rcx, %r13
jb 0x20d1
movl $0x0, 0x14(%rsp)
xorl %ebx, %ebx
movl %ebx, %eax
leaq (%rsp,%rax), %rsi
addq $0x14, %rsi
movl $0x4, %edx
subl %ebx, %edx
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x1040
testl %eax, %eax
jle 0x2163
addl %eax, %ebx
cmpl $0x4, %ebx
jb 0x2117
jmp 0x216c
leaq 0x2468(%rip), %rdi      # 0x45ad
callq 0x1070
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %eax
je 0x22d6
movl 0x14(%rsp), %esi
leaq 0x1ffa(%rip), %rdi      # 0x4171
xorl %eax, %eax
callq 0x10e0
movl 0x14(%rsp), %r14d
movl 0x160(%rsp), %edi
addl %r14d, %edi
callq 0x1180
movq %rax, %rbx
testq %rax, %rax
je 0x2308
movl %ebp, %edi
movq %rbx, %rsi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0x1804
movq 0x18(%rsp), %r14
cmpl $-0x1, %eax
je 0x22d6
leaq 0x2208(%rip), %rdi      # 0x43ca
callq 0x1070
movl %ebp, %edi
callq 0x1110
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %r9d
movl 0x160(%rsp), %eax
subq $0x10, %rsp
movq 0x38(%rsp), %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %r12, %r8
movq %rdi, %r15
pushq %rbx
pushq %rax
callq 0x1a30
addq $0x20, %rsp
movl %ebp, (%r14)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rbx
movaps %xmm0, (%rbx)
movaps %xmm0, 0x10(%rbx)
movb $0x0, 0x20(%rbx)
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x2b50
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1140
testl %eax, %eax
je 0x22f5
leaq 0x21b2(%rip), %rdi      # 0x43ee
callq 0x1070
leaq 0x1f42(%rip), %rdi      # 0x418a
leaq 0x30(%rsp), %rsi
leaq 0x60(%rsp), %rdx
xorl %eax, %eax
callq 0x10e0
movl (%r14), %esi
movl 0xc(%rsp), %edx
leaq 0x1f51(%rip), %rdi      # 0x41b8
xorl %eax, %eax
callq 0x10e0
leaq 0x2187(%rip), %rdi      # 0x43fc
callq 0x1070
leaq 0x1f5d(%rip), %rbx      # 0x41de
xorl %r14d, %r14d
movsbl (%r15,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10e0
incq %r14
cmpq $0x8, %r14
jne 0x2284
leaq 0x2168(%rip), %rdi      # 0x440b
callq 0x1070
movl $0xfffffff8, %ebp       # imm = 0xFFFFFFF8
leaq 0x1f2a(%rip), %rbx      # 0x41de
movq 0x18(%rsp), %r14
movl (%r14), %eax
addl %ebp, %eax
movsbl (%r15,%rax), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10e0
incl %ebp
jne 0x22b9
jmp 0x214a
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x22cb(%rip), %rdi      # 0x45ad
jmp 0x22fe
leaq 0x1e59(%rip), %rdi      # 0x4144
callq 0x11d0
jmp 0x214a
xorl %ebx, %ebx
leaq 0x20de(%rip), %rdi      # 0x43dc
callq 0x1070
jmp 0x214f
leaq 0x1e35(%rip), %rdi      # 0x4144
callq 0x11d0
movl 0x14(%rsp), %edx
movl %ebp, %edi
xorl %esi, %esi
jmp 0x21a6