// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/mmulti.c
// Function: getpacket
int getpacket (int *retother, unsigned char *bufptr)
{
	int i, j, k, ic0, crc16ofs, messleng, other;
	static int warned = 0;

	if (numplayers < 2) return(0);

	if (netready)
	{
		for(i=connecthead;i>=0;i=connectpoint2[i])
		{
			if (i != myconnectindex) dosendpackets(i);
			if ((networkmode == MMULTI_MODE_MS) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
		}
	}

	tims = GetTickCount();

	while (netread(&other,pakbuf,sizeof(pakbuf)))
	{
			//Packet format:
			//   short crc16ofs;       //offset of crc16
			//   int icnt0;           //earliest unacked packet
			//   char ibits[32];       //ack status of packets icnt0<=i<icnt0+256
			//   while (short leng)    //leng: !=0 for packet, 0 for no more packets
			//   {
			//      int ocnt;         //index of following packet data
			//      char pak[leng];    //actual packet data :)
			//   }
			//   unsigned short crc16; //CRC16 of everything except crc16
		k = 0;
		crc16ofs = (int)(*(unsigned short *)&pakbuf[k]); k += 2;

		if (crc16ofs+2 > (int)sizeof(pakbuf)) {
#ifdef MMULTI_DEBUG_SENDRECV
			debugprintf("mmulti debug: wrong-sized packet from %d\n", other);
#endif
		} else if (getcrc16(pakbuf,crc16ofs) != (*(unsigned short *)&pakbuf[crc16ofs])) {
#ifdef MMULTI_DEBUG_SENDRECV
			debugprintf("mmulti debug: bad crc in packet from %d\n", other);
#endif
		} else {
			ic0 = *(int *)&pakbuf[k]; k += 4;
			if (ic0 == -1)
			{
				// Peers send each other 0xaa and respond with 0xab containing their opinion
				// of the requesting peer's placement within the order.

				// Slave sends 0xaa to Master at initmultiplayerscycle() and waits for 0xab response.
				// Master responds to slave with 0xab whenever it receives a 0xaa - even if during game!
				if (pakbuf[k] == 0xaa)
				{
					int sendother = -1;
#ifdef MMULTI_DEBUG_SENDRECV
					const char *addr = presentaddress((struct sockaddr *)&snatchhost);
#endif

					if (networkmode == MMULTI_MODE_MS) {
						// Master-slave.
						if (other == myconnectindex && myconnectindex == connecthead) {
							// This the master and someone new is calling. Find them a place.
#ifdef MMULTI_DEBUG_SENDRECV
							debugprintf("mmulti debug: got ping from new host %s\n", addr);
#endif
							for (other = 1; other < numplayers; other++) {
								if (otherhost[other].ss_family == PF_UNSPEC) {
									sendother = other;
#ifdef MMULTI_DEBUG_SENDRECV
									debugprintf("mmulti debug: giving %s player %d\n", addr, other);
#endif
									break;
								}
							}
						} else {
							// Repeat back to them their position.
#ifdef MMULTI_DEBUG_SENDRECV
							debugprintf("mmulti debug: got ping from player %d\n", other);
#endif
							sendother = other;
						}
					} else {
						// Peer-to-peer mode.
						if (other == myconnectindex) {
#ifdef MMULTI_DEBUG_SENDRECV
							debugprintf("mmulti debug: got ping from unknown host %s\n", addr);
#endif
						} else {
#ifdef MMULTI_DEBUG_SENDRECV
							debugprintf("mmulti debug: got ping from peer %d\n", other);
#endif
							sendother = other;
						}
					}

					if (sendother >= 0) {
						savesnatchhost(sendother);
						lastrecvtims[sendother] = tims;

							//   short crc16ofs;        //offset of crc16
							//   int icnt0;             //-1 (special packet for MMULTI.C's player collection)
							//   char type;				// 0xab
							//   char connectindex;
							//   char numplayers;
							//   char netready;
							//   unsigned short crc16;  //CRC16 of everything except crc16
						k = 2;
						*(int *)&pakbuf[k] = -1; k += 4;
						pakbuf[k++] = 0xab;
						pakbuf[k++] = (char)sendother;
						pakbuf[k++] = (char)numplayers;
						pakbuf[k++] = (char)netready;
						*(unsigned short *)&pakbuf[0] = (unsigned short)k;
						*(unsigned short *)&pakbuf[k] = getcrc16(pakbuf,k); k += 2;
						netsend(sendother,pakbuf,k);
					}
				}
				else if (pakbuf[k] == 0xab)
				{
					if (networkmode == MMULTI_MODE_MS) {
						// Master-slave.
						if (((unsigned int)pakbuf[k+1] < (unsigned int)pakbuf[k+2]) &&
							 ((unsigned int)pakbuf[k+2] < (unsigned int)MAXPLAYERS) &&
							 other == connecthead)
						{
#ifdef MMULTI_DEBUG_SENDRECV
								debugprintf("mmulti debug: master gave us player %d in a %d player game\n",
									(int)pakbuf[k+1], (int)pakbuf[k+2]);
#endif

							if ((int)pakbuf[k+1] != myconnectindex ||
									(int)pakbuf[k+2] != numplayers)
							{
								myconnectindex = (int)pakbuf[k+1];
								numplayers = (int)pakbuf[k+2];

								connecthead = 0;
								for(i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
								connectpoint2[numplayers-1] = -1;
							}

							netready = netready || (int)pakbuf[k+3];

							savesnatchhost(connecthead);
							lastrecvtims[connecthead] = tims;
						}
					} else {
						// Peer-to-peer. Verify that our peer's understanding of the
						// order and player count matches with ours.
						if (myconnectindex != (int)pakbuf[k+1] ||
								numplayers != (int)pakbuf[k+2]) {
							if (!warned) {
								const char *addr = presentaddress((struct sockaddr *)&snatchhost);
								printf("mmulti error: host %s (peer %d) believes this machine is "
									"player %d in a %d-player game! The game will not start until "
									"every machine is in agreement.\n",
									addr, other, (int)pakbuf[k+1], (int)pakbuf[k+2]);
							}
							warned = 1;
						} else {
							savesnatchhost(other);
							lastrecvtims[other] = tims;
						}
					}
				}
			}
			else
			{
				if (other == myconnectindex) {
#ifdef MMULTI_DEBUG_SENDRECV
					debugprintf("mmulti debug: got a packet from unknown host %s\n",
								presentaddress((struct sockaddr *)&snatchhost));
					return 0;
#endif
				}
				if (ocnt0[other] < ic0) ocnt0[other] = ic0;
				for(i=ic0;i<min(ic0+256,ocnt1[other]);i++)
					if (pakbuf[((i-ic0)>>3)+k]&(1<<((i-ic0)&7)))
						opak[other][i&(FIFSIZ-1)] = 0;
				k += 32;

				messleng = (int)(*(unsigned short *)&pakbuf[k]); k += 2;
				while (messleng)
				{
					j = *(int *)&pakbuf[k]; k += 4;
					if ((j >= icnt0[other]) && (!ipak[other][j&(FIFSIZ-1)]))
					{
						if (pakmemi+messleng+2 > (int)sizeof(pakmem)) pakmemi = 1;
						ipak[other][j&(FIFSIZ-1)] = pakmemi;
						*(short *)&pakmem[pakmemi] = messleng;
						memcpy(&pakmem[pakmemi+2],&pakbuf[k],messleng); pakmemi += messleng+2;
					}
					k += messleng;
					messleng = (int)(*(unsigned short *)&pakbuf[k]); k += 2;
				}

				lastrecvtims[other] = tims;
			}
		}
	}

		//Return next valid packet from any player
	if (!bufptr) return(0);
	for(i=connecthead;i>=0;i=connectpoint2[i])
	{
		if (i != myconnectindex)
		{
			j = ipak[i][icnt0[i]&(FIFSIZ-1)];
			if (j)
			{
				messleng = *(short *)&pakmem[j]; memcpy(bufptr,&pakmem[j+2],messleng);
				*retother = i; ipak[i][icnt0[i]&(FIFSIZ-1)] = 0; icnt0[i]++;
				return(messleng);
			}
		}
		if ((networkmode == MMULTI_MODE_MS) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
	}

	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %r13d, %r13d
cmpl $0x2, 0x747449(%rip)    # 0x7a5b2c
jl 0x5edcc
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpl $0x0, 0x747486(%rip)    # 0x7a5b80
setne %al
movl 0x74742d(%rip), %ebp    # 0x7a5b30
testl %ebp, %ebp
setns %cl
andb %al, %cl
leaq 0x74742f(%rip), %rbx    # 0x7a5b40
cmpb $0x1, %cl
jne 0x5e747
movl 0x747408(%rip), %eax    # 0x7a5b24
cmpl %eax, %ebp
je 0x5e72d
movl %ebp, %edi
callq 0x5ee6d
movl 0x7473f7(%rip), %eax    # 0x7a5b24
cmpl $0x0, 0x85134(%rip)     # 0xe3868
jne 0x5e73e
cmpl 0x7473f4(%rip), %eax    # 0x7a5b30
jne 0x5e747
movl %ebp, %ecx
movl (%rbx,%rcx,4), %ebp
testl %ebp, %ebp
jns 0x5e71c
callq 0x5ee15
movl %eax, 0x747432(%rip)    # 0x7a5b84
leaq 0x747507(%rip), %r12    # 0x7a5c60
leaq 0x4(%rsp), %rdi
movq %r12, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x5d8a3
testl %eax, %eax
je 0x5ed57
leaq 0x4(%rsp), %rbx
leaq 0xb576b1(%rip), %r14    # 0xbb5e30
leaq 0x74f69a(%rip), %r15    # 0x7ade20
movzwl 0x7474d3(%rip), %eax    # 0x7a5c60
cmpq $0xfe, %rax
ja 0x5e936
xorl %ecx, %ecx
testq %rax, %rax
je 0x5e7c4
leaq 0x1(%rax), %rdx
movzbl %ch, %esi
shll $0x8, %ecx
movzwl %cx, %ecx
movzbl -0x2(%rdx,%r12), %edi
xorl %esi, %edi
xorl (%r14,%rdi,4), %ecx
decq %rdx
cmpq $0x1, %rdx
ja 0x5e7a4
jmp 0x5e7c6
xorl %eax, %eax
cmpw (%rax,%r12), %cx
jne 0x5e936
movl 0x74748b(%rip), %eax    # 0x7a5c62
cmpl $-0x1, %eax
je 0x5e953
movslq 0x4(%rsp), %r13
leaq 0x74f5b4(%rip), %rcx    # 0x7adda0
cmpl %eax, (%rcx,%r13,4)
jge 0x5e7fd
leaq 0x74f5a7(%rip), %rcx    # 0x7adda0
movl %eax, (%rcx,%r13,4)
leal 0x100(%rax), %ecx
leaq 0x74f5d6(%rip), %rdx    # 0x7adde0
movl (%rdx,%r13,4), %edx
cmpl %edx, %ecx
cmovgel %edx, %ecx
cmpl %eax, %edx
jle 0x5e856
xorl %edx, %edx
movl %edx, %esi
sarl $0x3, %esi
movslq %esi, %rsi
movzbl 0x6(%rsi,%r12), %esi
movl %edx, %edi
andl $0x7, %edi
btl %edi, %esi
jae 0x5e84b
leal (%rax,%rdx), %esi
andl $0x1ff, %esi            # imm = 0x1FF
movq %r13, %rdi
shlq $0xb, %rdi
addq %r15, %rdi
movl $0x0, (%rdi,%rsi,4)
leal (%rax,%rdx), %esi
incl %esi
incl %edx
cmpl %ecx, %esi
jl 0x5e819
movzwl 0x747429(%rip), %ecx    # 0x7a5c86
testw %cx, %cx
leaq 0x747539(%rip), %rsi    # 0x7a5da0
je 0x5e912
movl 0x84ffd(%rip), %eax     # 0xe3870
leaq 0x7474e6(%rip), %rdx    # 0x7a5d60
movl (%rdx,%r13,4), %ebx
movl $0x28, %edx
movzwl %cx, %ebp
movslq %edx, %r14
movl (%r14,%r12), %ecx
addq $0x4, %r14
cmpl %ebx, %ecx
jl 0x5e8fd
andl $0x1ff, %ecx            # imm = 0x1FF
movq %r13, %rdx
shlq $0xb, %rdx
addq %rsi, %rdx
cmpl $0x0, (%rdx,%rcx,4)
jne 0x5e8fd
leaq (%rdx,%rcx,4), %rcx
leal (%rax,%rbp), %edx
cmpl $0x3fffff, %edx         # imm = 0x3FFFFF
movl $0x1, %edx
cmovgel %edx, %eax
movl %eax, (%rcx)
movslq %eax, %r15
leaq 0x757554(%rip), %rcx    # 0x7b5e20
movw %bp, (%r15,%rcx)
leal 0x2(%r15), %eax
movslq %eax, %rdi
addq %rcx, %rdi
movslq %r14d, %rsi
addq %r12, %rsi
movq %rbp, %rdx
callq 0x80e0
leaq 0x7474b0(%rip), %rsi    # 0x7a5da0
leal (%r15,%rbp), %eax
addl $0x2, %eax
movl %eax, 0x84f73(%rip)     # 0xe3870
addq %rbp, %r14
leal 0x2(%r14), %edx
movzwl (%r12,%r14), %ecx
testw %cx, %cx
jne 0x5e883
movl 0x74726c(%rip), %eax    # 0x7a5b84
leaq 0x747271(%rip), %rcx    # 0x7a5b90
movl %eax, (%rcx,%r13,4)
leaq 0x4(%rsp), %rbx
leaq 0xb57501(%rip), %r14    # 0xbb5e30
leaq 0x74f4ea(%rip), %r15    # 0x7ade20
movq %rbx, %rdi
movq %r12, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x5d8a3
testl %eax, %eax
jne 0x5e786
jmp 0x5ed57
movzbl 0x74730c(%rip), %eax    # 0x7a5c66
cmpl $0xab, %eax
je 0x5e988
cmpl $0xaa, %eax
jne 0x5e936
cmpl $0x0, 0x84ef9(%rip)     # 0xe3868
movl 0x4(%rsp), %eax
movl 0x7471ab(%rip), %ecx    # 0x7a5b24
je 0x5ea64
cmpl %ecx, %eax
je 0x5e936
jmp 0x5ec76
cmpl $0x0, 0x84ed9(%rip)     # 0xe3868
je 0x5eab7
movl 0x747189(%rip), %ecx    # 0x7a5b24
movzbl 0x7472c5(%rip), %eax    # 0x7a5c67
cmpl %eax, %ecx
jne 0x5ea1f
movzbl 0x7472bb(%rip), %eax    # 0x7a5c68
cmpl %eax, 0x747179(%rip)    # 0x7a5b2c
jne 0x5ea1f
movl 0x4(%rsp), %eax
cmpl %eax, %ecx
je 0x5ea0a
cltq
movq %rax, %rdi
shlq $0x7, %rdi
leaq 0x746783(%rip), %rcx    # 0x7a5150
addq %rcx, %rdi
movl $0x10, %ecx
leaq 0x7470b4(%rip), %rsi    # 0x7a5a90
rep  movsq (%rsi), %es:(%rdi)
movl 0x74712b(%rip), %ecx    # 0x7a5b10
leaq 0x746f64(%rip), %rdx    # 0x7a5950
movl %ecx, (%rdx,%rax,4)
movq %rax, %rcx
shlq $0x4, %rcx
movdqu 0x747116(%rip), %xmm0   # 0x7a5b14
leaq 0x746f8b(%rip), %rdx    # 0x7a5990
movdqu %xmm0, (%rcx,%rdx)
movl 0x747174(%rip), %ecx    # 0x7a5b84
leaq 0x747179(%rip), %rdx    # 0x7a5b90
movl %ecx, (%rdx,%rax,4)
jmp 0x5e936
cmpb $0x0, 0xb573fa(%rip)    # 0xbb5e20
jne 0x5ea58
leaq 0x747061(%rip), %rdi    # 0x7a5a90
callq 0x5e315
movl 0x4(%rsp), %edx
movzbl 0x747228(%rip), %ecx    # 0x7a5c67
movzbl 0x747221(%rip), %r8d    # 0x7a5c68
leaq 0x483d5(%rip), %rdi     # 0xa6e23
movq %rax, %rsi
xorl %eax, %eax
callq 0x372d1
movb $0x1, 0xb573c1(%rip)    # 0xbb5e20
jmp 0x5e936
cmpl %ecx, %eax
jne 0x5ec76
cmpl 0x7470be(%rip), %ecx    # 0x7a5b30
jne 0x5ec76
movslq 0x7470ad(%rip), %rcx    # 0x7a5b2c
movl $0x1, %edx
cmpq $0x2, %rcx
jl 0x5eaae
movl $0x1, %edx
leaq 0x74673a(%rip), %rsi    # 0x7a51d0
cmpw $0x0, (%rsi)
je 0x5ec6e
incq %rdx
subq $-0x80, %rsi
cmpq %rdx, %rcx
jne 0x5ea96
movl %ecx, %edx
movl %edx, 0x4(%rsp)
jmp 0x5e936
movzbl 0x7471a9(%rip), %eax    # 0x7a5c67
movzbl 0x7471a3(%rip), %ecx    # 0x7a5c68
cmpb %cl, %al
setae %dl
cmpb $0x10, %cl
setae %sil
orb %dl, %sil
jne 0x5e936
movl 0x4(%rsp), %edx
cmpl 0x74704c(%rip), %edx    # 0x7a5b30
jne 0x5e936
cmpl %eax, 0x747034(%rip)    # 0x7a5b24
jne 0x5eafe
cmpl %ecx, 0x747034(%rip)    # 0x7a5b2c
je 0x5ebe3
movl %eax, 0x747020(%rip)    # 0x7a5b24
movl %ecx, 0x747022(%rip)    # 0x7a5b2c
movl $0x0, 0x74701c(%rip)    # 0x7a5b30
cmpb $0x2, %cl
movdqa 0x31821(%rip), %xmm4    # 0x90340
pcmpeqd %xmm5, %xmm5
movdqa 0x31325(%rip), %xmm6    # 0x8fe50
jb 0x5ebd2
leal -0x1(%rcx), %edx
movl %edx, %edx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movl %ecx, %edx
shrb %dl
movzbl %dl, %edx
andl $0x7, %edx
shll $0x3, %edx
pxor %xmm4, %xmm0
xorl %esi, %esi
movdqa 0x312c2(%rip), %xmm1    # 0x8fe20
movdqa %xmm1, %xmm2
pxor %xmm4, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm0, %xmm3
pcmpeqd %xmm0, %xmm2
pshufd $0xf5, %xmm2, %xmm2     # xmm2 = xmm2[1,1,3,3]
pand %xmm3, %xmm2
pshufd $0xf5, %xmm3, %xmm3     # xmm3 = xmm3[1,1,3,3]
por %xmm2, %xmm3
movdqa %xmm1, %xmm2
psubq %xmm5, %xmm2
movd %xmm3, %edi
notl %edi
testb $0x1, %dil
je 0x5eba4
leaq 0x746fa1(%rip), %rdi    # 0x7a5b40
movd %xmm2, (%rsi,%rdi)
pxor %xmm5, %xmm3
pextrw $0x4, %xmm3, %edi
testb $0x1, %dil
je 0x5ebc5
pshufd $0xee, %xmm2, %xmm2     # xmm2 = xmm2[2,3,2,3]
leaq 0x746f81(%rip), %rdi    # 0x7a5b40
movd %xmm2, 0x4(%rsi,%rdi)
paddq %xmm6, %xmm1
addq $0x8, %rsi
cmpq %rsi, %rdx
jne 0x5eb5e
leaq 0x746f67(%rip), %rdx    # 0x7a5b40
movl $0xffffffff, -0x4(%rdx,%rcx,4) # imm = 0xFFFFFFFF
xorl %edx, %edx
cmpl $0x0, 0x746f96(%rip)    # 0x7a5b80
setne %cl
cmpb $0x0, 0x747075(%rip)    # 0x7a5c69
setne %sil
orb %cl, %sil
movzbl %sil, %ecx
movl %ecx, 0x746f7b(%rip)    # 0x7a5b80
movslq %edx, %r8
cmpl %eax, %edx
je 0x5ec58
movq %r8, %rdi
shlq $0x7, %rdi
leaq 0x746536(%rip), %rax    # 0x7a5150
addq %rax, %rdi
movl $0x10, %ecx
leaq 0x746e67(%rip), %rsi    # 0x7a5a90
rep  movsq (%rsi), %es:(%rdi)
movl 0x746ede(%rip), %eax    # 0x7a5b10
leaq 0x746d17(%rip), %rcx    # 0x7a5950
movl %eax, (%rcx,%r8,4)
movq %r8, %rax
shlq $0x4, %rax
movdqu 0x746ec8(%rip), %xmm0   # 0x7a5b14
leaq 0x746d3d(%rip), %rcx    # 0x7a5990
movdqu %xmm0, (%rax,%rcx)
movl 0x746f26(%rip), %eax    # 0x7a5b84
leaq 0x746f2b(%rip), %rcx    # 0x7a5b90
movl %eax, (%rcx,%r8,4)
jmp 0x5e936
movl %edx, 0x4(%rsp)
movl %eax, %ecx
movl %edx, %eax
testl %eax, %eax
js 0x5e936
movl %eax, %edx
cmpl %eax, %ecx
je 0x5eccf
movq %rdx, %rdi
shlq $0x7, %rdi
leaq 0x7464be(%rip), %rcx    # 0x7a5150
addq %rcx, %rdi
movl $0x10, %ecx
leaq 0x746def(%rip), %rsi    # 0x7a5a90
rep  movsq (%rsi), %es:(%rdi)
movl 0x746e66(%rip), %ecx    # 0x7a5b10
leaq 0x746c9f(%rip), %rsi    # 0x7a5950
movl %ecx, (%rsi,%rdx,4)
movq %rdx, %rcx
shlq $0x4, %rcx
movdqu 0x746e51(%rip), %xmm0   # 0x7a5b14
leaq 0x746cc6(%rip), %rsi    # 0x7a5990
movdqu %xmm0, (%rcx,%rsi)
movl 0x746eaf(%rip), %ecx    # 0x7a5b84
leaq 0x746eb4(%rip), %rsi    # 0x7a5b90
movl %ecx, (%rsi,%rdx,4)
movl $0xffffffff, 0x746f79(%rip) # imm = 0xFFFFFFFF
movb $-0x55, 0x746f76(%rip)  # 0x7a5c66
movb %al, 0x746f71(%rip)     # 0x7a5c67
movb 0x746e30(%rip), %cl     # 0x7a5b2c
movb %cl, 0x746f66(%rip)     # 0x7a5c68
movb 0x746e78(%rip), %cl     # 0x7a5b80
movb %cl, 0x746f5b(%rip)     # 0x7a5c69
movw $0xa, 0x746f49(%rip)    # 0x7a5c60
xorl %edx, %edx
movl $0xb, %ecx
movzbl %dh, %esi
shll $0x8, %edx
movzwl %dx, %edx
movzbl -0x2(%rcx,%r12), %edi
xorl %esi, %edi
xorl (%r14,%rdi,4), %edx
decq %rcx
cmpq $0x1, %rcx
ja 0x5ed1e
movw %dx, 0x746f27(%rip)     # 0x7a5c6a
movl %eax, %edi
movq %r12, %rsi
movl $0xc, %edx
callq 0x5d727
jmp 0x5e936
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5edc9
movl 0x746dc9(%rip), %ebx    # 0x7a5b30
testl %ebx, %ebx
js 0x5edc9
movl 0x746db3(%rip), %eax    # 0x7a5b24
cmpl $0x0, 0x84af0(%rip)     # 0xe3868
setne %dl
cmpl %ebx, %eax
sete %cl
orb %dl, %cl
leaq 0x746fd7(%rip), %r14    # 0x7a5d60
leaq 0x747010(%rip), %rdx    # 0x7a5da0
leaq 0x746da9(%rip), %r10    # 0x7a5b40
movl %ebx, %r15d
cmpl %eax, %ebx
je 0x5edbd
movl (%r14,%r15,4), %ebp
movl %ebp, %esi
andl $0x1ff, %esi            # imm = 0x1FF
movq %r15, %r9
shlq $0xb, %r9
addq %rdx, %r9
movslq (%r9,%rsi,4), %r8
testq %r8, %r8
jne 0x5edde
testb %cl, %cl
je 0x5edc9
movl (%r10,%r15,4), %ebx
testl %ebx, %ebx
jns 0x5ed97
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r9,%rsi,4), %r12
leaq 0x757037(%rip), %rax    # 0x7b5e20
leaq (%r8,%rax), %rsi
addq $0x2, %rsi
movswq -0x2(%rsi), %r13
movq %r13, %rdx
callq 0x80e0
movq 0x8(%rsp), %rcx
movl %ebx, (%rcx)
movl $0x0, (%r12)
incl %ebp
movl %ebp, (%r14,%r15,4)
jmp 0x5edcc