// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl 0x50(%rdi), %ebx
xorl %eax, %eax
cmpl $0x4, %ebx
ja 0xb72b8
cmpl $0x2, %ebx
je 0xb72b8
movq %rdi, %r15
movq %rsi, %rbp
movl %edx, 0x24(%rsp)
movslq 0x10(%rdi), %r12
leaq (,%r12,4), %rax
testq %r12, %r12
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x56670
movq %rax, %r13
movl 0x58(%r15), %eax
xorl %ecx, %ecx
cmpl $0x5, %eax
sete %cl
addl $0x3, %ecx
cmpl $0x6, %eax
movl $0x1, %r14d
cmovnel %ecx, %r14d
testq %r12, %r12
movq %rbp, (%rsp)
movl %r14d, 0x14(%rsp)
jle 0xb6a3e
leaq 0x8(%r15), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movq %r13, 0x8(%rsp)
leaq 0x78(%rsp), %r13
leaq 0x88(%rsp), %rbx
movl 0x24(%rsp), %ebp
movl %r14d, 0x50(%rsp)
movl %ebp, 0x54(%rsp)
movq %r13, %rdi
movq 0x18(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x55f30
movl 0x58(%r15), %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x57d10
movl 0x54(%r15), %edx
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x57020
movl 0x70(%rsp), %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
movslq 0x10(%r15), %r12
cmpq %r12, %r14
jl 0xb69d8
movl 0x50(%r15), %ebx
movq 0x8(%rsp), %r13
movq (%rsp), %rbp
movl 0x14(%rsp), %r14d
cmpl $0x4, %ebx
ja 0xb72ae
movl %ebx, %eax
leaq 0x5c2dc(%rip), %rcx     # 0x112d2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testl %r12d, %r12d
jle 0xb72ae
xorl %ebx, %ebx
movslq (%r13,%rbx,4), %rsi
movl 0x54(%r15), %edx
imull %r14d, %edx
movq %rbp, %rdi
callq 0x57ce0
incq %rbx
movslq 0x10(%r15), %rax
cmpq %rax, %rbx
jl 0xb6a64
jmp 0xb72ae
testl %r12d, %r12d
jle 0xb72ae
xorl %ebx, %ebx
movl 0x60(%r15), %ecx
movq %r13, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0xb7ce7
movl %eax, %ebp
movslq %ebx, %r14
movslq (%r13,%r14,4), %rsi
movl 0x54(%r15), %edx
imull 0x14(%rsp), %edx
movq (%rsp), %rdi
callq 0x57ce0
movslq %ebp, %rbx
movl 0x60(%r15), %edx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x57ce0
addl %r14d, %ebx
incl %ebx
movl 0x10(%r15), %r12d
cmpl %r12d, %ebx
jl 0xb6a95
jmp 0xb72ae
testl %r12d, %r12d
movq %r15, 0x18(%rsp)
movq %r13, 0x8(%rsp)
jle 0xb726d
movq 0xbf74e(%rip), %rax     # 0x176250
movl (%r13), %ecx
cmpl (%rax), %ecx
jne 0xb6b31
movl %r12d, %ecx
movl $0x1, %esi
movq %rsi, %rdx
cmpq %rsi, %rcx
je 0xb6b28
movl (%r13,%rdx,4), %edi
leaq 0x1(%rdx), %rsi
cmpl (%rax,%rdx,4), %edi
je 0xb6b12
cmpq %rcx, %rdx
jae 0xb726d
xorl %r12d, %r12d
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0x10(%r15), %esi
movq 0xbf702(%rip), %rcx     # 0x176250
subq $0x8, %rsp
leaq 0xbfd1f(%rip), %r14     # 0x176878
leaq 0xbfd14(%rip), %rbx     # 0x176874
xorl %edi, %edi
movq %r13, %rdx
movl %esi, %r8d
movl 0x1c(%rsp), %r9d
pushq %r14
pushq %rbx
pushq $0x0
callq 0xb7dc3
addq $0x20, %rsp
movl 0x10(%r15), %esi
movq 0xbf6ca(%rip), %rcx     # 0x176250
subq $0x8, %rsp
leaq 0xbfcef(%rip), %r13     # 0x176880
leaq 0xbfce4(%rip), %r15     # 0x17687c
xorl %edi, %edi
movq 0x10(%rsp), %rdx
movl %esi, %r8d
movl 0x1c(%rsp), %r9d
pushq %r13
pushq %r15
pushq $0x1
callq 0xb7dc3
addq $0x20, %rsp
movl 0xbfcbc(%rip), %eax     # 0x176878
movl 0xbfcb2(%rip), %ecx     # 0x176874
xorl %esi, %esi
movl %eax, 0x3c(%rsp)
movl %ecx, 0x38(%rsp)
cmpl %ecx, %eax
cmovlq %r14, %rbx
cmovlq %r13, %r15
movq 0x8(%rsp), %r13
setl %sil
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl (%rbx), %eax
movl (%r15), %ecx
xorl %esi, %esi
movl %eax, 0x44(%rsp)
movl %ecx, 0x40(%rsp)
cmpl %ecx, %eax
setl %sil
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movq 0x18(%rsp), %rax
movl 0x10(%rax), %eax
testl %eax, %eax
jle 0xb72ae
leaq 0xbf63b(%rip), %r13     # 0x176260
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x10(%rsp)
movl %r12d, %r14d
testl %r12d, %r12d
jle 0xb6c58
movq 0x8(%rsp), %rcx
movl -0x4(%rcx,%r14,4), %ecx
movl %ecx, 0x24(%rsp)
jmp 0xb6c60
movl $0x0, 0x24(%rsp)
movl %r12d, %ecx
andl $0xf, %ecx
cmpl 0x34(%rsp), %ecx
jne 0xb6cd3
movl 0xbfbfe(%rip), %ecx     # 0x176870
movslq %r12d, %rdx
cltq
xorl %esi, %esi
leaq (%rsi,%rdx), %rdi
cmpq %rax, %rdi
jge 0xb6ca6
movq 0x8(%rsp), %r8
movl (%r8,%rdi,4), %edi
movq %rcx, %r8
testl %r8d, %r8d
jle 0xb6cc1
decq %r8
movl %r8d, %r9d
cmpl %edi, (%r13,%r9,4)
jne 0xb6c8e
cmpl $-0x1, %r9d
je 0xb6cc1
incq %rsi
cmpq $0x10, %rsi
jne 0xb6c79
movl $0x1, %r15d
movb $0x1, %bl
movl $0x1, %esi
jmp 0xb6d57
xorl %r15d, %r15d
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl %r12d, %eax
andl $0x3, %eax
testl %r15d, %r15d
setne %bl
cmpl 0x30(%rsp), %eax
jne 0xb6d64
testl %r15d, %r15d
jne 0xb6d64
movq 0x18(%rsp), %rax
movslq 0x10(%rax), %rax
movl 0xbfb77(%rip), %ecx     # 0x176870
movslq %r12d, %rdx
xorl %esi, %esi
leaq (%rsi,%rdx), %rdi
cmpq %rax, %rdi
jge 0xb6d2b
movq 0x8(%rsp), %r8
movl (%r8,%rdi,4), %edi
movq %rcx, %r8
testl %r8d, %r8d
jle 0xb6d48
decq %r8
movl %r8d, %r9d
cmpl %edi, (%r13,%r9,4)
jne 0xb6d13
cmpl $-0x1, %r9d
je 0xb6d48
incq %rsi
cmpq $0x4, %rsi
jne 0xb6cfe
movl $0x1, 0x10(%rsp)
xorl %ebx, %ebx
movl $0x1, %esi
xorl %r15d, %r15d
jmp 0xb6d57
xorl %esi, %esi
xorl %ebx, %ebx
xorl %r15d, %r15d
movl $0x0, 0x10(%rsp)
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movq 0x8(%rsp), %rax
movq %r14, 0x60(%rsp)
movl (%rax,%r14,4), %r14d
movslq %r14d, %rdx
movl 0xbfaf5(%rip), %eax     # 0x176870
testl %eax, %eax
jle 0xb6d94
decq %rax
movl %eax, %ecx
cmpl %r14d, (%r13,%rcx,4)
jne 0xb6d7b
cmpl $-0x1, %ecx
jne 0xb6e7a
movq %rdx, 0x58(%rsp)
movq %r15, 0x28(%rsp)
movq (%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movq 0xbf498(%rip), %rsi     # 0x176250
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %edx
movl 0x14(%rsp), %r15d
movl %r15d, %ecx
callq 0xb8384
testl %eax, %eax
movq %r12, 0x48(%rsp)
je 0xb6e05
movl $0x1, %esi
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movq 0xbf45e(%rip), %rsi     # 0x176250
movq %rbx, %rdi
movl %r12d, %edx
movl %r15d, %ecx
movq %rbp, %r8
callq 0xb869f
jmp 0xb6e2d
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movq 0x18(%rsp), %rax
movl 0x54(%rax), %edx
imull %r15d, %edx
movq %rbp, %rdi
movq 0x58(%rsp), %rsi
callq 0x57ce0
movslq 0xbfa3c(%rip), %rbx     # 0x176870
cmpq $0x151, %rbx            # imm = 0x151
movq 0x28(%rsp), %r15
jg 0xb6e52
movl %r14d, (%r13,%rbx,4)
leal 0x1(%rbx), %eax
movl %eax, 0xbfa20(%rip)     # 0x176870
jmp 0xb6e70
decl %ebx
leaq (,%rbx,4), %rdx
movq %r13, %rdi
leaq 0xbf3fe(%rip), %rsi     # 0x176264
callq 0x556d0
movl %r14d, (%r13,%rbx,4)
movq 0x48(%rsp), %r12
jmp 0xb7169
cmpl $0x0, 0x10(%rsp)
setne %al
orb %bl, %al
testb $0x1, %al
movq (%rsp), %rbp
jne 0xb6e9e
movl $0x1, %esi
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0x38(%rsp), %eax
cmpl %eax, 0x3c(%rsp)
jge 0xb6ec2
movq 0xbf3a1(%rip), %rax     # 0x176250
movslq %r12d, %rcx
cmpl (%rax,%rcx,4), %r14d
jne 0xb6ec2
movl $0x1, %esi
jmp 0xb6f77
movl 0x38(%rsp), %eax
cmpl %eax, 0x3c(%rsp)
jge 0xb6edb
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf98f(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb6efd
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb6ee9
jmp 0xb6f02
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x2, %ecx
jl 0xb6f3f
movl $0x1, %esi
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf94f(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb6f70
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb6f29
notl %ecx
jmp 0xb6f72
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf91c(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb6f84
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb6f5c
jmp 0xb6f89
xorl %ecx, %ecx
addl %eax, %ecx
movslq %ecx, %rsi
movq %rbp, %rdi
movl $0x1, %edx
jmp 0xb713a
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x12, %ecx
jl 0xb6ffe
addl $-0x2, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %ebp, %ebp
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x28(%rsp), %xmm0
ja 0xb6fbc
incl %ebp
cmpl $0x21, %ebp
jne 0xb6f9f
xorl %ebp, %ebp
cmpl $0x4, %ebp
movl $0x4, %eax
cmovgel %eax, %ebp
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf890(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb702f
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb6fe8
notl %ecx
jmp 0xb7031
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf85d(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb703b
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb701b
jmp 0xb7040
xorl %ecx, %ecx
addl %ecx, %eax
addl $-0x2, %eax
jmp 0xb70f1
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl %eax, %ecx
cmpl $-0x52, %ecx
jl 0xb70b5
addl $-0x12, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %ebp, %ebp
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x28(%rsp), %xmm0
ja 0xb7073
incl %ebp
cmpl $0x21, %ebp
jne 0xb7056
xorl %ebp, %ebp
cmpl $0x6, %ebp
movl $0x6, %eax
cmovgel %eax, %ebp
movl $0x1, %esi
movq (%rsp), %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf7d9(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
testl %ecx, %ecx
jle 0xb70ea
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb709f
notl %ecx
jmp 0xb70ec
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
movl 0xbf7a6(%rip), %eax     # 0x176870
movq %rax, %rdx
decq %rdx
movl %eax, %ecx
xorl %ebp, %ebp
testl %ecx, %ecx
jle 0xb70fa
movl %edx, %esi
decl %ecx
decq %rdx
cmpl %r14d, (%r13,%rsi,4)
jne 0xb70d2
notl %ecx
jmp 0xb70fc
xorl %ecx, %ecx
addl %ecx, %eax
addl $-0x12, %eax
movslq %eax, %rsi
movq (%rsp), %rdi
jmp 0xb7135
xorl %ecx, %ecx
addl %eax, %ecx
addl $-0x52, %ecx
movslq %ecx, %rbx
addl $-0x53, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%rsp)
movl $0x2, %edi
movl %ebp, %esi
callq 0x56010
ucomisd 0x28(%rsp), %xmm0
ja 0xb712e
incl %ebp
cmpl $0x21, %ebp
jne 0xb7111
xorl %ebp, %ebp
movq (%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %rdi, %rbp
callq 0x57ce0
movl 0xbf72b(%rip), %edi     # 0x176870
movq %rdi, %rax
decq %rax
testl %edi, %edi
jle 0xb715f
movl %eax, %ecx
decl %edi
decq %rax
cmpl %r14d, (%r13,%rcx,4)
jne 0xb714b
jmp 0xb7164
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xb91f4
cmpl 0x24(%rsp), %r14d
jne 0xb718c
movq 0x18(%rsp), %rax
movl 0x10(%rax), %esi
movq 0x8(%rsp), %rdi
movl %r12d, %edx
movl $0x8, %ecx
callq 0xb7ce7
jmp 0xb71cb
movl 0x40(%rsp), %eax
cmpl %eax, 0x44(%rsp)
jge 0xb7257
movq 0xbf0af(%rip), %rsi     # 0x176250
movq 0x60(%rsp), %rax
cmpl (%rsi,%rax,4), %r14d
jne 0xb7257
movq 0x18(%rsp), %rax
movl 0x10(%rax), %edx
movq 0x8(%rsp), %rdi
movl %r12d, %ecx
movl $0x8, %r8d
callq 0xb922b
cmpl $0x2, %eax
jl 0xb7244
movl %eax, %ebp
movl $0x1, %esi
movq (%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
callq 0x57ce0
xorl %esi, %esi
cmpl $0xa, %ebp
setae %sil
leal -0x2(%rbp), %ebx
leal (%rsi,%rsi,4), %r14d
addl $0x3, %r14d
movq %r15, %rdi
movl $0x1, %edx
callq 0x57ce0
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x57ce0
leal (%r12,%rbp), %ecx
incl %ecx
leal (%r12,%rbp), %eax
movq %r15, %rbp
movl %ecx, %edx
andl $0x3, %edx
movl %edx, 0x30(%rsp)
andl $0xf, %ecx
movl %ecx, 0x34(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movl %eax, %r12d
jmp 0xb7257
movq (%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x57ce0
incl %r12d
movq 0x18(%rsp), %rax
movl 0x10(%rax), %eax
cmpl %eax, %r12d
jl 0xb6c40
jmp 0xb7283
movl $0x1, %esi
movq %rbp, %rdi
movl $0x1, %edx
callq 0x57ce0
movl 0x10(%r15), %eax
testl %eax, %eax
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %r13
jle 0xb72ae
movq 0xbefb8(%rip), %rax     # 0x176250
xorl %ecx, %ecx
movl (%r13,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
movslq 0x10(%rsi), %rdx
cmpq %rdx, %rcx
jl 0xb729a
movq %r13, %rdi
callq 0x561e0
movb $0x1, %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq