// File: /workspace/github_c_makefile_star2_O0/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/DeflateReader.h
// Function: ReadDeflateCode
static bool ReadDeflateCode(DeflateReader *self)
{
	if(self->isstoredblock)
	{
		if(self->storedbytesleft>0)
		{
			self->storedbytesleft--;
			OutputDeflateLiteral(self,ReadBitString(&self->bitstream,8)); // Could be faster.
		}
		else
		{
			if(self->islastblock) return false;
			if(!ReadDeflateBlockHeader(self)) return false;
		}
	}
	else
	{
		int literal=ReadHuffmanCode(&self->bitstream,self->literalcode,15);
		if(literal<0) return false;

		if(literal<256)
		{
			OutputDeflateLiteral(self,literal);
		}
		else if(literal==256)
		{
			if(self->islastblock) return false; // Should set a flag to block future calls?
			if(!ReadDeflateBlockHeader(self)) return false; // Also here.
		}
		else
		{
			int length;
			if(literal<265) length=literal-254;
			else if(literal<285)
			{
				static const int baselengths[]={11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227};
				int size=(literal-261)/4;
				length=baselengths[literal-265]+ReadBitString(&self->bitstream,size);
			}
			else // literal==285
			{
				length=258;
			}

			int distcode=ReadHuffmanCode(&self->bitstream,self->distancecode,15);
			if(distcode<0) return false;

			int offset;
			if(distcode<4) offset=distcode+1;
			else
			{
				static const int baseoffsets[]={5,7,9,13,17,25,33,49,65,97,129,193,257,
				385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,32769,49153};
				int size=(distcode-2)/2;
				offset=baseoffsets[distcode-4]+ReadBitString(&self->bitstream,size);
			}

			OutputDeflateMatch(self,offset,length);
		}
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq -0x40(%rsp), %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x2c(%rax)
je 0x63d2
movq -0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jle 0x63a2
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl $0x8, %esi
callq 0x65a0
movq -0x30(%rbp), %rdi
movzbl %al, %esi
callq 0x6560
jmp 0x63cd
movq -0x10(%rbp), %rax
testb $0x1, 0x2d(%rax)
je 0x63b5
movb $0x0, -0x1(%rbp)
jmp 0x6549
movq -0x10(%rbp), %rdi
callq 0x6620
testb $0x1, %al
jne 0x63cb
movb $0x0, -0x1(%rbp)
jmp 0x6549
jmp 0x63cd
jmp 0x6545
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x8034, %rsi           # imm = 0x8034
movl $0xf, %edx
callq 0x6a80
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x63fd
movb $0x0, -0x1(%rbp)
jmp 0x6549
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jge 0x641a
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movzbl %al, %esi
callq 0x6560
jmp 0x6543
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jne 0x6451
movq -0x10(%rbp), %rax
testb $0x1, 0x2d(%rax)
je 0x6436
movb $0x0, -0x1(%rbp)
jmp 0x6549
movq -0x10(%rbp), %rdi
callq 0x6620
testb $0x1, %al
jne 0x644c
movb $0x0, -0x1(%rbp)
jmp 0x6549
jmp 0x6541
cmpl $0x109, -0x14(%rbp)     # imm = 0x109
jge 0x6467
movl -0x14(%rbp), %eax
subl $0xfe, %eax
movl %eax, -0x18(%rbp)
jmp 0x64bc
cmpl $0x11d, -0x14(%rbp)     # imm = 0x11D
jge 0x64b3
movl -0x14(%rbp), %eax
subl $0x105, %eax            # imm = 0x105
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
subl $0x109, %eax            # imm = 0x109
movslq %eax, %rcx
leaq 0x10e8b(%rip), %rax     # 0x17320
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x65a0
movl %eax, %ecx
movl -0x34(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x18(%rbp)
jmp 0x64ba
movl $0x102, -0x18(%rbp)     # imm = 0x102
jmp 0x64bc
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x18034, %rsi          # imm = 0x18034
movl $0xf, %edx
callq 0x6a80
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x64e4
movb $0x0, -0x1(%rbp)
jmp 0x6549
cmpl $0x4, -0x20(%rbp)
jge 0x64f5
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6532
movl -0x20(%rbp), %eax
subl $0x2, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
subl $0x4, %eax
movslq %eax, %rcx
leaq 0x10e5a(%rip), %rax     # 0x17370
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x65a0
movl %eax, %ecx
movl -0x38(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x6b30
jmp 0x6543
jmp 0x6545
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
leaq 0x40(%rsp), %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop