// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/misc/codecs.cpp
// Function: PCIIO::WriteLine(smooth::IO::OutStream*, int)
bool PCIIO::WriteLine(PCIOut out, int y)
{
	/* Check compression type.
	 */
	if (compression != PCI	 &&
	    compression != RLE	 &&
	    compression != BZIP2 &&
	    compression != UNCOMPRESSED) return false;

	/* Write image line.
	 */
	int	*line = new int [sizex];
	int	 ctsize;
	int	 maxpalentries;

	switch (colorspace)
	{
		case Color::RGB:
		case Color::YUV:
		case Color::HSV:
		case Color::CMY:
			ctsize = 3;
			maxpalentries = 338;

			break;
		case Color::CMYK:
			ctsize = 4;
			maxpalentries = 338;

			break;
		case Color::GRAY:
			ctsize = 1;
			maxpalentries = 338;

			break;
		default:
			ctsize = 3;
			maxpalentries = 338;

			break;
	}

	for (int x = 0; x < sizex; x++) line[x] = Color(bmp.GetPixel(Point(x, y))).ConvertTo(colorspace).Downsample(bpcc);

	switch (compression)
	{
		case BZIP2:
		case UNCOMPRESSED:
			for (int x = 0; x < sizex; x++) out->OutputBits(line[x], ctsize * bpcc);

			break;
		case RLE:
			for (int x = 0; x < sizex; x++)
			{
				int	 rle = GetRLE(line, sizex, x, rlebits);

				out->OutputBits(line[x], ctsize * bpcc);
				out->OutputBits(rle, rlebits);

				x += rle;
			}

			break;
		case PCI:
			if (GetSLAL(line, previousLine, sizex))
			{
				out->OutputBits(1, 1);
			}
			else
			{
				out->OutputBits(0, 1);

				ProbeComp(0, sizex, line, previousLine, sizex, ctsize, false, bits, bitssaa);
				ProbeComp(0, sizex, line, previousLine, sizex, ctsize, true, bitsnrle, bitssaanrle);

				int	 dorle = 0;
				int	 dosaa = 0;

				if (bitssaa < bits)
				{
					out->OutputBits(1, 1);
					dosaa = 1;

					if (bitssaa < bitssaanrle)
					{
						out->OutputBits(1, 1);
						dorle = 1;
					}
					else
					{
						out->OutputBits(0, 1);
						dorle = 0;
					}
				}
				else
				{
					out->OutputBits(0, 1);
					dosaa = 0;

					if (bits < bitsnrle)
					{
						out->OutputBits(1, 1);
						dorle = 1;
					}
					else
					{
						out->OutputBits(0, 1);
						dorle = 0;
					}
				}

				int	 allinpal = 0;
				int	 gallinpal = 0;
				int	 mod04 = 0;
				int	 mod16 = 0;

				for (int x = 0; x < sizex; x++)
				{
					int	 previousColor = (x > 0 ? line[x - 1] : 0);

					if ((x % 16) == mod16)
					{
						gallinpal = 1;

						for (int x2 = 0; x2 < 16; x2++)
						{
							if ((x + x2) < sizex && GetPaletteEntry(line[x + x2]) == -1) { gallinpal = 0; break; }
						}

						if (gallinpal == 1) out->OutputBits(1, 1);
						else		    out->OutputBits(0, 1);
					}

					if (((x % 4) == mod04) && !gallinpal)
					{
						allinpal = 1;

						for (int x2 = 0; x2 < 4; x2++)
						{
							if ((x + x2) < sizex && GetPaletteEntry(line[x + x2]) == -1) { allinpal = 0; break; }
						}

						if (allinpal == 1) out->OutputBits(1, 1);
						else		   out->OutputBits(0, 1);
					}

					if ((GetPaletteEntry(line[x]) == -1))
					{
						out->OutputBits(0, 1);

						if (GetDelta(line, previousLine, x, ctsize))
						{
							out->OutputBits(1, 1);

							CompressDelta(line, previousLine, x, ctsize, out);
						}
						else
						{
							out->OutputBits(0, 1);
							out->OutputBits(line[x], ctsize * bpcc);
						}

						if (palentries < maxpalentries)
						{
							palette[palentries] = line[x];
							palentries++;
						}
						else
						{
							RotatePalette(line[x]);
						}
					}
					else
					{
						if (!allinpal && !gallinpal) out->OutputBits(1, 1);

						if (GetSAA(line, previousLine, x) && dosaa)
						{
							out->OutputBits(1, 1);
						}
						else
						{
							if (dosaa) out->OutputBits(0, 1);

							if ((palentries - 1) - GetPaletteEntry(line[x]) < 2)
							{
								out->OutputBits(1, 1);
								out->OutputBits((palentries - 1) - GetPaletteEntry(line[x]), 1);
							}
							else
							{
								out->OutputBits(0, 1);

								if ((palentries - 1)-GetPaletteEntry(line[x]) < 18)
								{
									int	 lbits = Math::Min(GetMinimumBits(palentries - 2), 4);

									out->OutputBits(1, 1);
									out->OutputBits((palentries - 1) - GetPaletteEntry(line[x]) - 2, lbits);
								}
								else
								{
									out->OutputBits(0, 1);

									if ((palentries - 1) - GetPaletteEntry(line[x]) < 82)
									{
										int	 lbits = Math::Min(GetMinimumBits(palentries - 18), 6);

										out->OutputBits(1, 1);
										out->OutputBits((palentries - 1)-GetPaletteEntry(line[x]) - 18, lbits);
									}
									else
									{
										out->OutputBits(0, 1);
										out->OutputBits((palentries - 1)-GetPaletteEntry(line[x]) - 82, GetMinimumBits(palentries - 83));
									}
								}
							}
						}

						RotatePaletteEntry(GetPaletteEntry(line[x]));
					}

					if (line[x] == previousColor)
					{
						int	 pcirle = GetRLE(line, sizex, x, 8);

						if (pcirle >= 2)
						{
							out->OutputBits(1, 1);

							if (pcirle > 9)
							{
								out->OutputBits(1, 1);
								out->OutputBits(pcirle - 2, 8);
							}
							else
							{
								out->OutputBits(0, 1);
								out->OutputBits(pcirle - 2, 3);
							}

							x = x + pcirle;

							allinpal = 0;
							gallinpal = 0;

							mod04 = (x + 1) %  4;
							mod16 = (x + 1) % 16;
						}
						else
						{
							out->OutputBits(0, 1);
						}
					}
					else if ((line[x] == previousLine[x]) && dorle)
					{
						int	 pcirle = GetVRLE(line, previousLine, sizex, x, 8);

						if (pcirle >= 2)
						{
							out->OutputBits(1, 1);

							if (pcirle > 9)
							{
								out->OutputBits(1, 1);
								out->OutputBits(pcirle - 2, 8);
							}
							else
							{
								out->OutputBits(0, 1);
								out->OutputBits(pcirle - 2, 3);
							}

							x = x + pcirle;

							allinpal = 0;
							gallinpal = 0;

							mod04 = (x + 1) %  4;
							mod16 = (x + 1) % 16;
						}
						else
						{
							out->OutputBits(0, 1);
						}
					}
				}
			}

			for (int x = 0; x < sizex; x++) previousLine[x] = line[x];

			break;
	}

	delete [] line;

	return true;
}

