// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: suckbitsnextblock
static void suckbitsnextblock (void)
{
	int n;

	if (!zipfilmode)
	{
		if (!nfilptr)
		{     //|===|===|crc|lng|typ|===|===|
				//        \  fakebuf: /
				//          |===|===|
				//----x     O---x     O--------
			nbitpos = LSWAPIL(*(int *)&filptr[8]);
			nfilptr = (unsigned char *)&filptr[nbitpos+12];
			*(int *)&fakebuf[0] = *(int *)&filptr[0]; //Copy last dword of IDAT chunk
			if (*(unsigned int *)&filptr[12] == LSWAPIB(0x54414449)) //Copy 1st dword of next IDAT chunk
				*(int *)&fakebuf[4] = *(int *)&filptr[16];
			filptr = &fakebuf[4]; bitpos -= 32;
		}
		else
		{
			filptr = nfilptr; nfilptr = 0;
			bitpos -= ((nbitpos-4)<<3);
		}
		//if (n_from_suckbits < 4) will it crash?
	}
	else
	{
			//NOTE: should only read bytes inside compsize, not 64K!!! :/
		*(int *)&olinbuf[0] = *(int *)&olinbuf[sizeof(olinbuf)-4];
		n = min((kzfs.compleng-kzfs.comptell),(int)sizeof(olinbuf)-4);
		n = (int)fread(&olinbuf[4],1,n,kzfs.fil);
		kzfs.comptell += n;
		bitpos -= ((sizeof(olinbuf)-4)<<3);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpl $0x0, 0x53d0c1(%rip)    # 0x5a90e0
jne 0x6c0ef
cmpq $0x0, 0x556d73(%rip)    # 0x5c2da0
jne 0x6c0b7
movq 0x54d0ce(%rip), %rax    # 0x5b9108
movl 0x8(%rax), %edi
callq 0x620c0
movl %eax, 0x57b238(%rip)    # 0x5e7280
movq 0x54d0b9(%rip), %rax    # 0x5b9108
movl 0x57b22b(%rip), %ecx    # 0x5e7280
addl $0xc, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x556d3b(%rip)    # 0x5c2da0
movq 0x54d09c(%rip), %rax    # 0x5b9108
movl (%rax), %eax
movl %eax, 0x57b210(%rip)    # 0x5e7284
movq 0x54d08d(%rip), %rax    # 0x5b9108
cmpl $0x54414449, 0xc(%rax)  # imm = 0x54414449
jne 0x6c094
movq 0x54d07d(%rip), %rax    # 0x5b9108
movl 0x10(%rax), %eax
movl %eax, 0x57b1f4(%rip)    # 0x5e7288
leaq 0x57b1e9(%rip), %rax    # 0x5e7284
addq $0x4, %rax
movq %rax, 0x54d062(%rip)    # 0x5b9108
movl 0x54d054(%rip), %eax    # 0x5b9100
subl $0x20, %eax
movl %eax, 0x54d04b(%rip)    # 0x5b9100
jmp 0x6c0ea
movq 0x556ce2(%rip), %rax    # 0x5c2da0
movq %rax, 0x54d043(%rip)    # 0x5b9108
movq $0x0, 0x556cd0(%rip) # 0x5c2da0
movl 0x57b1aa(%rip), %ecx    # 0x5e7280
subl $0x4, %ecx
shll $0x3, %ecx
movl 0x54d01e(%rip), %eax    # 0x5b9100
subl %ecx, %eax
movl %eax, 0x54d016(%rip)    # 0x5b9100
jmp 0x6c174
movl 0x54d007(%rip), %eax    # 0x5b90fc
movl %eax, 0x53d005(%rip)    # 0x5a9100
movl 0x53ce97(%rip), %eax    # 0x5a8f98
subl 0x53ce95(%rip), %eax    # 0x5a8f9c
cmpl $0xfffc, %eax           # imm = 0xFFFC
jge 0x6c11f
movl 0x53ce84(%rip), %eax    # 0x5a8f98
subl 0x53ce82(%rip), %eax    # 0x5a8f9c
movl %eax, -0x8(%rbp)
jmp 0x6c129
movl $0xfffc, %eax           # imm = 0xFFFC
movl %eax, -0x8(%rbp)
jmp 0x6c129
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movslq -0x4(%rbp), %rdx
movq 0x53ce4e(%rip), %rcx    # 0x5a8f88
leaq 0x53cfbf(%rip), %rdi    # 0x5a9100
addq $0x4, %rdi
movl $0x1, %esi
callq 0x64f0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addl 0x53ce41(%rip), %eax    # 0x5a8f9c
movl %eax, 0x53ce3b(%rip)    # 0x5a8f9c
movslq 0x54cf98(%rip), %rax    # 0x5b9100
subq $0x7ffe0, %rax          # imm = 0x7FFE0
movl %eax, 0x54cf8c(%rip)    # 0x5b9100
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)