// File: probonopd[P]decodeir/DecodeIR.cpp
// Function: Signal::trySejin()
void Signal::trySejin()  // GD 2009  Added trySejin
// PID = 0161 (0161:3 for Sejin-1, 0161:5 for both Sejin-1 and Sejin-2 in one upgrade.)
//
// The Sejin protocols have two signal styles, Sejin-1 and Sejin-2, and two frequency 
// variants, 38 and 56.  The signal styles have the following common structure:
//
// Sejin-M-38	{38.8k,310,msb}<-1|1>(<8:4|4:4|2:4|1:4>(3,3:2,Dx:8,Fx:8,Fy:8,E:4,C:4,-L))+
// Sejin-M-56	{56.3k,310,msb}<-1|1>(<8:4|4:4|2:4|1:4>(3,3:2,Dx:8,Fx:8,Fy:8,E:4,C:4,-L))+
//
// where E is a checksum seed (0 in all known examples) and C is the checksum given by
// C = (Dx:4 + Dx:4:4 + Fx:4 + Fx:4:4 + Fy:4 + Fy:4:4 + E) & 15.
//
// Dx is a signed 8-bit integer, ie range -128 to +127. If Dx >= 0 the style is Sejin-1 and 
// the leadout time L is 77m.  This style is used for normal remote-control buttons.  If
// Dx < 0 the style is Sejin-2 and the leadout time L is the much shorter 3.6m.  This style is
// used for signals corresponding to a pointing device with up to 3 buttons.  The short
// leadout allows for much faster repeat action.  The signal parameters Dx, Fx, Fy have 
// different significance in the two styles.
//
// The data parameters in Sejin-1 are 7-bit device and subdevice codes D and S, an 8-bit
// function code F and a toggle bit T.  The signal repeats as long as the key is held, with
// T=0 for all frames except the last, T=1 for the last frame.  The corresponding signal
// parameters are:
//             Dx = D, Fx:1:7 = T, Fx:7 = S, Fy = F.
//
// Sejin-2 has a 5-bit device code D and no subdevice code.  It further divides into 
// two sub-styles, 2A corresponding to movement of the pointing device, and
// 2B corresponding to movement of its buttons.  In Sejin-2A the data parameters are the
// coordinates (X,Y) of the displacement of a cursor and the signal parameters are
//             Dx:6:2 = (-D):6,  Dx:2 = 0, Fx = X:8, Fy = Y:8.
// Note that X and Y can be negative, so Fx and Fy are signed 8-bit integers.  The signal
// repeats indefinitely.
//
// Sejin-2B corresponds to down and up movements of the buttons of the pointing device.
// A "down" signal is sent exactly once on button down (distinct for each button) and an
// "up" signal is sent exactly once on button up (same for each button).  There is one
// data parameter, B.  When B = 1,2 or 3 it denotes button B down, when B = 0 it denotes
// button up.  The signal parameters are
//             Dx:6:2 = (-D):6,  Dx:2 = B:2, Fx = 0, Fy = 0.
//
// The 0161:5 protocol can only generate signals in which one of Fx or Fy is zero.  It
// uses (-D)*4 as a device byte and has two function bytes.  The first is the nonzero
// one of Fx and Fy (or 0 if both are 0).  The second has B in bits 0 and 1 (0 for
// Sejin-2A), bit 4 is set for Sejin-2A and clear for Sejin-2B and bit 3 flags which of
// X or Y is nonzero in Sejin-2A (set for X, clear for Y).
//
// The Misc field includes a 13-byte integer RMOBC which is these two bytes in decimal
// form.  It can be entered in RemoteMaster into the RMOBC column of the function page
// for the Sejin-M-N protocol.