// Assembly:
movl 0x50(%rdi), %ecx
xorl %eax, %eax
cmpl $0x4, %ecx
ja 0xb8303
cmpl $0x2, %ecx
je 0xb8303
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r15
movslq 0x10(%rdi), %rax
leaq (,%rax,4), %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x56670
movq %rax, %r13
movl 0x10(%r15), %eax
movl 0x58(%r15), %ecx
xorl %edx, %edx
cmpl $0x5, %ecx
sete %dl
addl $0x3, %edx
cmpl $0x6, %ecx
movl $0x1, %r14d
cmovnel %edx, %r14d
testl %eax, %eax
movq %r12, (%rsp)
movl %r14d, 0x2c(%rsp)
jle 0xb7a6a
movq %r13, 0x8(%rsp)
leaq 0x8(%r15), %r13
movl %ebx, %r12d
movq %r15, %rbx
xorl %r15d, %r15d
leaq 0x78(%rsp), %rbp
leaq 0x88(%rsp), %r14
movl %r15d, 0x60(%rsp)
movl %r12d, 0x64(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
leaq 0x60(%rsp), %rdx
callq 0x55f30
movl 0x58(%rbx), %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x57d10
movl 0x54(%rbx), %edx
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x57020
movl 0x70(%rsp), %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
incq %r15
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
jl 0xb7a08
movq %rbx, %r15
movq 0x8(%rsp), %r13
movq (%rsp), %r12
movl 0x2c(%rsp), %r14d
movl 0x50(%r15), %ecx
cmpq $0x4, %rcx
ja 0xb82e8
leaq 0x5c0e9(%rip), %rdx     # 0x113b68
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x0, 0x10(%r15)
jle 0xb82e8
xorl %ebx, %ebx
movslq (%r13,%rbx,4), %rsi
movl 0x54(%r15), %edx
imull %r14d, %edx
movq %r12, %rdi
callq 0x57ce0
incq %rbx
movslq 0x10(%r15), %rax
cmpq %rax, %rbx
jl 0xb7a95
jmp 0xb82e8
movl 0x10(%r15), %esi
testl %esi, %esi
jle 0xb82e8
xorl %ebx, %ebx
movl 0x60(%r15), %ecx
movq %r13, %rdi
movl %ebx, %edx
callq 0xb8b49
movl %eax, %ebp
movslq %ebx, %r14
movslq (%r13,%r14,4), %rsi
movl 0x54(%r15), %edx
imull 0x2c(%rsp), %edx
movq %r12, %rdi
callq 0x57ce0
movslq %ebp, %rbx
movl 0x60(%r15), %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x57ce0
addl %r14d, %ebx
incl %ebx
movl 0x10(%r15), %esi
cmpl %esi, %ebx
jl 0xb7ac9
jmp 0xb82e8
testl %eax, %eax
setle %cl
movq %r13, 0x8(%rsp)
jle 0xb7b54
movq 0xbf727(%rip), %rcx     # 0x177250
movl (%r13), %edx
cmpl (%rcx), %edx
jne 0xb7b6f
movl %eax, %eax
movl $0x1, %esi
movq %rsi, %rdx
cmpq %rsi, %rax
je 0xb7b4e
movl (%r13,%rdx,4), %edi
leaq 0x1(%rdx), %rsi
cmpl (%rcx,%rdx,4), %edi
je 0xb7b38
cmpq %rax, %rdx
setae %cl
testb %cl, %cl
je 0xb7b6f
movl $0x1, %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x57ce0
jmp 0xb82bf
movq %r12, %rbp
xorl %r12d, %r12d
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0x10(%r15), %esi
movq 0xbf6c1(%rip), %rcx     # 0x177250
subq $0x8, %rsp
leaq 0xbfcde(%rip), %rax     # 0x177878
leaq 0xbfcd3(%rip), %rbx     # 0x177874
xorl %edi, %edi
movq %r13, %rdx
movl %esi, %r8d
movl %r14d, %r9d
pushq %rax
pushq %rbx
pushq $0x0
callq 0xb8c28
addq $0x20, %rsp
movl 0x10(%r15), %esi
movq 0xbf68c(%rip), %rcx     # 0x177250
subq $0x8, %rsp
movq %r13, %rdx
leaq 0xbfcae(%rip), %r13     # 0x177880
movq %r15, 0x48(%rsp)
leaq 0xbfc9e(%rip), %r15     # 0x17787c
xorl %edi, %edi
movl %esi, %r8d
movl %r14d, %r9d
pushq %r13
pushq %r15
pushq $0x1
callq 0xb8c28
addq $0x20, %rsp
movl 0xbfc7d(%rip), %eax     # 0x177878
movl 0xbfc73(%rip), %ecx     # 0x177874
xorl %esi, %esi
movl %eax, 0x3c(%rsp)
movl %ecx, 0x38(%rsp)
cmpl %ecx, %eax
leaq 0xbfc64(%rip), %rax     # 0x177878
cmovlq %rax, %rbx
cmovlq %r13, %r15
setl %sil
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl (%rbx), %eax
movl (%r15), %ecx
movq 0x40(%rsp), %r15
xorl %esi, %esi
movl %eax, 0x4c(%rsp)
movl %ecx, 0x48(%rsp)
cmpl %ecx, %eax
setl %sil
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0x10(%r15), %eax
testl %eax, %eax
jle 0xb82bf
leaq 0xbf5f9(%rip), %r13     # 0x177260
movl $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
xorl %ebx, %ebx
movl $0x0, 0x14(%rsp)
movl %r12d, %r14d
testl %r12d, %r12d
jle 0xb7c99
movq 0x8(%rsp), %rcx
movl -0x4(%rcx,%r14,4), %ecx
movl %ecx, 0x30(%rsp)
jmp 0xb7ca1
movl $0x0, 0x30(%rsp)
movl %r12d, %ecx
andl $0xf, %ecx
movslq %r12d, %rbp
cmpl 0x28(%rsp), %ecx
jne 0xb7d0b
movl 0xbfbba(%rip), %ecx     # 0x177870
cltq
xorl %edx, %edx
leaq (%rdx,%rbp), %rsi
cmpq %rax, %rsi
jge 0xb7ce4
movq 0x8(%rsp), %rdi
movl (%rdi,%rsi,4), %edi
movq %rcx, %rsi
testl %esi, %esi
jle 0xb7cf9
decq %rsi
movl %esi, %r8d
cmpl %edi, (%r13,%r8,4)
jne 0xb7cce
cmpl $-0x1, %esi
je 0xb7cf9
incq %rdx
cmpq $0x10, %rdx
jne 0xb7cba
movl $0x1, %ebx
movl $0x1, %esi
jmp 0xb7cfd
xorl %esi, %esi
xorl %ebx, %ebx
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl %r12d, %eax
andl $0x3, %eax
xorl 0x24(%rsp), %eax
orl %ebx, %eax
jne 0xb7d7f
movslq 0x10(%r15), %rax
movl 0xbfb4d(%rip), %ecx     # 0x177870
xorl %edx, %edx
leaq (%rdx,%rbp), %rsi
cmpq %rax, %rsi
jge 0xb7d4f
movq 0x8(%rsp), %rdi
movl (%rdi,%rsi,4), %edi
movq %rcx, %rsi
testl %esi, %esi
jle 0xb7d67
decq %rsi
movl %esi, %r8d
cmpl %edi, (%r13,%r8,4)
jne 0xb7d39
cmpl $-0x1, %esi
je 0xb7d67
incq %rdx
cmpq $0x4, %rdx
jne 0xb7d25
movl $0x1, 0x14(%rsp)
movl $0x1, %esi
jmp 0xb7d71
xorl %esi, %esi
movl $0x0, 0x14(%rsp)
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movq 0x8(%rsp), %rax
movl (%rax,%r14,4), %ecx
movl 0xbfae2(%rip), %eax     # 0x177870
testl %eax, %eax
jle 0xb7da7
decq %rax
movl %eax, %edx
cmpl %ecx, (%r13,%rdx,4)
jne 0xb7d8e
cmpl $-0x1, %eax
jne 0xb7e93
movq %r14, %r15
movl %ebx, 0x18(%rsp)
movq (%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movq 0xbf488(%rip), %rsi     # 0x177250
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl %r12d, %edx
movl 0x2c(%rsp), %ebx
movl %ebx, %ecx
callq 0xb91af
testl %eax, %eax
movq %r12, 0x58(%rsp)
je 0xb7e15
movl $0x1, %esi
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movq 0xbf450(%rip), %rsi     # 0x177250
movq %r14, %rdi
movl %r12d, %edx
movl %ebx, %ecx
movq %rbp, %r8
callq 0xb94ca
movq %r15, %r12
jmp 0xb7e3e
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movq %r15, %r12
movslq (%r14,%r15,4), %rsi
movq 0x40(%rsp), %rax
movl 0x54(%rax), %edx
imull %ebx, %edx
movq %rbp, %rdi
callq 0x57ce0
movslq 0xbfa2b(%rip), %rbp     # 0x177870
movl (%r14,%r12,4), %r15d
cmpq $0x151, %rbp            # imm = 0x151
movl 0x18(%rsp), %ebx
movq %r12, %r14
jg 0xb7e69
movl %r15d, (%r13,%rbp,4)
leal 0x1(%rbp), %eax
movl %eax, 0xbfa09(%rip)     # 0x177870
jmp 0xb7e84
leal -0x1(%rbp), %edx
shlq $0x2, %rdx
movq %r13, %rdi
leaq 0xbf3ea(%rip), %rsi     # 0x177264
callq 0x556d0
movl %r15d, -0x4(%r13,%rbp,4)
movq 0x40(%rsp), %r15
movq 0x58(%rsp), %r12
jmp 0xb81cb
movl 0x14(%rsp), %eax
orl %ebx, %eax
jne 0xb7eae
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0x38(%rsp), %eax
cmpl %eax, 0x3c(%rsp)
jge 0xb7ed6
movq 0xbf391(%rip), %rax     # 0x177250
movl (%rax,%rbp,4), %eax
movq 0x8(%rsp), %rcx
cmpl %eax, (%rcx,%rbp,4)
jne 0xb7ed6
movl $0x1, %esi
jmp 0xb7fa9
movl 0x38(%rsp), %eax
cmpl %eax, 0x3c(%rsp)
jge 0xb7ef0
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf97a(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb7f1b
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb7f07
jmp 0xb7f20
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x2, %ecx
jl 0xb7f67
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf930(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb7fa2
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb7f51
notl %ecx
jmp 0xb7fa4
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf8f3(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb7fb7
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb7f8e
jmp 0xb7fbc
xorl %ecx, %ecx
addl %eax, %ecx
movslq %ecx, %rsi
movq (%rsp), %rdi
movl $0x1, %edx
jmp 0xb8193
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x12, %ecx
jl 0xb803a
addl $-0x2, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %ebp, %ebp
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x18(%rsp), %xmm0
ja 0xb7fef
incl %ebp
cmpl $0x21, %ebp
jne 0xb7fd2
xorl %ebp, %ebp
cmpl $0x4, %ebp
movl $0x4, %eax
cmovgel %eax, %ebp
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf85d(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb8075
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb8024
notl %ecx
jmp 0xb8077
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf820(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb8081
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb8061
jmp 0xb8086
xorl %ecx, %ecx
addl %ecx, %eax
addl $-0x2, %eax
jmp 0xb814a
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x52, %ecx
jl 0xb8104
addl $-0x12, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %ebp, %ebp
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x18(%rsp), %xmm0
ja 0xb80b9
incl %ebp
cmpl $0x21, %ebp
jne 0xb809c
xorl %ebp, %ebp
cmpl $0x6, %ebp
movl $0x6, %eax
cmovgel %eax, %ebp
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf793(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb8143
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb80ee
notl %ecx
jmp 0xb8145
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf756(%rip), %eax     # 0x177870
movq 0x8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
movq %rax, %rsi
decq %rsi
movl %eax, %ecx
xorl %ebp, %ebp
testl %ecx, %ecx
jle 0xb814f
movl %esi, %edi
decl %ecx
decq %rsi
cmpl %edx, (%r13,%rdi,4)
jne 0xb812b
notl %ecx
jmp 0xb8151
xorl %ecx, %ecx
addl %ecx, %eax
addl $-0x12, %eax
movslq %eax, %rsi
jmp 0xb818d
xorl %ecx, %ecx
addl %eax, %ecx
addl $-0x52, %ecx
movslq %ecx, %rcx
movq %rcx, 0x50(%rsp)
addl $-0x53, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x18(%rsp), %xmm0
ja 0xb8188
incl %ebp
cmpl $0x21, %ebp
jne 0xb816b
xorl %ebp, %ebp
movq 0x50(%rsp), %rsi
movq (%rsp), %rdi
movl %ebp, %edx
callq 0x57ce0
movq 0x8(%rsp), %rax
movl (%rax,%r14,4), %eax
movl 0xbf6c9(%rip), %edi     # 0x177870
movq %rdi, %rcx
decq %rcx
testl %edi, %edi
jle 0xb81c1
movl %ecx, %edx
decl %edi
decq %rcx
cmpl %eax, (%r13,%rdx,4)
jne 0xb81ad
jmp 0xb81c6
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xba01f
movq 0x8(%rsp), %rdi
movl (%rdi,%r14,4), %eax
cmpl 0x30(%rsp), %eax
jne 0xb81ed
movl 0x10(%r15), %esi
movl %r12d, %edx
movl $0x8, %ecx
callq 0xb8b49
jmp 0xb8223
movl 0x48(%rsp), %ecx
cmpl %ecx, 0x4c(%rsp)
jge 0xb82af
movq 0xbf04e(%rip), %rsi     # 0x177250
cmpl (%rsi,%r14,4), %eax
jne 0xb82af
movl 0x10(%r15), %edx
movq 0x8(%rsp), %rdi
movl %r12d, %ecx
movl $0x8, %r8d
callq 0xba056
cmpl $0x2, %eax
jl 0xb829f
movl %eax, %ebp
movl $0x1, %esi
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %edx
callq 0x57ce0
xorl %esi, %esi
cmpl $0xa, %ebp
setge %sil
leal -0x2(%rbp), %eax
movq %rax, 0x30(%rsp)
leal (%rsi,%rsi,4), %r14d
addl $0x3, %r14d
movq %rbx, %rdi
movl $0x1, %edx
callq 0x57ce0
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movl %r14d, %edx
callq 0x57ce0
leal (%r12,%rbp), %ecx
incl %ecx
leal (%r12,%rbp), %eax
movl %ecx, %edx
andl $0x3, %edx
movl %edx, 0x24(%rsp)
andl $0xf, %ecx
movl %ecx, 0x28(%rsp)
movl $0x0, 0x14(%rsp)
xorl %ebx, %ebx
movl %eax, %r12d
jmp 0xb82af
movq (%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
incl %r12d
movl 0x10(%r15), %eax
cmpl %eax, %r12d
jl 0xb7c81
cmpl $0x0, 0x10(%r15)
movq 0x8(%rsp), %r13
jle 0xb82e8
movq 0xbef7e(%rip), %rax     # 0x177250
xorl %ecx, %ecx
movl (%r13,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
movslq 0x10(%r15), %rdx
cmpq %rdx, %rcx
jl 0xb82d4
movq %r13, %rdi
callq 0x561e0
movb $0x1, %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq