// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: teavpn_tcp_accept_worker_thread
static void *teavpn_tcp_accept_worker_thread(server_config *config)
{
	FILE *h;
	int client_fd;
	uint64_t seq = 0;
	char *remote_addr;
	int16_t conn_index;
	uint16_t remote_port;
	teavpn_packet packet;
	ssize_t nread, nwrite;
	struct timeval timeout;
	struct sockaddr_in client_addr;
	socklen_t rlen = sizeof(struct sockaddr_in);

	/**
	 * NDF
	 */
	char buffer[64 + OFFSETOF(teavpn_packet, data)], *pbuf;
	size_t len, sp = 0;
	const uint8_t sig = 0xff;


	/**
	 * Set timeout to 10 seconds.
	 */
	timeout.tv_sec = 10;
	timeout.tv_usec = 0;


	while (true) {

		pthread_mutex_lock(&accept_worker_mutex);
		pthread_cond_wait(&accept_worker_cond, &accept_worker_mutex);

		/**
		 * Set client_addr to zero.
		 */
		seq = 0;
		memset(&client_addr, 0, sizeof(client_addr));

		client_fd = accept(net_fd, (struct sockaddr *)&client_addr, &rlen);

		if (client_fd < 0) {
			debug_log(0, "Error on accept");
			perror("Error on accept");
			goto next_cycle;
		}

		remote_addr = inet_ntoa(client_addr.sin_addr);
		remote_port = ntohs(client_addr.sin_port);

		debug_log(3, "%s:%d is attempting to make a connection...", remote_addr, remote_port);

		conn_index = get_free_conn_index();

		if (conn_index == -1) {
			debug_log(0, "Connection entry is full, cannot accept more client");
			debug_log(0, "Dropping connection from %s:%d...", remote_addr, remote_port);
			close(client_fd);
			goto next_cycle;
		}

		/**
		 * Set recv timeout.
		 */
		if (setsockopt(client_fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)) < 0) {
			debug_log(0, "Error set recv timeout");
			perror("Error set recv timeout");
			goto next_cycle;
		}

		/**
		 * Set send timeout.
		 */
		if (setsockopt(client_fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout)) < 0) {
			debug_log(0, "Error set recv timeout");
			perror("Error set recv timeout");
			goto next_cycle;
		}

		/**
		 * Read auth packet (username and password).
		 */
		seq++; // seq 1
		nread = read(client_fd, &packet, sizeof(packet));

		debug_log(3, "[%ld] Read auth packet from %s:%d %ld bytes (server_seq: %ld) (client_seq: %ld) (seq %s)",
				seq, remote_addr, remote_port, nread, seq, packet.info.seq,
				(seq == packet.info.seq) ? "match" : "invalid");

		if (nread == 0) {
			debug_log(3, "Client %s:%d closed connection");
			close(client_fd);
			goto next_cycle;
		}

		if (nread < 0) {
			debug_log(3, "An error occured when reading auth packet from %s:%d", remote_addr, remote_port);
			perror("Error read from client (acceptor)");
			close(client_fd);
			goto next_cycle;
		}

		if (seq != packet.info.seq) {
			debug_log(0, "Invalid packet sequence from %s:%d (client_seq: %ld) (server_seq: %ld)",
				remote_addr, remote_port, seq, packet.info.seq);
			close(client_fd);
			goto next_cycle;
		}

		/**
		 * Validate credential from auth packet.
		 */
		if (packet.info.type == TEAVPN_PACKET_AUTH) {
			h = teavpn_auth_check(config, &(packet.data.auth));
		} else {
			debug_log(3, "Invalid auth packet from %s:%d", remote_addr, remote_port);
			debug_log(3, "Dropping connection from %s:%d...", remote_addr, remote_port);
			close(client_fd);
			goto next_cycle;
		}

		if (h == NULL) {
			/**
			 * Invalid username or password.
			 */
			packet.info.type = TEAVPN_PACKET_SIG;
			packet.info.len = TEAVPN_PACK(sizeof(packet.data.sig));
			packet.info.seq = ++seq; // seq 2
			packet.data.sig.sig = TEAVPN_SIG_AUTH_REJECT;
			nwrite = write(client_fd, &packet, TEAVPN_PACK(sizeof(packet.data.sig)));
			debug_log(3, "Invalid username or password from %s:%d", remote_addr, remote_port);
			debug_log(3, "Dropping connection from %s:%d...", remote_addr, remote_port);
			close(client_fd);
			goto next_cycle;
		}


		/**
		 * Preparing client network interface configuration.
		 */
		memset(buffer, 0, sizeof(buffer));
		pbuf = fgets(buffer, 63, h);
		fclose(h);
		if (pbuf == NULL) {
			debug_log(0, "Invalid IP configuration for username %s", packet.data.auth.username);
		}

		len = strlen(buffer);

		while (buffer[sp] != ' ') {
			if (sp >= len) {
				close(client_fd);
				debug_log(0, "Invalid IP configuration for username %s", packet.data.auth.username);
				goto next_cycle;
			}
			sp++;
		}

		if ((sp > sizeof("xxx.xxx.xxx.xxx/xx")) || ((len - (sp - 1)) > sizeof("xxx.xxx.xxx.xxx"))) {
			close(client_fd);
			debug_log(0, "Invalid IP configuration for username %s", packet.data.auth.username);
			goto next_cycle;	
		}

		debug_log(1, "%s connected from (%s:%d) [%s]", packet.data.auth.username, remote_addr, remote_port, buffer);


		/**
		 * Assign client fd to connection entry.
		 */
		connections[conn_index].fd = client_fd;
		connections[conn_index].priv_ip = ip_read_conv(buffer);
		connections[conn_index].error = 0;
		connections[conn_index].addr = client_addr;


		/**
		 * Send auth ok signal.
		 */
		packet.info.type = TEAVPN_PACKET_SIG;
		packet.info.len = TEAVPN_PACK(sizeof(packet.data.sig));
		packet.data.sig.sig = TEAVPN_SIG_AUTH_OK;
		packet.info.seq = ++seq; // seq 2

		nwrite = write(client_fd, &packet, TEAVPN_PACK(sizeof(packet.data.sig)));

		debug_log(3, "[%ld] Write sig auth to %s:%d %ld bytes (server_seq: %ld) (client_seq: %ld) (seq %s)",
				seq, remote_addr, remote_port, nwrite, seq, packet.info.seq,
				(seq == packet.info.seq) ? "match" : "invalid");

		if (nwrite == 0) {
			debug_log(3, "Client %s:%d closed connection (authenticated)", remote_addr, remote_port);
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}

		if (nwrite < 0) {
			debug_log(3, "Error send auth ok signal to %s:%d", remote_addr, remote_port);
			perror("Error write to client_fd (acceptor)");
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}


		/**
		 * Wait for ack signal.
		 */
		seq++; // seq 3
		nread = read(client_fd, &packet, sizeof(packet));

		debug_log(3, "[%ld] Read sig ack from %s:%d %ld bytes (server_seq: %ld) (client_seq: %ld) (seq %s)",
				seq, remote_addr, remote_port, nread, seq, packet.info.seq,
				(seq == packet.info.seq) ? "match" : "invalid");

		if (nread == 0) {
			debug_log(3, "Client %s:%d closed connection (authenticated)", remote_addr, remote_port);
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}

		if (nread < 0) {
			debug_log(3, "Error read ack packet from %s:%d", remote_addr, remote_port);
			perror("Error read from client_fd (acceptor)");
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}

		if (seq != packet.info.seq) {
			debug_log(0, "Invalid packet sequence from %s:%d (client_seq: %ld) (server_seq: %ld) (authenticated)",
				remote_addr, remote_port, seq, packet.info.seq);
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}

		/**
		 * Verify ack signal..
		 */
		if ((packet.info.type == TEAVPN_PACKET_SIG) && (packet.data.sig.sig == TEAVPN_SIG_ACK)) {
			debug_log(3, "[%ld] Got ack from %s:%d (connection established)", seq, remote_addr, remote_port);
		} else {
			debug_log(3, "[%ld] Invalid ack signal from %s:%d (authenticated)", seq, remote_addr, remote_port);
			debug_log(0, "Dropping connection from %s:%d...", remote_addr, remote_port);
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}


		/**
		 * Send network interface configuration.
		 */
		packet.info.type = TEAVPN_PACKET_CONF;
		packet.info.seq = ++seq; // seq 4
		packet.info.len = TEAVPN_PACK(sizeof(packet.data.conf));
		memcpy(packet.data.conf.inet4, buffer, sp);
		packet.data.conf.inet4[sp] = '\0';
		strcpy(packet.data.conf.inet4_broadcast, &(buffer[sp+1]));
		nwrite = write(client_fd, &packet, TEAVPN_PACK(sizeof(packet.data.conf)));

		debug_log(3, "[%ld] Write packet conf to %s:%d %ld bytes (server_seq: %ld) (client_seq: %ld) (seq %s)",
				seq, remote_addr, remote_port, nwrite, seq, packet.info.seq,
				(seq == packet.info.seq) ? "match" : "invalid");

		if (nwrite == 0) {
			debug_log(3, "Client %s:%d closed connection (authenticated)", remote_addr, remote_port);
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}

		if (nwrite < 0) {
			debug_log(3, "Error send network config to %s:%d", remote_addr, remote_port);
			perror("Error write to client_fd (acceptor)");
			close(client_fd);
			connection_zero(conn_index);
			goto next_cycle;
		}


		/**
		 * Set entry to connected state.
		 */
		connections[conn_index].connected = true;
		connections[conn_index].seq = seq;
		conn_count++;


		/**
		 * Interrupt main process in order to read rd_set.
		 */
		nwrite = write(m_pipe_fd[1], &sig, sizeof(sig));
		if (nwrite < 0) {
			debug_log(0, "Error write to m_pipe_fd[1]");
			perror("Error write to m_pipe_fd[1]");
			goto next_cycle;
		}

		next_cycle:
		(void)1;
		pthread_mutex_unlock(&accept_worker_mutex);
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x10b8, %rsp           # imm = 0x10B8
movq %rdi, -0x10(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x10, -0x107c(%rbp)
movq %rsp, %rax
movq %rax, -0x1088(%rbp)
movq %rsp, %rax
addq $-0x50, %rax
movq %rax, -0x10c0(%rbp)
movq %rax, %rsp
xorl %eax, %eax
addq $0x10, %rax
addq $0x40, %rax
movq %rax, -0x1090(%rbp)
movq $0x0, -0x10a8(%rbp)
movb $-0x1, -0x10a9(%rbp)
movq $0xa, -0x1068(%rbp)
movq $0x0, -0x1060(%rbp)
jmp 0x6f58
leaq 0x7499(%rip), %rdi      # 0xe3f8
callq 0x2400
leaq 0x7435(%rip), %rdi      # 0xe3a0
leaq 0x7486(%rip), %rsi      # 0xe3f8
callq 0x20d0
movq $0x0, -0x28(%rbp)
leaq -0x1078(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2190
movl 0x73f8(%rip), %edi      # 0xe390
leaq -0x1078(%rbp), %rax
movq %rax, -0x10b8(%rbp)
movq -0x10b8(%rbp), %rsi
leaq -0x107c(%rbp), %rdx
callq 0x2380
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x6ff1
leaq 0x745b(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x6fe0
leaq 0x3cbd(%rip), %rdi      # 0xac96
movb $0x0, %al
callq 0x84c0
leaq 0x3caf(%rip), %rdi      # 0xac96
callq 0x2360
jmp 0x7bf1
movl -0x1074(%rbp), %edi
callq 0x20c0
movq %rax, -0x30(%rbp)
movzwl -0x1076(%rbp), %edi
callq 0x2300
movw %ax, -0x34(%rbp)
leaq 0x740d(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7039
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3c74(%rip), %rdi      # 0xaca6
movb $0x0, %al
callq 0x84c0
callq 0x7f00
movw %ax, -0x32(%rbp)
movswl -0x32(%rbp), %eax
cmpl $-0x1, %eax
jne 0x709c
leaq 0x73d2(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7069
leaq 0x3c70(%rip), %rdi      # 0xacd2
movb $0x0, %al
callq 0x84c0
leaq 0x73b4(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x708f
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3c7e(%rip), %rdi      # 0xad06
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
movl -0x1c(%rbp), %edi
movl $0x1, %esi
movl $0x14, %edx
leaq -0x1068(%rbp), %rcx
movl $0x10, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x70ef
leaq 0x735d(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x70de
leaq 0x3c51(%rip), %rdi      # 0xad28
movb $0x0, %al
callq 0x84c0
leaq 0x3c43(%rip), %rdi      # 0xad28
callq 0x2360
jmp 0x7bf1
movl -0x1c(%rbp), %edi
movl $0x1, %esi
movl $0x15, %edx
leaq -0x1068(%rbp), %rcx
movl $0x10, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x7142
leaq 0x730a(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7131
leaq 0x3bfe(%rip), %rdi      # 0xad28
movb $0x0, %al
callq 0x84c0
leaq 0x3bf0(%rip), %rdi      # 0xad28
callq 0x2360
jmp 0x7bf1
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edi
leaq -0x1048(%rbp), %rsi
movl $0x1010, %edx           # imm = 0x1010
callq 0x21d0
movq %rax, -0x1050(%rbp)
leaq 0x72b4(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x71d9
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
movq -0x1050(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x1040(%rbp), %r10
movq -0x28(%rbp), %r11
movq -0x1040(%rbp), %rbx
leaq 0x3361(%rip), %rax      # 0xa50d
leaq 0x3354(%rip), %rdi      # 0xa507
cmpq %rbx, %r11
cmoveq %rdi, %rax
leaq 0x3b7e(%rip), %rdi      # 0xad3f
subq $0x10, %rsp
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x84c0
addq $0x10, %rsp
cmpq $0x0, -0x1050(%rbp)
jne 0x7211
leaq 0x723a(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7204
leaq 0x3b9b(%rip), %rdi      # 0xad98
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
cmpq $0x0, -0x1050(%rbp)
jge 0x725d
leaq 0x7202(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7244
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3b7a(%rip), %rdi      # 0xadb7
movb $0x0, %al
callq 0x84c0
leaq 0x3ba1(%rip), %rdi      # 0xadec
callq 0x2360
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
movq -0x28(%rbp), %rax
cmpq -0x1040(%rbp), %rax
je 0x72a8
leaq 0x71b3(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x729b
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x1040(%rbp), %r8
leaq 0x3b7a(%rip), %rdi      # 0xae0e
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
cmpl $0x1, -0x1048(%rbp)
jne 0x72cb
movq -0x10(%rbp), %rdi
leaq -0x1048(%rbp), %rsi
addq $0x10, %rsi
callq 0x8310
movq %rax, -0x18(%rbp)
jmp 0x732a
leaq 0x7152(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x72f4
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3b68(%rip), %rdi      # 0xae55
movb $0x0, %al
callq 0x84c0
leaq 0x7129(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x731d
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x39f0(%rip), %rdi      # 0xad06
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
cmpq $0x0, -0x18(%rbp)
jne 0x73ee
movl $0x4, -0x1048(%rbp)
xorl %eax, %eax
addq $0x10, %rax
addq $0x4, %rax
movw %ax, -0x1044(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x1040(%rbp)
movl $0x1, -0x1038(%rbp)
movl -0x1c(%rbp), %edi
leaq -0x1048(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
addq $0x10, %rdx
addq $0x4, %rdx
callq 0x20b0
movq %rax, -0x1058(%rbp)
leaq 0x708e(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x73b8
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3ac3(%rip), %rdi      # 0xae74
movb $0x0, %al
callq 0x84c0
leaq 0x7065(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x73e1
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x392c(%rip), %rdi      # 0xad06
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
jmp 0x7bf1
movq -0x10c0(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
addq $0x10, %rdx
addq $0x40, %rdx
callq 0x2190
movq -0x10c0(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3f, %esi
callq 0x21e0
movq %rax, -0x1098(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20e0
cmpq $0x0, -0x1098(%rbp)
jne 0x7466
leaq 0x6fe6(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7464
leaq -0x1048(%rbp), %rsi
addq $0x10, %rsi
addq $0x2, %rsi
leaq 0x3a3f(%rip), %rdi      # 0xae9c
movb $0x0, %al
callq 0x84c0
jmp 0x7466
movq -0x10c0(%rbp), %rdi
callq 0x20f0
movq %rax, -0x10a0(%rbp)
movq -0x10c0(%rbp), %rax
movq -0x10a8(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x74ee
movq -0x10a8(%rbp), %rax
cmpq -0x10a0(%rbp), %rax
jb 0x74da
movl -0x1c(%rbp), %edi
callq 0x21b0
leaq 0x6f75(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x74d5
leaq -0x1048(%rbp), %rsi
addq $0x10, %rsi
addq $0x2, %rsi
leaq 0x39ce(%rip), %rdi      # 0xae9c
movb $0x0, %al
callq 0x84c0
jmp 0x7bf1
movq -0x10a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10a8(%rbp)
jmp 0x7479
cmpq $0x13, -0x10a8(%rbp)
ja 0x7513
movq -0x10a0(%rbp), %rax
movq -0x10a8(%rbp), %rcx
subq $0x1, %rcx
subq %rcx, %rax
cmpq $0x10, %rax
jbe 0x754d
movl -0x1c(%rbp), %edi
callq 0x21b0
leaq 0x6f02(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7548
leaq -0x1048(%rbp), %rsi
addq $0x10, %rsi
addq $0x2, %rsi
leaq 0x395b(%rip), %rdi      # 0xae9c
movb $0x0, %al
callq 0x84c0
jmp 0x7bf1
leaq 0x6ed0(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x758c
movq -0x10c0(%rbp), %r8
leaq -0x1048(%rbp), %rsi
addq $0x10, %rsi
addq $0x2, %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
leaq 0x3940(%rip), %rdi      # 0xaec5
movb $0x0, %al
callq 0x84c0
movq -0x10c0(%rbp), %rdi
movl -0x1c(%rbp), %ecx
movq 0x6ddb(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rdx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
callq 0x2720
movl %eax, %ecx
movq 0x6dbf(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rdx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq 0x6da9(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x5(%rax)
movq 0x6d92(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq -0x1078(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq -0x1070(%rbp), %rcx
movq %rcx, 0x48(%rax)
movl $0x4, -0x1048(%rbp)
xorl %eax, %eax
addq $0x10, %rax
addq $0x4, %rax
movw %ax, -0x1044(%rbp)
movl $0x2, -0x1038(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x1040(%rbp)
movl -0x1c(%rbp), %edi
leaq -0x1048(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
addq $0x10, %rdx
addq $0x4, %rdx
callq 0x20b0
movq %rax, -0x1058(%rbp)
leaq 0x6dbb(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x76d2
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
movq -0x1058(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x1040(%rbp), %r10
movq -0x28(%rbp), %r11
movq -0x1040(%rbp), %rbx
leaq 0x2e68(%rip), %rax      # 0xa50d
leaq 0x2e5b(%rip), %rdi      # 0xa507
cmpq %rbx, %r11
cmoveq %rdi, %rax
leaq 0x382a(%rip), %rdi      # 0xaee4
subq $0x10, %rsp
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x84c0
addq $0x10, %rsp
cmpq $0x0, -0x1058(%rbp)
jne 0x771b
leaq 0x6d41(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7705
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x383b(%rip), %rdi      # 0xaf39
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
cmpq $0x0, -0x1058(%rbp)
jge 0x7770
leaq 0x6cf8(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x774e
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3821(%rip), %rdi      # 0xaf68
movb $0x0, %al
callq 0x84c0
leaq 0x3836(%rip), %rdi      # 0xaf8b
callq 0x2360
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %edi
leaq -0x1048(%rbp), %rsi
movl $0x1010, %edx           # imm = 0x1010
callq 0x21d0
movq %rax, -0x1050(%rbp)
leaq 0x6c86(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7807
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
movq -0x1050(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x1040(%rbp), %r10
movq -0x28(%rbp), %r11
movq -0x1040(%rbp), %rbx
leaq 0x2d33(%rip), %rax      # 0xa50d
leaq 0x2d26(%rip), %rdi      # 0xa507
cmpq %rbx, %r11
cmoveq %rdi, %rax
leaq 0x37c0(%rip), %rdi      # 0xafaf
subq $0x10, %rsp
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x84c0
addq $0x10, %rsp
cmpq $0x0, -0x1050(%rbp)
jne 0x7850
leaq 0x6c0c(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x783a
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3706(%rip), %rdi      # 0xaf39
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
cmpq $0x0, -0x1050(%rbp)
jge 0x78a5
leaq 0x6bc3(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7883
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3788(%rip), %rdi      # 0xb004
movb $0x0, %al
callq 0x84c0
leaq 0x379b(%rip), %rdi      # 0xb025
callq 0x2360
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
movq -0x28(%rbp), %rax
cmpq -0x1040(%rbp), %rax
je 0x78f9
leaq 0x6b6b(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x78e3
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x1040(%rbp), %r8
leaq 0x376e(%rip), %rdi      # 0xb04a
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
cmpl $0x4, -0x1048(%rbp)
jne 0x793a
cmpl $0x10, -0x1038(%rbp)
jne 0x793a
leaq 0x6b12(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7938
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
leaq 0x3770(%rip), %rdi      # 0xb0a1
movb $0x0, %al
callq 0x84c0
jmp 0x79a3
leaq 0x6ae3(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7967
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
leaq 0x3773(%rip), %rdi      # 0xb0d3
movb $0x0, %al
callq 0x84c0
leaq 0x6ab6(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x798d
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3380(%rip), %rdi      # 0xad06
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
movq -0x10c0(%rbp), %rsi
movl $0x8, -0x1048(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x1040(%rbp)
xorl %eax, %eax
addq $0x10, %rax
addq $0x33, %rax
movw %ax, -0x1044(%rbp)
leaq -0x1048(%rbp), %rdi
addq $0x10, %rdi
movq -0x10a8(%rbp), %rdx
callq 0x2260
movq -0x10c0(%rbp), %rsi
movq -0x10a8(%rbp), %rax
movb $0x0, -0x1038(%rbp,%rax)
leaq -0x1048(%rbp), %rdi
addq $0x10, %rdi
addq $0x13, %rdi
movq -0x10a8(%rbp), %rax
addq $0x1, %rax
addq %rax, %rsi
callq 0x2070
movl -0x1c(%rbp), %edi
leaq -0x1048(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
addq $0x10, %rdx
addq $0x33, %rdx
callq 0x20b0
movq %rax, -0x1058(%rbp)
leaq 0x69d4(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7ab9
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x34(%rbp), %ecx
movq -0x1058(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x1040(%rbp), %r10
movq -0x28(%rbp), %r11
movq -0x1040(%rbp), %rbx
leaq 0x2a81(%rip), %rax      # 0xa50d
leaq 0x2a74(%rip), %rdi      # 0xa507
cmpq %rbx, %r11
cmoveq %rdi, %rax
leaq 0x3666(%rip), %rdi      # 0xb107
subq $0x10, %rsp
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x84c0
addq $0x10, %rsp
cmpq $0x0, -0x1058(%rbp)
jne 0x7b02
leaq 0x695a(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7aec
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3454(%rip), %rdi      # 0xaf39
movb $0x0, %al
callq 0x84c0
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
cmpq $0x0, -0x1058(%rbp)
jge 0x7b57
leaq 0x6911(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jg 0x7b35
movq -0x30(%rbp), %rsi
movzwl -0x34(%rbp), %edx
leaq 0x3631(%rip), %rdi      # 0xb15f
movb $0x0, %al
callq 0x84c0
leaq 0x344f(%rip), %rdi      # 0xaf8b
callq 0x2360
movl -0x1c(%rbp), %edi
callq 0x21b0
movzwl -0x32(%rbp), %edi
callq 0x7cf0
jmp 0x7bf1
movq 0x681a(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0x4(%rax)
movq -0x28(%rbp), %rcx
movq 0x67ff(%rip), %rax      # 0xe378
movswq -0x32(%rbp), %rdx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movw 0x6890(%rip), %ax       # 0xe420
addw $0x1, %ax
movw %ax, 0x6885(%rip)       # 0xe420
movl 0x67fb(%rip), %edi      # 0xe39c
leaq -0x10a9(%rbp), %rsi
movl $0x1, %edx
callq 0x20b0
movq %rax, -0x1058(%rbp)
cmpq $0x0, -0x1058(%rbp)
jge 0x7bef
leaq 0x685a(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7be1
leaq 0x35a8(%rip), %rdi      # 0xb182
movb $0x0, %al
callq 0x84c0
leaq 0x359a(%rip), %rdi      # 0xb182
callq 0x2360
jmp 0x7bf1
jmp 0x7bf1
leaq 0x6800(%rip), %rdi      # 0xe3f8
callq 0x22b0
jmp 0x6f56
nopw %cs:(%rax,%rax)