{
	if ( nFrameL < 15 || nTotDur < 18000 || nTotDur > 26000) return;

	const float unit = 310.;
	static int FC = 0;					// count of bypassed frames

	if (	!framed(10 * unit)			// must allow for 3.6ms leadout for Sejin type 2
		||	sortOn.max2 > 2.4 * unit
		||	sortOn.min1 < 0.5 * unit )
	{
		return;
	}

	// Next condition added in v2.40 as a specific JVC{2} signal was giving spurious Sejin decode.
	if (	pFrame[0] < 700 || pFrame[0] > 1150		// nominal 930, allow 25% either way
		||	pFrame[1] < 700 || pFrame[1] > 1150 )	// nominal 930, allow 25% either way
	{
		return;
	}

	cleanup();
	pBit++;			// skip initial 3-unit ON
	int bcnt = 0;	// bit count (outer, <-1|1>, coding) to start of next OFF
	int dbit;		// double bit (inner coding)
	while (pBit < pFrameEnd)
	{
		bcnt += (int)( (pBit[0] + pBit[1]) / unit + 0.5 );	// advance to start of following OFF
		pBit += 2;
		while (bcnt > 2 * nBit)
		{
			dbit = min( bcnt - 2 * nBit - 1, 3 );		// make next double bit
			cBits[nBit>>3] |= dbit << (6 - (nBit & 6));	// add to cBits in msb form
			nBit += 2;
		}
	}
	if (	nBit != 34											// number of bits
		||	getMsb(0,2) != 3									// initial double bit
		||	getMsb(30,4) != ( getMsb(2,4) + getMsb(6,4) + getMsb(10,4) + 
				getMsb(14,4) + getMsb(18,4) + getMsb(22,4) + getMsb(26,4) ) % 16	// checksum
		||	!getMsb(2,1) && !framed(100*unit) )	// long leadout for Sejin type 1
	{
		return;
	}

	// look to see if there is a following frame
	float* pFrameEnd2 = pFrameEnd + 1;
	for ( ; pFrameEnd2 < pMainLimit; pFrameEnd2++ )
	{
		if ( *pFrameEnd2 > 10 * unit ) break;
	};
	pBit += 2;
	bcnt = 2 * nBit;
	while (pBit < pFrameEnd2)
	{
		bcnt += (int)( (pBit[0] + pBit[1]) / unit + 0.5 );	// advance to start of following OFF
		pBit += 2;
		while (bcnt > 2 * nBit)
		{
			dbit = min( bcnt - 2 * nBit - 1, 3 );		// make next double bit
			cBits[nBit>>3] |= dbit << (6 - (nBit & 6));	// add to cBits in msb form
			nBit += 2;
		}
	}

	if (	nBit == 68
		&&	getMsb(0,10) == getMsb(34,10)
		&&	(getMsb(2,1) || getMsb(10,1) == 0)		// if type 1 then T=0 except for last frame
		&&	(!getMsb(2,1) || getMsb(10,1) == getMsb(44,1)) // if type 2 then no toggle
		&&	getMsb(11,19) == getMsb(45,19)
		&&	getMsb(31,3) == getMsb(65,3)
		&&  ( getMsb(30,1)^getMsb(64,1) ) == ( getMsb(10,1)^getMsb(44,1) )  // chksum affected by toggle
		&&  (getMsb(36,1) || (*pFrameEnd2 >= 100 * unit) ) )  // either type 2 or long leadout
	{
		if ( FC == 0 ) setzContext();			// save the context value
		FC++;	// increment count of bypassed frames
		return;	// another frame follows, so wait for it to come round
	}

	if ( !getMsb(2,1) )		// type 1
	{
		*pDevice = getMsb(2,8);
		*pSubDevice = getMsb(11,7);
		*pOBC = getMsb(18,8);
		pHex[0] = *pOBC;
		strcpy(pProtocol, nFreq < 45000 ? "Sejin-1-38" : "Sejin-1-56");
		sprintf(pMisc, getMsb(10,1) ? "E=%d" : "E=%d, no end frame", getMsb(26,4));
	}
	else				// type 2
	{	
		// RMOBC is the decimal form of the 2-byte hex function code needed in RemoteMaster
		// with protocol 0161:5 to generate the signal concerned

		int X = getMsb(10,1) ? getMsb(10,8)-256 : getMsb(10,8); // X coord of delta
		int Y = getMsb(18,1) ? getMsb(18,8)-256 : getMsb(18,8); // Y coord of delta
		int Fn1 = getMsb(10,8) ? getMsb(10,8) : getMsb(18,8);	// 1st function byte
		int Fn2 = getMsb(8,2);									// 2nd function byte
		*pDevice = (64-getMsb(2,6));
		*pOBC = Fn2;
		Fn2 += getMsb(10,8) ? 0x08 : 0;		// flag set if X coord, clear if Y coord
		Fn2 += Fn1 ? 0x10 : 0;				// flag set if delta, clear if button down/up 
		strcpy(pProtocol, nFreq < 45000 ? "Sejin-2-38" : "Sejin-2-56");
		if ( X == 0 && Y == 0 && *pOBC == 0 )
		{
			sprintf(pMisc, "Btn up; E=%d, RMOBC=%d", getMsb(26,4), Fn1 + 0x100*Fn2);
		}
		else if ( X == 0 && Y == 0 )
		{
			sprintf(pMisc, "Btn down (OBC=Btn nbr); E=%d, RMOBC=%d", getMsb(26,4), Fn1 + 0x100*Fn2);
		}
		else if ( X == 0 || Y == 0 )
		{
			sprintf(pMisc, "delta = (%d,%d); E=%d, RMOBC=%d", X, Y, getMsb(26,4), Fn1 + 0x100*Fn2);
		}
		else
		{
			sprintf(pMisc, "delta = (%d,%d); E=%d, RMOBC unsupported", X, Y, getMsb(26,4) );
		}
	}
	nFrameCount = FC;
	FC = 0;		// reset static variable
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0xf, 0x48(%rax)
jl 0x6fab
movq -0x48(%rbp), %rax
movss 0x130ab(%rip), %xmm0    # 0x1a034
ucomiss 0x98(%rax), %xmm0
ja 0x6fab
movq -0x48(%rbp), %rax
movss 0x98(%rax), %xmm0
movss 0x13092(%rip), %xmm1    # 0x1a038
ucomiss %xmm1, %xmm0
jbe 0x6fb0
jmp 0x7ae6
movq -0x48(%rbp), %rdi
movss 0x13084(%rip), %xmm0    # 0x1a040
movss %xmm0, -0xc(%rbp)
movss 0x13073(%rip), %xmm0    # 0x1a03c
callq 0x18840
cmpl $0x0, %eax
je 0x700f
movq -0x48(%rbp), %rax
movss 0x188(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x132b5(%rip), %xmm1    # 0x1a2a0
ucomisd %xmm1, %xmm0
ja 0x700f
movq -0x48(%rbp), %rax
movss 0x180(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1329f(%rip), %xmm0    # 0x1a2a8
ucomisd %xmm1, %xmm0
jbe 0x7014
jmp 0x7ae6
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movss 0x13020(%rip), %xmm0    # 0x1a044
ucomiss (%rax), %xmm0
ja 0x7072
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movss (%rax), %xmm0
movss 0x1300b(%rip), %xmm1    # 0x1a048
ucomiss %xmm1, %xmm0
ja 0x7072
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movss 0x12ff2(%rip), %xmm0    # 0x1a044
ucomiss 0x4(%rax), %xmm0
ja 0x7072
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movss 0x4(%rax), %xmm0
movss 0x12fdb(%rip), %xmm1    # 0x1a048
ucomiss %xmm1, %xmm0
jbe 0x7077
jmp 0x7ae6
movq -0x48(%rbp), %rdi
callq 0x16180
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0xc8(%rax)
movl $0x0, -0x10(%rbp)
movq -0x48(%rbp), %rcx
movq 0xc8(%rcx), %rax
cmpq 0x40(%rcx), %rax
jae 0x719a
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rcx
movss (%rcx), %xmm0
movq 0xc8(%rax), %rcx
addss 0x4(%rcx), %xmm0
movss 0x12f6b(%rip), %xmm1    # 0x1a040
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x130db(%rip), %xmm1    # 0x1a1c0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
addl -0x10(%rbp), %ecx
movl %ecx, -0x10(%rbp)
movq 0xc8(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0xc8(%rax)
movq -0x48(%rbp), %rcx
movl -0x10(%rbp), %eax
movl 0xc0(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jle 0x7195
movq -0x48(%rbp), %rcx
movl -0x10(%rbp), %eax
movl 0xc0(%rcx), %ecx
shll %ecx
subl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movl $0x3, -0x1c(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x18a80
movq %rax, %rcx
movq -0x48(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x14(%rbp)
movl -0x14(%rbp), %esi
movl 0xc0(%rax), %edx
andl $0x6, %edx
movl $0x6, %ecx
subl %edx, %ecx
shll %cl, %esi
movl 0xc0(%rax), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl 0xa0(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0xa0(%rax,%rcx)
movl 0xc0(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0xc0(%rax)
jmp 0x7105
jmp 0x709d
movq -0x48(%rbp), %rax
cmpl $0x22, 0xc0(%rax)
jne 0x72d3
movq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x15f50
cmpl $0x3, %eax
jne 0x72d3
movq -0x48(%rbp), %rdi
movl $0x1e, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x4c(%rbp)
movl $0x2, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x64(%rbp)
movl $0x6, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x64(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x60(%rbp)
movl $0xa, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x60(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl $0xe, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x5c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movl $0x12, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x58(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x54(%rbp)
movl $0x16, %esi
movl $0x4, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x54(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x50(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movl -0x50(%rbp), %ecx
movl %eax, %edx
movl -0x4c(%rbp), %eax
addl %edx, %ecx
andl $0xf, %ecx
cmpl %ecx, %eax
jne 0x72d3
movq -0x48(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
jne 0x72d8
movq -0x48(%rbp), %rdi
movss 0x12d83(%rip), %xmm0    # 0x1a04c
callq 0x18840
cmpl $0x0, %eax
jne 0x72d8
jmp 0x7ae6
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x731d
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
movss 0x12d36(%rip), %xmm1    # 0x1a03c
ucomiss %xmm1, %xmm0
jbe 0x730d
jmp 0x731d
jmp 0x730f
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x72e8
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0xc8(%rax)
movl 0xc0(%rax), %eax
shll %eax
movl %eax, -0x10(%rbp)
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rax
cmpq -0x28(%rbp), %rax
jae 0x743b
movq -0x48(%rbp), %rax
movq 0xc8(%rax), %rcx
movss (%rcx), %xmm0
movq 0xc8(%rax), %rcx
addss 0x4(%rcx), %xmm0
movss 0x12cca(%rip), %xmm1    # 0x1a040
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x12e3a(%rip), %xmm1    # 0x1a1c0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
addl -0x10(%rbp), %ecx
movl %ecx, -0x10(%rbp)
movq 0xc8(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0xc8(%rax)
movq -0x48(%rbp), %rcx
movl -0x10(%rbp), %eax
movl 0xc0(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jle 0x7436
movq -0x48(%rbp), %rcx
movl -0x10(%rbp), %eax
movl 0xc0(%rcx), %ecx
shll %ecx
subl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x3, -0x30(%rbp)
leaq -0x2c(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x18a80
movq %rax, %rcx
movq -0x48(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x14(%rbp)
movl -0x14(%rbp), %esi
movl 0xc0(%rax), %edx
andl $0x6, %edx
movl $0x6, %ecx
subl %edx, %ecx
shll %cl, %esi
movl 0xc0(%rax), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl 0xa0(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0xa0(%rax,%rcx)
movl 0xc0(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0xc0(%rax)
jmp 0x73a6
jmp 0x733e
movq -0x48(%rbp), %rax
cmpl $0x44, 0xc0(%rax)
jne 0x762a
movq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x68(%rbp)
movl $0x22, %esi
movl $0xa, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x68(%rbp), %eax
cmpl %ecx, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
jne 0x74b3
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
je 0x7501
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x1, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x6c(%rbp)
movl $0x2c, %esi
movl $0x1, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0xb, %esi
movl $0x13, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x70(%rbp)
movl $0x2d, %esi
movl $0x13, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0x1f, %esi
movl $0x3, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x74(%rbp)
movl $0x41, %esi
movl $0x3, %edx
callq 0x15f50
movl %eax, %ecx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0x1e, %esi
movl $0x1, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x80(%rbp)
movl $0x40, %esi
movl $0x1, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movl -0x80(%rbp), %eax
xorl %ecx, %eax
movl %eax, -0x78(%rbp)
movl $0xa, %esi
movl $0x1, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x7c(%rbp)
movl $0x2c, %esi
movl $0x1, %edx
callq 0x15f50
movl -0x7c(%rbp), %ecx
movl %eax, %edx
movl -0x78(%rbp), %eax
xorl %edx, %ecx
cmpl %ecx, %eax
jne 0x762a
movq -0x48(%rbp), %rdi
movl $0x24, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
jne 0x7604
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
movss 0x12a4d(%rip), %xmm1    # 0x1a04c
ucomiss %xmm1, %xmm0
jb 0x762a
cmpl $0x0, 0x17d01(%rip)     # 0x1f30c
jne 0x7616
movq -0x48(%rbp), %rdi
callq 0x2860
movl 0x17cf0(%rip), %eax     # 0x1f30c
addl $0x1, %eax
movl %eax, 0x17ce7(%rip)     # 0x1f30c
jmp 0x7ae6
movq -0x48(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
jne 0x776e
movq -0x48(%rbp), %rdi
movl $0x2, %esi
movl $0x8, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movl $0xb, %esi
movl $0x7, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %ecx
movq 0x168(%rdi), %rax
movl %ecx, (%rax)
movl $0x12, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, %edx
movq -0x48(%rbp), %rax
movq 0x170(%rax), %rcx
movl %edx, (%rcx)
movq 0x170(%rax), %rcx
movl (%rcx), %edx
movq 0x178(%rax), %rcx
movl %edx, (%rcx)
movq 0x148(%rax), %rcx
movq %rcx, -0x88(%rbp)
cmpl $0xafc8, 0x2c(%rax)     # imm = 0xAFC8
jge 0x76dd
leaq 0x137f7(%rip), %rax     # 0x1aecb
movq %rax, -0x90(%rbp)
jmp 0x76ed
leaq 0x137f2(%rip), %rax     # 0x1aed6
movq %rax, -0x90(%rbp)
jmp 0x76ed
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x2120
movq -0x48(%rbp), %rdi
movq 0x150(%rdi), %rax
movq %rax, -0xa0(%rbp)
movl $0xa, %esi
movl $0x1, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, %edx
leaq 0x137b3(%rip), %rax     # 0x1aee1
leaq 0x13680(%rip), %rcx     # 0x1adb5
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x98(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movl %eax, %edx
movb $0x0, %al
callq 0x2060
jmp 0x7acf
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
je 0x77a6
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x8, %edx
callq 0x15f50
subl $0x100, %eax            # imm = 0x100
movl %eax, -0xa4(%rbp)
jmp 0x77bf
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, -0xa4(%rbp)
movq -0x48(%rbp), %rdi
movl -0xa4(%rbp), %eax
movl %eax, -0x34(%rbp)
movl $0x12, %esi
movl $0x1, %edx
callq 0x15f50
cmpl $0x0, %eax
je 0x7800
movq -0x48(%rbp), %rdi
movl $0x12, %esi
movl $0x8, %edx
callq 0x15f50
subl $0x100, %eax            # imm = 0x100
movl %eax, -0xa8(%rbp)
jmp 0x7819
movq -0x48(%rbp), %rdi
movl $0x12, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, -0xa8(%rbp)
movq -0x48(%rbp), %rdi
movl -0xa8(%rbp), %eax
movl %eax, -0x38(%rbp)
movl $0xa, %esi
movl $0x8, %edx
callq 0x15f50
cmpl $0x0, %eax
je 0x7855
movq -0x48(%rbp), %rdi
movl $0xa, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, -0xac(%rbp)
jmp 0x786e
movq -0x48(%rbp), %rdi
movl $0x12, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, -0xac(%rbp)
movq -0x48(%rbp), %rdi
movl -0xac(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x8, %esi
movl $0x2, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl %eax, -0x40(%rbp)
movl $0x2, %esi
movl $0x6, %edx
callq 0x15f50
movq -0x48(%rbp), %rdi
movl $0x40, %ecx
subl %eax, %ecx
movq 0x160(%rdi), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq 0x170(%rdi), %rax
movl %ecx, (%rax)
movl $0xa, %esi
movl $0x8, %edx
callq 0x15f50
movl %eax, %esi
movq -0x48(%rbp), %rax
xorl %ecx, %ecx
movl $0x8, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl -0x40(%rbp), %ecx
movl %ecx, -0x40(%rbp)
movl -0x3c(%rbp), %esi
xorl %ecx, %ecx
movl $0x10, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl -0x40(%rbp), %ecx
movl %ecx, -0x40(%rbp)
movq 0x148(%rax), %rcx
movq %rcx, -0xb8(%rbp)
cmpl $0xafc8, 0x2c(%rax)     # imm = 0xAFC8
jge 0x7925
leaq 0x135d8(%rip), %rax     # 0x1aef4
movq %rax, -0xc0(%rbp)
jmp 0x7935
leaq 0x135d3(%rip), %rax     # 0x1aeff
movq %rax, -0xc0(%rbp)
jmp 0x7935
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x2120
cmpl $0x0, -0x34(%rbp)
jne 0x79ac
cmpl $0x0, -0x38(%rbp)
jne 0x79ac
movq -0x48(%rbp), %rax
movq 0x170(%rax), %rax
cmpl $0x0, (%rax)
jne 0x79ac
movq -0x48(%rbp), %rdi
movq 0x150(%rdi), %rax
movq %rax, -0xc8(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movq -0xc8(%rbp), %rdi
movl %eax, %edx
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %eax
shll $0x8, %eax
addl %eax, %ecx
leaq 0x1356a(%rip), %rsi     # 0x1af0a
movb $0x0, %al
callq 0x2060
jmp 0x7acd
cmpl $0x0, -0x34(%rbp)
jne 0x7a00
cmpl $0x0, -0x38(%rbp)
jne 0x7a00
movq -0x48(%rbp), %rdi
movq 0x150(%rdi), %rax
movq %rax, -0xd0(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movq -0xd0(%rbp), %rdi
movl %eax, %edx
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %eax
shll $0x8, %eax
addl %eax, %ecx
leaq 0x1352d(%rip), %rsi     # 0x1af21
movb $0x0, %al
callq 0x2060
jmp 0x7acb
cmpl $0x0, -0x34(%rbp)
je 0x7a0c
cmpl $0x0, -0x38(%rbp)
jne 0x7a72
movq -0x48(%rbp), %rdi
movq 0x150(%rdi), %rax
movq %rax, -0xe0(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0xd8(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movq -0xe0(%rbp), %rdi
movl -0xd8(%rbp), %edx
movl -0xd4(%rbp), %ecx
movl %eax, %r8d
movl -0x3c(%rbp), %r9d
movl -0x40(%rbp), %eax
shll $0x8, %eax
addl %eax, %r9d
leaq 0x134df(%rip), %rsi     # 0x1af48
movb $0x0, %al
callq 0x2060
jmp 0x7ac9
movq -0x48(%rbp), %rdi
movq 0x150(%rdi), %rax
movq %rax, -0xf0(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0xe8(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0xe4(%rbp)
movl $0x1a, %esi
movl $0x4, %edx
callq 0x15f50
movq -0xf0(%rbp), %rdi
movl -0xe8(%rbp), %edx
movl -0xe4(%rbp), %ecx
movl %eax, %r8d
leaq 0x134a6(%rip), %rsi     # 0x1af68
movb $0x0, %al
callq 0x2060
jmp 0x7acb
jmp 0x7acd
jmp 0x7acf
movq -0x48(%rbp), %rax
movl 0x17833(%rip), %ecx     # 0x1f30c
movl %ecx, 0x60(%rax)
movl $0x0, 0x17826(%rip)     # 0x1f30c
addq $0xf0, %rsp
popq %rbp
retq
nop