// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/posix/tunnel.c
// Function: client_to_gw_tun
void *client_to_gw_tun(void *arg)
{
	struct curr_gw_data *curr_gw_data = (struct curr_gw_data *)arg;
	struct sockaddr_in gw_addr, my_addr, sender_addr;
	struct timeval tv;
	struct list_head_first packet_list;
	int32_t res, max_sock, buff_len, udp_sock, tun_fd, tun_ifi, sock_opts, i, num_refresh_lease = 0, last_refresh_attempt = 0;
	uint32_t addr_len, current_time, ip_lease_time = 0, gw_state_time = 0, my_tun_addr = 0, ignore_packet;
	char tun_if[IFNAMSIZ], my_str[ADDR_STR_LEN], gw_str[ADDR_STR_LEN], gw_state = GW_STATE_UNKNOWN;
	unsigned char buff[1501];
	fd_set wait_sockets, tmp_wait_sockets;


	addr_len = sizeof(struct sockaddr_in);

	INIT_LIST_HEAD_FIRST(packet_list);

	memset(&gw_addr, 0, sizeof(struct sockaddr_in));
	memset(&my_addr, 0, sizeof(struct sockaddr_in));

	gw_addr.sin_family = AF_INET;
	gw_addr.sin_port = curr_gw_data->gw_node->gw_port;
	gw_addr.sin_addr.s_addr = curr_gw_data->orig;

	my_addr.sin_family = AF_INET;
	my_addr.sin_port = curr_gw_data->gw_node->gw_port;
	my_addr.sin_addr.s_addr = curr_gw_data->batman_if->addr.sin_addr.s_addr;


	/* connect to server (establish udp tunnel) */
	if ((udp_sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
		debug_output(0, "Error - can't create udp socket: %s\n", strerror(errno));
		goto out;
	}

	sock_opts = 1;
        if (setsockopt(udp_sock, SOL_SOCKET, SO_REUSEADDR, &sock_opts, sizeof(sock_opts)) < 0) {
               debug_output(0, "Error - can't set options on udp socket: %s\n", strerror(errno));
		goto udp_out;
        }

	if (bind(udp_sock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_in)) < 0) {
		debug_output(0, "Error - can't bind tunnel socket: %s\n", strerror(errno));
		goto udp_out;
	}


	/* make udp socket non blocking */
	sock_opts = fcntl(udp_sock, F_GETFL, 0);
	fcntl(udp_sock, F_SETFL, sock_opts | O_NONBLOCK);


	if (get_tun_ip(&gw_addr, udp_sock, &my_tun_addr) < 0) {
		curr_gw_data->gw_node->last_failure = get_time_msec();
		curr_gw_data->gw_node->gw_failure++;

		goto udp_out;
	}

	ip_lease_time = get_time_msec();

	addr_to_string(my_tun_addr, my_str, sizeof(my_str));
	addr_to_string(curr_gw_data->orig, gw_str, sizeof(gw_str));
	debug_output(3, "Gateway client - got IP (%s) from gateway: %s \n", my_str, gw_str);


	if (add_dev_tun(curr_gw_data->batman_if, my_tun_addr, tun_if, sizeof(tun_if), &tun_fd, &tun_ifi) <= 0)
		goto udp_out;

	add_nat_rule(tun_if);
	add_del_route(0, 0, 0, my_tun_addr, tun_ifi, tun_if, BATMAN_RT_TABLE_TUNNEL, ROUTE_TYPE_UNICAST, ROUTE_ADD);

	FD_ZERO(&wait_sockets);
	FD_SET(udp_sock, &wait_sockets);
	FD_SET(tun_fd, &wait_sockets);

	max_sock = (udp_sock > tun_fd ? udp_sock : tun_fd);

	while ((!is_aborted()) && (curr_gateway != NULL) && (!curr_gw_data->gw_node->deleted)) {

		tv.tv_sec = 0;
		tv.tv_usec = 250;

		memcpy(&tmp_wait_sockets, &wait_sockets, sizeof(fd_set));

		res = select(max_sock + 1, &tmp_wait_sockets, NULL, NULL, &tv);

		current_time = get_time_msec();

		if ((res < 0) && (errno != EINTR)) {
			debug_output(0, "Error - can't select (client_to_gw_tun): %s \n", strerror(errno));
			break;
		}

		if (res <= 0)
			goto after_incoming_packet;

		/* traffic that comes from the gateway via the tunnel */
		if (FD_ISSET(udp_sock, &tmp_wait_sockets)) {

			while ((buff_len = recvfrom(udp_sock, buff, sizeof(buff) - 1, 0, (struct sockaddr *)&sender_addr, &addr_len)) > 0) {

				if (buff_len < 2) {
					debug_output(0, "Error - ignoring gateway packet from %s: packet too small (%i)\n", my_str, buff_len);
					continue;
				}

				/* a gateway with multiple interfaces breaks here */
				/*if (sender_addr.sin_addr.s_addr != gw_addr.sin_addr.s_addr) {
					debug_output(0, "Error - can't receive ip request: sender IP is not gateway IP \n");
					continue;
				}*/

				switch(buff[0]) {
				/* got data from gateway */
				case TUNNEL_DATA:
					if (write(tun_fd, buff + 1, buff_len - 1) < 0)
						debug_output(0, "Error - can't write packet: %s\n", strerror(errno));

					if (get_tunneled_protocol(buff) != IPPROTO_ICMP) {
						gw_state = GW_STATE_VERIFIED;
						gw_state_time = current_time;
					}
					break;
				/* gateway told us that we have no valid ip */
				case TUNNEL_IP_INVALID:
					addr_to_string(my_tun_addr, my_str, sizeof(my_str));
					debug_output(3, "Gateway client - gateway (%s) says: IP (%s) is invalid (maybe expired) \n", gw_str, my_str);

					curr_gateway = NULL;
					goto cleanup;
				/* keep alive packet was confirmed */
				case TUNNEL_KEEPALIVE_REPLY:
					debug_output(3, "Gateway client - successfully refreshed IP lease: %s \n", gw_str);
					ip_lease_time = current_time;
					num_refresh_lease = 0;
					break;
				}

			}

			if (errno != EWOULDBLOCK) {
				debug_output(0, "Error - gateway client can't receive packet: %s\n", strerror(errno));
				break;
			}

		/* traffic that we should send to the gateway via the tunnel */
		} else if (FD_ISSET(tun_fd, &tmp_wait_sockets)) {

			while ((buff_len = read(tun_fd, buff + 1, sizeof(buff) - 2)) > 0) {

				buff[0] = TUNNEL_DATA;

				if (sendto(udp_sock, buff, buff_len + 1, 0, (struct sockaddr *)&gw_addr, sizeof(struct sockaddr_in)) < 0)
					debug_output(0, "Error - can't send data to gateway: %s\n", strerror(errno));

				if ((gw_state == GW_STATE_UNKNOWN) && (gw_state_time == 0)) {

					ignore_packet = 0;

					if (get_tunneled_protocol(buff) == IPPROTO_ICMP)
						ignore_packet = 1;

					if (get_tunneled_protocol(buff) == IPPROTO_UDP) {

						for (i = 0; i < (int)(sizeof(bh_udp_ports)/sizeof(short)); i++) {

							if (get_tunneled_udpdest(buff) == bh_udp_ports[i]) {

								ignore_packet = 1;
								break;

							}

						}

					}

					/* if the packet was not natted (half tunnel) don't active the blackhole detection */
					if (get_tunneled_sender_ip(buff) != my_tun_addr)
						ignore_packet = 1;

					if (!ignore_packet)
						gw_state_time = current_time;

				}
			}

			if (errno != EWOULDBLOCK) {
				debug_output(0, "Error - gateway client can't read tun data: %s\n", strerror(errno));
				break;
			}

		}

after_incoming_packet:

		/* refresh leased IP */
		if (((int)(current_time - (ip_lease_time + IP_LEASE_TIMEOUT)) > 0) &&
			((int)(current_time - (last_refresh_attempt + 1000)) > 0)) {

			if (num_refresh_lease < 12) {

				buff[0] = TUNNEL_KEEPALIVE_REQUEST;

				if (sendto(udp_sock, buff, 100, 0, (struct sockaddr *)&gw_addr, sizeof(struct sockaddr_in)) < 0)
					debug_output(0, "Error - can't send keep alive request to gateway: %s \n", strerror(errno));

				num_refresh_lease++;
				last_refresh_attempt = current_time;

			} else {

				addr_to_string(my_tun_addr, my_str, sizeof(my_str));
				debug_output(3, "Gateway client - disconnecting from unresponsive gateway (%s): could not refresh IP lease \n", gw_str);

				curr_gw_data->gw_node->last_failure = current_time;
				curr_gw_data->gw_node->gw_failure++;
				break;

			}

		}

		/* drop connection to gateway if the gateway does not respond */
		if ((gw_state == GW_STATE_UNKNOWN) && (gw_state_time != 0) &&
				   ((int)(current_time - (gw_state_time + GW_STATE_UNKNOWN_TIMEOUT)) > 0)) {

			debug_output(3, "Gateway client - disconnecting from unresponsive gateway (%s): gateway seems to be a blackhole \n", gw_str);

			curr_gw_data->gw_node->last_failure = current_time;
			curr_gw_data->gw_node->gw_failure++;

			break;
		}

		/* change back to unknown state if gateway did not respond in time */
		if ((gw_state == GW_STATE_VERIFIED) &&
				   ((int)(current_time - (gw_state_time + GW_STATE_VERIFIED_TIMEOUT)) > 0)) {
			gw_state = GW_STATE_UNKNOWN;
			gw_state_time = 0;
		}

	}

cleanup:
	add_del_route(0, 0, 0, my_tun_addr, tun_ifi, tun_if, BATMAN_RT_TABLE_TUNNEL, ROUTE_TYPE_UNICAST, ROUTE_DEL);
	del_nat_rule(tun_if);
	del_dev_tun(tun_fd);

udp_out:
	close(udp_sock);

out:
	curr_gateway = NULL;
	tunnel_running = 0;
	debugFree(arg, 1212);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x820, %rsp            # imm = 0x820
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x0, -0x88(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movb $0x1, -0xd1(%rbp)
movl $0x10, -0x8c(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21e0
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x21e0
movw $0x2, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movw 0x10(%rax), %ax
movw %ax, -0x1e(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movw $0x2, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movw 0x10(%rax), %ax
movw %ax, -0x2e(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x34(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2500
movl %eax, -0x70(%rbp)
cmpl $0x0, %eax
jge 0x106d7
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6f05(%rip), %rsi      # 0x175d0
movb $0x0, %al
callq 0x123f0
jmp 0x11056
movl $0x1, -0x7c(%rbp)
movl -0x70(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x7c(%rbp), %rcx
movl $0x4, %r8d
callq 0x20d0
cmpl $0x0, %eax
jge 0x10723
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6ede(%rip), %rsi      # 0x175f5
movb $0x0, %al
callq 0x123f0
jmp 0x1104e
movl -0x70(%rbp), %edi
leaq -0x30(%rbp), %rax
movq %rax, -0x7b8(%rbp)
movq -0x7b8(%rbp), %rsi
movl $0x10, %edx
callq 0x23a0
cmpl $0x0, %eax
jge 0x1076b
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6930(%rip), %rsi      # 0x1708f
movb $0x0, %al
callq 0x123f0
jmp 0x1104e
movl -0x70(%rbp), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x20e0
movl %eax, -0x7c(%rbp)
movl -0x70(%rbp), %edi
movl -0x7c(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x20e0
movl -0x70(%rbp), %esi
leaq -0x20(%rbp), %rdi
leaq -0x9c(%rbp), %rdx
callq 0x11090
movsbl %al, %eax
cmpl $0x0, %eax
jge 0x107dd
callq 0xf260
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movw 0x12(%rax), %cx
addw $0x1, %cx
movw %cx, 0x12(%rax)
jmp 0x1104e
callq 0xf260
movl %eax, -0x94(%rbp)
movl -0x9c(%rbp), %edi
leaq -0xc0(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movq -0x10(%rbp), %rax
movl (%rax), %edi
leaq -0xd0(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
leaq -0xc0(%rbp), %rdx
leaq -0xd0(%rbp), %rcx
movl $0x3, %edi
leaq 0x6df2(%rip), %rsi      # 0x17622
movb $0x0, %al
callq 0x123f0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x9c(%rbp), %esi
leaq -0xb0(%rbp), %rdx
movl $0x10, %ecx
leaq -0x74(%rbp), %r8
leaq -0x78(%rbp), %r9
callq 0xc220
movsbl %al, %eax
cmpl $0x0, %eax
jg 0x1086b
jmp 0x1104e
leaq -0xb0(%rbp), %rdi
callq 0xbf50
movl -0x9c(%rbp), %ecx
movl -0x78(%rbp), %r8d
leaq -0xb0(%rbp), %r9
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
movl $0x44, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0xa420
leaq -0x730(%rbp), %rax
movq %rax, -0x7c8(%rbp)
movl $0x0, -0x7bc(%rbp)
movl -0x7bc(%rbp), %eax
cmpq $0x10, %rax
jae 0x108f4
movq -0x7c8(%rbp), %rax
movl -0x7bc(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x7bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7bc(%rbp)
jmp 0x108c2
jmp 0x108f6
movl -0x70(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x70(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x730(%rbp,%rax,8), %rcx
movq %rcx, -0x730(%rbp,%rax,8)
movl -0x74(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x74(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x730(%rbp,%rax,8), %rcx
movq %rcx, -0x730(%rbp,%rax,8)
movl -0x70(%rbp), %eax
cmpl -0x74(%rbp), %eax
jle 0x10977
movl -0x70(%rbp), %eax
movl %eax, -0x7e4(%rbp)
jmp 0x10980
movl -0x74(%rbp), %eax
movl %eax, -0x7e4(%rbp)
movl -0x7e4(%rbp), %eax
movl %eax, -0x68(%rbp)
callq 0xfaf0
movb %al, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x7e5(%rbp)
jne 0x109c9
xorl %eax, %eax
leaq 0xa9ba(%rip), %rcx      # 0x1b360
cmpq $0x0, (%rcx)
movb %al, -0x7e5(%rbp)
je 0x109c9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x18(%rax)
setne %al
xorb $-0x1, %al
movb %al, -0x7e5(%rbp)
movb -0x7e5(%rbp), %al
testb $0x1, %al
jne 0x109d8
jmp 0x11005
movq $0x0, -0x50(%rbp)
movq $0xfa, -0x48(%rbp)
leaq -0x7b0(%rbp), %rdi
leaq -0x730(%rbp), %rsi
movl $0x80, %edx
callq 0x22c0
movl -0x68(%rbp), %edi
addl $0x1, %edi
leaq -0x7b0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x50(%rbp), %r8
movq %rcx, %rdx
callq 0x22f0
movl %eax, -0x64(%rbp)
callq 0xf260
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0x10a5f
callq 0x2070
cmpl $0x4, (%rax)
je 0x10a5f
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6bff(%rip), %rsi      # 0x17652
movb $0x0, %al
callq 0x123f0
jmp 0x11005
cmpl $0x0, -0x64(%rbp)
jg 0x10a6a
jmp 0x10e44
movl -0x70(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x7b0(%rbp,%rax,8), %rax
movq %rax, -0x7f0(%rbp)
movl -0x70(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x7f0(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x10c67
jmp 0x10ab4
movl -0x70(%rbp), %edi
leaq -0x6b0(%rbp), %rsi
leaq -0x40(%rbp), %rax
movq %rax, -0x7d0(%rbp)
movq -0x7d0(%rbp), %r8
movl $0x5dc, %edx            # imm = 0x5DC
xorl %ecx, %ecx
leaq -0x8c(%rbp), %r9
callq 0x2350
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
jle 0x10c34
cmpl $0x2, -0x6c(%rbp)
jge 0x10b11
leaq -0xc0(%rbp), %rdx
movl -0x6c(%rbp), %ecx
xorl %edi, %edi
leaq 0x6b78(%rip), %rsi      # 0x17680
movb $0x0, %al
callq 0x123f0
jmp 0x10ab4
movzbl -0x6b0(%rbp), %eax
movl %eax, -0x7f4(%rbp)
subl $0x1, %eax
je 0x10b4a
jmp 0x10b25
movl -0x7f4(%rbp), %eax
subl $0x3, %eax
je 0x10bb4
jmp 0x10b36
movl -0x7f4(%rbp), %eax
subl $0x5, %eax
je 0x10bff
jmp 0x10c2f
movl -0x74(%rbp), %edi
leaq -0x6b0(%rbp), %rsi
addq $0x1, %rsi
movl -0x6c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
callq 0x20f0
cmpq $0x0, %rax
jge 0x10b8b
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6b3c(%rip), %rsi      # 0x176c0
movb $0x0, %al
callq 0x123f0
leaq -0x6b0(%rbp), %rdi
callq 0x11390
movzbl %al, %eax
cmpl $0x1, %eax
je 0x10bb2
movb $0x2, -0xd1(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x10c2f
movl -0x9c(%rbp), %edi
leaq -0xc0(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
leaq -0xd0(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
movl $0x3, %edi
leaq 0x6afb(%rip), %rsi      # 0x176e0
movb $0x0, %al
callq 0x123f0
leaq 0xa76d(%rip), %rax      # 0x1b360
movq $0x0, (%rax)
jmp 0x11007
leaq -0xd0(%rbp), %rdx
movl $0x3, %edi
leaq 0x6b17(%rip), %rsi      # 0x17729
movb $0x0, %al
callq 0x123f0
movl -0x90(%rbp), %eax
movl %eax, -0x94(%rbp)
movl $0x0, -0x84(%rbp)
jmp 0x10ab4
callq 0x2070
cmpl $0xb, (%rax)
je 0x10c62
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6b0a(%rip), %rsi      # 0x17760
movb $0x0, %al
callq 0x123f0
jmp 0x11005
jmp 0x10e42
movl -0x74(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x7b0(%rbp,%rax,8), %rax
movq %rax, -0x800(%rbp)
movl -0x74(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x800(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x10e40
jmp 0x10cb1
movl -0x74(%rbp), %edi
leaq -0x6b0(%rbp), %rsi
addq $0x1, %rsi
movl $0x5db, %edx            # imm = 0x5DB
callq 0x2250
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
jle 0x10e10
movb $0x1, -0x6b0(%rbp)
movl -0x70(%rbp), %edi
leaq -0x6b0(%rbp), %rsi
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x20(%rbp), %rax
movq %rax, -0x7d8(%rbp)
movq -0x7d8(%rbp), %r8
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2200
cmpq $0x0, %rax
jge 0x10d33
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6a65(%rip), %rsi      # 0x17791
movb $0x0, %al
callq 0x123f0
movsbl -0xd1(%rbp), %eax
cmpl $0x1, %eax
jne 0x10e0b
cmpl $0x0, -0x98(%rbp)
jne 0x10e0b
movl $0x0, -0xa0(%rbp)
leaq -0x6b0(%rbp), %rdi
callq 0x11390
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x10d78
movl $0x1, -0xa0(%rbp)
leaq -0x6b0(%rbp), %rdi
callq 0x11390
movzbl %al, %eax
cmpl $0x11, %eax
jne 0x10dd6
movl $0x0, -0x80(%rbp)
cmpl $0x6, -0x80(%rbp)
jge 0x10dd4
leaq -0x6b0(%rbp), %rdi
callq 0x113b0
movzwl %ax, %eax
movslq -0x80(%rbp), %rdx
leaq 0xa585(%rip), %rcx      # 0x1b338
movzwl (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
jne 0x10dc7
movl $0x1, -0xa0(%rbp)
jmp 0x10dd4
jmp 0x10dc9
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x10d93
jmp 0x10dd6
leaq -0x6b0(%rbp), %rdi
callq 0x113e0
cmpl -0x9c(%rbp), %eax
je 0x10df4
movl $0x1, -0xa0(%rbp)
cmpl $0x0, -0xa0(%rbp)
jne 0x10e09
movl -0x90(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x10e0b
jmp 0x10cb1
callq 0x2070
cmpl $0xb, (%rax)
je 0x10e3e
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x6987(%rip), %rsi      # 0x177b9
movb $0x0, %al
callq 0x123f0
jmp 0x11005
jmp 0x10e40
jmp 0x10e42
jmp 0x10e44
movl -0x90(%rbp), %eax
movl -0x94(%rbp), %ecx
addl $0x124f80, %ecx         # imm = 0x124F80
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x10f5b
movl -0x90(%rbp), %eax
movl -0x88(%rbp), %ecx
addl $0x3e8, %ecx            # imm = 0x3E8
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x10f5b
cmpl $0xc, -0x84(%rbp)
jge 0x10efe
movb $0x4, -0x6b0(%rbp)
movl -0x70(%rbp), %edi
leaq -0x6b0(%rbp), %rsi
leaq -0x20(%rbp), %rax
movq %rax, -0x7e0(%rbp)
movq -0x7e0(%rbp), %r8
movl $0x64, %edx
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2200
cmpq $0x0, %rax
jge 0x10ee1
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x690f(%rip), %rsi      # 0x177e9
movb $0x0, %al
callq 0x123f0
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x90(%rbp), %eax
movl %eax, -0x88(%rbp)
jmp 0x10f59
movl -0x9c(%rbp), %edi
leaq -0xc0(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
leaq -0xd0(%rbp), %rdx
movl $0x3, %edi
leaq 0x68f8(%rip), %rsi      # 0x17820
movb $0x0, %al
callq 0x123f0
movl -0x90(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movw 0x12(%rax), %cx
addw $0x1, %cx
movw %cx, 0x12(%rax)
jmp 0x11005
jmp 0x10f5b
movsbl -0xd1(%rbp), %eax
cmpl $0x1, %eax
jne 0x10fca
cmpl $0x0, -0x98(%rbp)
je 0x10fca
movl -0x90(%rbp), %eax
movl -0x98(%rbp), %ecx
addl $0xea60, %ecx           # imm = 0xEA60
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x10fca
leaq -0xd0(%rbp), %rdx
movl $0x3, %edi
leaq 0x68e0(%rip), %rsi      # 0x1787c
movb $0x0, %al
callq 0x123f0
movl -0x90(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movw 0x12(%rax), %cx
addw $0x1, %cx
movw %cx, 0x12(%rax)
jmp 0x11005
movsbl -0xd1(%rbp), %eax
cmpl $0x2, %eax
jne 0x11000
movl -0x90(%rbp), %eax
movl -0x98(%rbp), %ecx
addl $0x493e0, %ecx          # imm = 0x493E0
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x11000
movb $0x1, -0xd1(%rbp)
movl $0x0, -0x98(%rbp)
jmp 0x10989
jmp 0x11007
movl -0x9c(%rbp), %ecx
movl -0x78(%rbp), %r8d
leaq -0xb0(%rbp), %r9
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
movl $0x44, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0xa420
leaq -0xb0(%rbp), %rdi
callq 0xc040
movl -0x74(%rbp), %edi
callq 0xc1c0
movl -0x70(%rbp), %edi
callq 0x2210
leaq 0xa303(%rip), %rax      # 0x1b360
movq $0x0, (%rax)
leaq 0xa6bd(%rip), %rax      # 0x1b728
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
movl $0x4bc, %esi            # imm = 0x4BC
callq 0x7720
xorl %eax, %eax
addq $0x820, %rsp            # imm = 0x820
popq %rbp
retq
nopw (%rax,%rax)