// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/batman.c
// Function: batman
int8_t batman(void)
{
	struct list_head *list_pos, *forw_pos_tmp;
	struct orig_node *orig_neigh_node, *orig_node;
	struct batman_if *batman_if, *if_incoming;
	struct forw_node *forw_node;
	struct bat_packet *bat_packet;
	uint32_t neigh, debug_timeout, vis_timeout, select_timeout, curr_time;
	unsigned char in[2001], *hna_recv_buff;
	char orig_str[ADDR_STR_LEN], neigh_str[ADDR_STR_LEN], ifaddr_str[ADDR_STR_LEN], prev_sender_str[ADDR_STR_LEN];
	int16_t hna_buff_len, packet_len, curr_packet_len;
	uint8_t forward_old, if_rp_filter_all_old, if_rp_filter_default_old, if_send_redirects_all_old, if_send_redirects_default_old;
	uint8_t is_my_addr, is_my_orig, is_my_oldorig, is_broadcast, is_duplicate, is_bidirectional, has_directlink_flag;
	int8_t res;


	debug_timeout = vis_timeout = get_time_msec();

	if ( NULL == ( orig_hash = hash_new( 128, compare_orig, choose_orig ) ) )
		return(-1);

	/* for profiling the functions */
	prof_init(PROF_choose_gw, "choose_gw");
	prof_init(PROF_update_routes, "update_routes");
	prof_init(PROF_update_gw_list, "update_gw_list");
	prof_init(PROF_is_duplicate, "isDuplicate");
	prof_init(PROF_get_orig_node, "get_orig_node");
	prof_init(PROF_update_originator, "update_orig");
	prof_init(PROF_purge_originator, "purge_orig");
	prof_init(PROF_schedule_forward_packet, "schedule_forward_packet");
	prof_init(PROF_send_outstanding_packets, "send_outstanding_packets");

	list_for_each(list_pos, &if_list) {
		batman_if = list_entry(list_pos, struct batman_if, list);

		batman_if->out.version = COMPAT_VERSION;
		batman_if->out.flags = 0x00;
		batman_if->out.ttl = (batman_if->if_num > 0 ? 2 : TTL);
		batman_if->out.gwflags = (batman_if->if_num > 0 ? 0 : gateway_class);
		batman_if->out.seqno = 1;
		batman_if->out.gwport = htons(GW_PORT);
		batman_if->out.tq = TQ_MAX_VALUE;

		schedule_own_packet(batman_if);
	}

	if_rp_filter_all_old = get_rp_filter("all");
	if_rp_filter_default_old = get_rp_filter("default");

	if_send_redirects_all_old = get_send_redirects("all");
	if_send_redirects_default_old = get_send_redirects("default");

	set_rp_filter(0, "all");
	set_rp_filter(0, "default");

	set_send_redirects(0, "all");
	set_send_redirects(0, "default");

	forward_old = get_forwarding();
	set_forwarding(1);

	while (!is_aborted()) {

		debug_output( 4, " \n" );

		/* harden select_timeout against sudden time change (e.g. ntpdate) */
		curr_time = get_time_msec();
		select_timeout = ((int)(((struct forw_node *)forw_list.next)->send_time - curr_time) > 0 ?
					((struct forw_node *)forw_list.next)->send_time - curr_time : 10);

		res = receive_packet(in, sizeof(in), &packet_len, &neigh, select_timeout, &if_incoming);

		/* on receive error the interface is deactivated in receive_packet() */
		if (res < 1)
			goto send_packets;

		curr_time = get_time_msec();
		curr_packet_len = 0;
		bat_packet = (struct bat_packet *)in;

		addr_to_string(neigh, neigh_str, sizeof(neigh_str));
		addr_to_string(if_incoming->addr.sin_addr.s_addr, ifaddr_str, sizeof(ifaddr_str));

		while ((curr_packet_len + (int)sizeof(struct bat_packet) <= packet_len) &&
			(curr_packet_len + (int)sizeof(struct bat_packet) + bat_packet->hna_len * 5 <= packet_len) &&
			(curr_packet_len + (int)sizeof(struct bat_packet) + bat_packet->hna_len * 5 <= MAX_AGGREGATION_BYTES)) {

			bat_packet = (struct bat_packet *)(in + curr_packet_len);
			curr_packet_len += sizeof(struct bat_packet) + bat_packet->hna_len * 5;

			/* network to host order for our 16bit seqno */
			bat_packet->seqno = ntohs(bat_packet->seqno);

			addr_to_string(bat_packet->orig, orig_str, sizeof(orig_str));
			addr_to_string(bat_packet->prev_sender, prev_sender_str, sizeof(prev_sender_str));

			is_my_addr = is_my_orig = is_my_oldorig = is_broadcast = 0;

			has_directlink_flag = (bat_packet->flags & DIRECTLINK ? 1 : 0);

			debug_output(4, "Received BATMAN packet via NB: %s, IF: %s %s (from OG: %s, via old OG: %s, seqno %d, tq %d, TTL %d, V %d, IDF %d) \n", neigh_str, if_incoming->dev, ifaddr_str, orig_str, prev_sender_str, bat_packet->seqno, bat_packet->tq, bat_packet->ttl, bat_packet->version, has_directlink_flag);

			hna_buff_len = bat_packet->hna_len * 5;
			hna_recv_buff = (hna_buff_len > 4 ? (unsigned char *)(bat_packet + 1) : NULL);

			list_for_each(list_pos, &if_list) {

				batman_if = list_entry(list_pos, struct batman_if, list);

				if (neigh == batman_if->addr.sin_addr.s_addr)
					is_my_addr = 1;

				if (bat_packet->orig == batman_if->addr.sin_addr.s_addr)
					is_my_orig = 1;

				if (neigh == batman_if->broad.sin_addr.s_addr)
					is_broadcast = 1;

				if (bat_packet->prev_sender == batman_if->addr.sin_addr.s_addr)
					is_my_oldorig = 1;

			}


			if (bat_packet->gwflags != 0)
				debug_output(4, "Is an internet gateway (class %i) \n", bat_packet->gwflags);

			if (bat_packet->version != COMPAT_VERSION) {
				debug_output(4, "Drop packet: incompatible batman version (%i) \n", bat_packet->version);
				goto send_packets;
			}

			if (is_my_addr) {
				debug_output(4, "Drop packet: received my own broadcast (sender: %s) \n", neigh_str);
				goto send_packets;
			}

			if (is_broadcast) {
				debug_output(4, "Drop packet: ignoring all packets with broadcast source IP (sender: %s) \n", neigh_str);
				goto send_packets;
			}

			if (is_my_orig) {
				orig_neigh_node = get_orig_node(neigh);

				if ((has_directlink_flag) && (if_incoming->addr.sin_addr.s_addr == bat_packet->orig) && (bat_packet->seqno - if_incoming->out.seqno + 2 == 0)) {

					debug_output(4, "count own bcast (is_my_orig): old = %i, ", orig_neigh_node->bcast_own_sum[if_incoming->if_num]);

					bit_mark((TYPE_OF_WORD *)&(orig_neigh_node->bcast_own[if_incoming->if_num * num_words]), 0);
					orig_neigh_node->bcast_own_sum[if_incoming->if_num] = bit_packet_count((TYPE_OF_WORD *)&(orig_neigh_node->bcast_own[if_incoming->if_num * num_words]));

					debug_output(4, "new = %i \n", orig_neigh_node->bcast_own_sum[if_incoming->if_num]);

				}

				debug_output(4, "Drop packet: originator packet from myself (via neighbour) \n");
				goto send_packets;
			}

			if (bat_packet->tq == 0) {
				count_real_packets(bat_packet, neigh, if_incoming);

				debug_output(4, "Drop packet: originator packet with tq is 0 \n");
				goto send_packets;
			}

			if (is_my_oldorig) {
				debug_output(4, "Drop packet: ignoring all rebroadcast echos (sender: %s) \n", neigh_str);
				goto send_packets;
			}

			is_duplicate = count_real_packets(bat_packet, neigh, if_incoming);

			orig_node = get_orig_node(bat_packet->orig);

			/* if sender is a direct neighbor the sender ip equals originator ip */
			orig_neigh_node = (bat_packet->orig == neigh ? orig_node : get_orig_node(neigh));

			/* drop packet if sender is not a direct neighbor and if we no route towards it */
			if ((bat_packet->orig != neigh) && (orig_neigh_node->router == NULL)) {
				debug_output(4, "Drop packet: OGM via unknown neighbor! \n");
				goto send_packets;
			}

			is_bidirectional = isBidirectionalNeigh(orig_node, orig_neigh_node, bat_packet, curr_time, if_incoming);

			/* update ranking if it is not a duplicate or has the same seqno and similar ttl as the non-duplicate */
			if ((is_bidirectional) && ((!is_duplicate) ||
			     ((orig_node->last_real_seqno == bat_packet->seqno) &&
			     (orig_node->last_ttl - 3 <= bat_packet->ttl))))
				update_orig(orig_node, bat_packet, neigh, if_incoming, hna_recv_buff, hna_buff_len, is_duplicate, curr_time);

			/* is single hop (direct) neighbour */
			if (bat_packet->orig == neigh) {

				/* mark direct link on incoming interface */
				schedule_forward_packet(orig_node, bat_packet, neigh, 1, hna_buff_len, if_incoming, curr_time);

				debug_output(4, "Forward packet: rebroadcast neighbour packet with direct link flag \n");
				goto send_packets;
			}

			/* multihop originator */
			if (!is_bidirectional) {
				debug_output(4, "Drop packet: not received via bidirectional link\n");
				goto send_packets;
			}

			if (is_duplicate) {
				debug_output(4, "Drop packet: duplicate packet received\n");
				goto send_packets;
			}

			debug_output(4, "Forward packet: rebroadcast originator packet \n");

			schedule_forward_packet(orig_node, bat_packet, neigh, 0, hna_buff_len, if_incoming, curr_time);

		}


send_packets:
		send_outstanding_packets(curr_time);

		if ((int)(curr_time - (debug_timeout + 1000)) > 0) {

			debug_timeout = curr_time;

			purge_orig( curr_time );

			debug_orig();

			check_inactive_interfaces();

			if ( debug_clients.clients_num[4] > 0 ) {

				checkIntegrity();
				prof_print();

			}

			if ( ( routing_class != 0 ) && ( curr_gateway == NULL ) )
				choose_gw();

			if ((vis_if.sock) && ((int)(curr_time - (vis_timeout + 10000)) > 0)) {

				vis_timeout = curr_time;
				send_vis_packet();

			}

			hna_local_task_exec();
		}

	}

	if (debug_level > 0)
		printf("Deleting all BATMAN routes\n");

	purge_orig(get_time_msec() + (5 * purge_timeout) + originator_interval);

	hash_destroy(orig_hash);

	list_for_each_safe(list_pos, forw_pos_tmp, &forw_list) {

		forw_node = list_entry(list_pos, struct forw_node, list);

		list_del((struct list_head *)&forw_list, list_pos, &forw_list);

		debugFree(forw_node->pack_buff, 1105);
		debugFree(forw_node, 1106);
	}

	if (vis_packet != NULL)
		debugFree(vis_packet, 1108);

	set_forwarding( forward_old );

	set_rp_filter( if_rp_filter_all_old, "all" );
	set_rp_filter( if_rp_filter_default_old, "default" );

	set_send_redirects( if_send_redirects_all_old, "all" );
	set_send_redirects( if_send_redirects_default_old, "default" );

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x8e8, %rsp            # imm = 0x8E8
callq 0xf260
movl %eax, -0x6c(%rbp)
movl %eax, -0x68(%rbp)
movl $0x80, %edi
leaq 0x13d9(%rip), %rsi      # 0x4b80
leaq 0x1402(%rip), %rdx      # 0x4bb0
callq 0x81d0
movq %rax, %rcx
movq %rcx, 0x17c13(%rip)     # 0x1b3d0
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x37cd
movb $-0x1, -0x19(%rbp)
jmp 0x430b
xorl %edi, %edi
leaq 0x113b2(%rip), %rsi     # 0x14b88
callq 0x8700
movl $0x1, %edi
leaq 0x113ab(%rip), %rsi     # 0x14b92
callq 0x8700
movl $0x2, %edi
leaq 0x113a8(%rip), %rsi     # 0x14ba0
callq 0x8700
movl $0x3, %edi
leaq 0x113a6(%rip), %rsi     # 0x14baf
callq 0x8700
movl $0x4, %edi
leaq 0x113a1(%rip), %rsi     # 0x14bbb
callq 0x8700
movl $0x5, %edi
leaq 0x1139e(%rip), %rsi     # 0x14bc9
callq 0x8700
movl $0x6, %edi
leaq 0x11399(%rip), %rsi     # 0x14bd5
callq 0x8700
movl $0x7, %edi
leaq 0x11393(%rip), %rsi     # 0x14be0
callq 0x8700
movl $0x8, %edi
leaq 0x1139a(%rip), %rsi     # 0x14bf8
callq 0x8700
movq 0x17b46(%rip), %rax     # 0x1b3b0
movq %rax, -0x28(%rbp)
leaq 0x17b3b(%rip), %rax     # 0x1b3b0
cmpq %rax, -0x28(%rbp)
je 0x392b
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movb $0x5, 0x56(%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x57(%rax)
movq -0x48(%rbp), %rax
movzbl 0x1c(%rax), %edx
movl $0x32, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovgl %ecx, %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, 0x58(%rax)
movq -0x48(%rbp), %rax
movzbl 0x1c(%rax), %eax
cmpl $0x0, %eax
jle 0x38cf
xorl %eax, %eax
movl %eax, -0x8b8(%rbp)
jmp 0x38dc
movzbl 0x17a83(%rip), %eax     # 0x1b359
movl %eax, -0x8b8(%rbp)
movl -0x8b8(%rbp), %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, 0x59(%rax)
movq -0x48(%rbp), %rax
movw $0x1, 0x5a(%rax)
movl $0x10d2, %edi           # imm = 0x10D2
callq 0x2170
movw %ax, %cx
movq -0x48(%rbp), %rax
movw %cx, 0x5c(%rax)
movq -0x48(%rbp), %rax
movb $-0x1, 0x66(%rax)
movq -0x48(%rbp), %rdi
callq 0x60c0
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x386e
leaq 0x112df(%rip), %rdi     # 0x14c11
callq 0xc820
movb %al, -0x8a8(%rbp)
leaq 0x112d1(%rip), %rdi     # 0x14c15
callq 0xc820
movb %al, -0x8a9(%rbp)
leaq 0x112bb(%rip), %rdi     # 0x14c11
callq 0xc9a0
movb %al, -0x8aa(%rbp)
leaq 0x112ad(%rip), %rdi     # 0x14c15
callq 0xc9a0
movb %al, -0x8ab(%rbp)
xorl %edi, %edi
leaq 0x11295(%rip), %rsi     # 0x14c11
callq 0xc750
xorl %edi, %edi
leaq 0x1128b(%rip), %rsi     # 0x14c15
callq 0xc750
xorl %edi, %edi
leaq 0x11279(%rip), %rsi     # 0x14c11
callq 0xc920
xorl %edi, %edi
leaq 0x1126f(%rip), %rsi     # 0x14c15
callq 0xc920
callq 0xca40
movb %al, -0x8a7(%rbp)
movl $0x1, %edi
callq 0xca20
callq 0xfaf0
cmpb $0x0, %al
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x39d5
jmp 0x41dd
movl $0x4, %edi
leaq 0x116d4(%rip), %rsi     # 0x150b5
movb $0x0, %al
callq 0x123f0
callq 0xf260
movl %eax, -0x74(%rbp)
movq 0x179e1(%rip), %rax     # 0x1b3d8
movl 0x8(%rax), %eax
subl -0x74(%rbp), %eax
cmpl $0x0, %eax
jle 0x3a17
movq 0x179cf(%rip), %rax     # 0x1b3d8
movl 0x8(%rax), %eax
subl -0x74(%rbp), %eax
movl %eax, -0x8bc(%rbp)
jmp 0x3a24
movl $0xa, %eax
movl %eax, -0x8bc(%rbp)
jmp 0x3a24
movl -0x8bc(%rbp), %eax
movl %eax, -0x70(%rbp)
leaq -0x850(%rbp), %rdi
movl -0x70(%rbp), %r8d
movl $0x7d1, %esi            # imm = 0x7D1
leaq -0x8a4(%rbp), %rdx
leaq -0x64(%rbp), %rcx
leaq -0x50(%rbp), %r9
callq 0xfc50
movb %al, -0x8b3(%rbp)
movsbl -0x8b3(%rbp), %eax
cmpl $0x1, %eax
jge 0x3a68
jmp 0x4144
callq 0xf260
movl %eax, -0x74(%rbp)
movw $0x0, -0x8a6(%rbp)
leaq -0x850(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x64(%rbp), %edi
leaq -0x880(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movq -0x50(%rbp), %rax
movl 0x34(%rax), %edi
leaq -0x890(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movswl -0x8a6(%rbp), %ecx
addl $0x12, %ecx
movswl -0x8a4(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x8bd(%rbp)
jg 0x3b1c
movswl -0x8a6(%rbp), %ecx
addl $0x12, %ecx
movq -0x60(%rbp), %rax
movzbl 0x11(%rax), %eax
imull $0x5, %eax, %eax
addl %eax, %ecx
movswl -0x8a4(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x8bd(%rbp)
jg 0x3b1c
movswl -0x8a6(%rbp), %eax
addl $0x12, %eax
movq -0x60(%rbp), %rcx
movzbl 0x11(%rcx), %ecx
imull $0x5, %ecx, %ecx
addl %ecx, %eax
cmpl $0x200, %eax            # imm = 0x200
setle %al
movb %al, -0x8bd(%rbp)
movb -0x8bd(%rbp), %al
testb $0x1, %al
jne 0x3b2b
jmp 0x4142
leaq -0x850(%rbp), %rax
movswl -0x8a6(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movzbl 0x11(%rax), %eax
imull $0x5, %eax, %eax
movslq %eax, %rcx
addq $0x12, %rcx
movswq -0x8a6(%rbp), %rax
addq %rcx, %rax
movw %ax, -0x8a6(%rbp)
movq -0x60(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x2390
movw %ax, %cx
movq -0x60(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %edi
leaq -0x870(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movq -0x60(%rbp), %rax
movl 0xc(%rax), %edi
leaq -0x8a0(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movb $0x0, -0x8af(%rbp)
movb $0x0, -0x8ae(%rbp)
movb $0x0, -0x8ad(%rbp)
movb $0x0, -0x8ac(%rbp)
movq -0x60(%rbp), %rax
movzbl 0x1(%rax), %edx
andl $0x40, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, -0x8b2(%rbp)
leaq -0x880(%rbp), %rdx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rcx
leaq -0x890(%rbp), %r8
leaq -0x870(%rbp), %r9
leaq -0x8a0(%rbp), %r15
movq -0x60(%rbp), %rax
movzwl 0x4(%rax), %r14d
movq -0x60(%rbp), %rax
movzbl 0x10(%rax), %ebx
movq -0x60(%rbp), %rax
movzbl 0x2(%rax), %r11d
movq -0x60(%rbp), %rax
movzbl (%rax), %r10d
movzbl -0x8b2(%rbp), %eax
movl $0x4, %edi
leaq 0x10fdb(%rip), %rsi     # 0x14c1d
movq %r15, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movl %r10d, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movb $0x0, %al
callq 0x123f0
movq -0x60(%rbp), %rax
movzbl 0x11(%rax), %eax
imull $0x5, %eax, %eax
movw %ax, -0x8a2(%rbp)
movswl -0x8a2(%rbp), %eax
cmpl $0x4, %eax
jle 0x3c93
movq -0x60(%rbp), %rax
addq $0x12, %rax
movq %rax, -0x8c8(%rbp)
jmp 0x3c9e
xorl %eax, %eax
movq %rax, -0x8c8(%rbp)
jmp 0x3c9e
movq -0x8c8(%rbp), %rax
movq %rax, -0x858(%rbp)
movq 0x176fd(%rip), %rax     # 0x1b3b0
movq %rax, -0x28(%rbp)
leaq 0x176f2(%rip), %rax     # 0x1b3b0
cmpq %rax, -0x28(%rbp)
je 0x3d2f
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x64(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jne 0x3cdf
movb $0x1, -0x8ac(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jne 0x3cf6
movb $0x1, -0x8ad(%rbp)
movl -0x64(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jne 0x3d09
movb $0x1, -0x8af(%rbp)
movq -0x60(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x48(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jne 0x3d20
movb $0x1, -0x8ae(%rbp)
jmp 0x3d22
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3cb7
movq -0x60(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x0, %eax
je 0x3d57
movq -0x60(%rbp), %rax
movzbl 0x3(%rax), %edx
movl $0x4, %edi
leaq 0x10f41(%rip), %rsi     # 0x14c91
movb $0x0, %al
callq 0x123f0
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5, %eax
je 0x3d82
movq -0x60(%rbp), %rax
movzbl (%rax), %edx
movl $0x4, %edi
leaq 0x10f3f(%rip), %rsi     # 0x14cb5
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8ac(%rbp)
je 0x3daa
leaq -0x880(%rbp), %rdx
movl $0x4, %edi
leaq 0x10f47(%rip), %rsi     # 0x14ce5
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8af(%rbp)
je 0x3dd2
leaq -0x880(%rbp), %rdx
movl $0x4, %edi
leaq 0x10f55(%rip), %rsi     # 0x14d1b
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8ad(%rbp)
je 0x3efa
movl -0x64(%rbp), %edi
callq 0x4c50
movq %rax, -0x38(%rbp)
movzbl -0x8b2(%rbp), %eax
cmpl $0x0, %eax
je 0x3ee2
movq -0x50(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x3ee2
movq -0x60(%rbp), %rax
movzwl 0x4(%rax), %eax
movq -0x50(%rbp), %rcx
movzwl 0x5a(%rcx), %ecx
subl %ecx, %eax
addl $0x2, %eax
cmpl $0x0, %eax
jne 0x3ee2
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x50(%rbp), %rcx
movzbl 0x1c(%rcx), %ecx
movzbl (%rax,%rcx), %edx
movl $0x4, %edi
leaq 0x10f18(%rip), %rsi     # 0x14d65
movb $0x0, %al
callq 0x123f0
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rax
movzbl 0x1c(%rax), %eax
movzbl 0x17445(%rip), %ecx     # 0x1b2b0
imull %ecx, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x7b20
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rax
movzbl 0x1c(%rax), %eax
movzbl 0x1741b(%rip), %ecx     # 0x1b2b0
imull %ecx, %eax
cltq
shlq $0x3, %rax
addq %rax, %rdi
callq 0x7dc0
movb %al, %dl
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x50(%rbp), %rcx
movzbl 0x1c(%rcx), %ecx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x50(%rbp), %rcx
movzbl 0x1c(%rcx), %ecx
movzbl (%rax,%rcx), %edx
movl $0x4, %edi
leaq 0x10eb3(%rip), %rsi     # 0x14d8e
movb $0x0, %al
callq 0x123f0
movl $0x4, %edi
leaq 0x10eab(%rip), %rsi     # 0x14d99
movb $0x0, %al
callq 0x123f0
jmp 0x4144
movq -0x60(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x3f2f
movq -0x60(%rbp), %rdi
movl -0x64(%rbp), %esi
movq -0x50(%rbp), %rdx
callq 0x4320
movl $0x4, %edi
leaq 0x10eb3(%rip), %rsi     # 0x14dd6
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8ae(%rbp)
je 0x3f57
leaq -0x880(%rbp), %rdx
movl $0x4, %edi
leaq 0x10eb9(%rip), %rsi     # 0x14e04
movb $0x0, %al
callq 0x123f0
jmp 0x4144
movq -0x60(%rbp), %rdi
movl -0x64(%rbp), %esi
movq -0x50(%rbp), %rdx
callq 0x4320
movb %al, -0x8b0(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x4c50
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x64(%rbp), %eax
jne 0x3f96
movq -0x40(%rbp), %rax
movq %rax, -0x8d0(%rbp)
jmp 0x3fa5
movl -0x64(%rbp), %edi
callq 0x4c50
movq %rax, -0x8d0(%rbp)
movq -0x8d0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x64(%rbp), %eax
je 0x3fdf
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x3fdf
movl $0x4, %edi
leaq 0x10e6c(%rip), %rsi     # 0x14e3f
movb $0x0, %al
callq 0x123f0
jmp 0x4144
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x60(%rbp), %rdx
movl -0x74(%rbp), %ecx
movq -0x50(%rbp), %r8
callq 0x4470
movb %al, -0x8b1(%rbp)
movzbl -0x8b1(%rbp), %eax
cmpl $0x0, %eax
je 0x407a
cmpb $0x0, -0x8b0(%rbp)
je 0x403d
movq -0x40(%rbp), %rax
movzwl 0x42(%rax), %eax
movq -0x60(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jne 0x407a
movq -0x40(%rbp), %rax
movzbl 0x44(%rax), %eax
subl $0x3, %eax
movq -0x60(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jg 0x407a
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x64(%rbp), %edx
movq -0x50(%rbp), %rcx
movq -0x858(%rbp), %r8
movw -0x8a2(%rbp), %r9w
movb -0x8b0(%rbp), %r10b
movl -0x74(%rbp), %eax
movswl %r9w, %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4e70
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x64(%rbp), %eax
jne 0x40c6
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x64(%rbp), %edx
movw -0x8a2(%rbp), %r8w
movq -0x50(%rbp), %r9
movl -0x74(%rbp), %eax
movl $0x1, %ecx
movswl %r8w, %r8d
movl %eax, (%rsp)
callq 0x6440
movl $0x4, %edi
leaq 0x10dab(%rip), %rsi     # 0x14e68
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8b1(%rbp)
jne 0x40e4
movl $0x4, %edi
leaq 0x10dd2(%rip), %rsi     # 0x14ead
movb $0x0, %al
callq 0x123f0
jmp 0x4144
cmpb $0x0, -0x8b0(%rbp)
je 0x4102
movl $0x4, %edi
leaq 0x10de6(%rip), %rsi     # 0x14edf
movb $0x0, %al
callq 0x123f0
jmp 0x4144
movl $0x4, %edi
leaq 0x10df9(%rip), %rsi     # 0x14f07
movb $0x0, %al
callq 0x123f0
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x64(%rbp), %edx
movw -0x8a2(%rbp), %r8w
movq -0x50(%rbp), %r9
movl -0x74(%rbp), %eax
xorl %ecx, %ecx
movswl %r8w, %r8d
movl %eax, (%rsp)
callq 0x6440
jmp 0x3ab0
jmp 0x4144
movl -0x74(%rbp), %edi
callq 0x6910
movl -0x74(%rbp), %eax
movl -0x68(%rbp), %ecx
addl $0x3e8, %ecx            # imm = 0x3E8
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x41d8
movl -0x74(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x74(%rbp), %edi
callq 0x52a0
callq 0x57e0
callq 0xf160
movq 0x17272(%rip), %rax     # 0x1b3f0
movswl 0x8(%rax), %eax
cmpl $0x0, %eax
jle 0x4191
callq 0x6f60
callq 0x8800
movzbl 0x171c2(%rip), %eax     # 0x1b35a
cmpl $0x0, %eax
je 0x41ac
cmpq $0x0, 0x171bb(%rip)     # 0x1b360
jne 0x41ac
callq 0x2c70
cmpl $0x0, 0x1724d(%rip)     # 0x1b400
je 0x41d3
movl -0x74(%rbp), %eax
movl -0x6c(%rbp), %ecx
addl $0x2710, %ecx           # imm = 0x2710
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x41d3
movl -0x74(%rbp), %eax
movl %eax, -0x6c(%rbp)
callq 0x4790
callq 0x8ea0
jmp 0x39c0
movzbl 0x17174(%rip), %eax     # 0x1b358
cmpl $0x0, %eax
jle 0x41f7
leaq 0x10d47(%rip), %rdi     # 0x14f37
movb $0x0, %al
callq 0x21a0
callq 0xf260
movl %eax, %edi
imull $0x5, 0x170a3(%rip), %eax # 0x1b2a8
addl %eax, %edi
movswl 0x17094(%rip), %eax     # 0x1b2a2
addl %eax, %edi
callq 0x52a0
movq 0x171b4(%rip), %rdi     # 0x1b3d0
callq 0x7f50
movq 0x171b0(%rip), %rax     # 0x1b3d8
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
leaq 0x1719a(%rip), %rax     # 0x1b3d8
cmpq %rax, -0x28(%rbp)
je 0x4294
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x17181(%rip), %rdx     # 0x1b3d8
movq %rdx, %rdi
callq 0x6ed0
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x451, %esi            # imm = 0x451
callq 0x7720
movq -0x58(%rbp), %rdi
movl $0x452, %esi            # imm = 0x452
callq 0x7720
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x4237
cmpq $0x0, 0x170f4(%rip)     # 0x1b390
je 0x42af
movq 0x170eb(%rip), %rdi     # 0x1b390
movl $0x454, %esi            # imm = 0x454
callq 0x7720
movzbl -0x8a7(%rbp), %edi
callq 0xca20
movzbl -0x8a8(%rbp), %edi
leaq 0x10948(%rip), %rsi     # 0x14c11
callq 0xc750
movzbl -0x8a9(%rbp), %edi
leaq 0x10939(%rip), %rsi     # 0x14c15
callq 0xc750
movzbl -0x8aa(%rbp), %edi
leaq 0x10922(%rip), %rsi     # 0x14c11
callq 0xc920
movzbl -0x8ab(%rbp), %edi
leaq 0x10913(%rip), %rsi     # 0x14c15
callq 0xc920
movb $0x0, -0x19(%rbp)
movb -0x19(%rbp), %al
addq $0x8e8, %rsp            # imm = 0x8E8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)