// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: klseek
int klseek(int handle, int offset, int whence)
{
	int i, groupnum;

	groupnum = filegrp[handle];

	if (groupnum == 255) return((int)lseek(filehan[handle],offset,whence));
#ifdef WITHKPLIB
	else if (groupnum == 254)
	{
		if (kzcurhand != handle)
		{
			if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); }
			kzcurhand = handle;
			kzipopen(filenamsav[handle]);
			kzseek(filepos[handle],SEEK_SET);
		}
		return(kzseek(offset,whence));
	}
#endif

	if (groupfil[groupnum] != -1)
	{
		switch(whence)
		{
			case BSEEK_SET: filepos[handle] = offset; break;
			case BSEEK_END: i = filehan[handle];
				filepos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset;
				break;
			case BSEEK_CUR: filepos[handle] += offset; break;
		}
		return(filepos[handle]);
	}
	return(-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x1c0d34(%rip), %rax    # 0x1f12e0
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
cmpl $0xff, -0x18(%rbp)
jne 0x305de
movslq -0x8(%rbp), %rcx
leaq 0xaff49(%rip), %rax     # 0xe0510
movl (%rax,%rcx,4), %edi
movslq -0xc(%rbp), %rsi
movl -0x10(%rbp), %edx
callq 0x62a0
movl %eax, -0x4(%rbp)
jmp 0x3073b
cmpl $0xfe, -0x18(%rbp)
jne 0x30664
movl 0xb0023(%rip), %eax     # 0xe0610
cmpl -0x8(%rbp), %eax
je 0x30651
callq 0x69df0
cmpl $0x0, %eax
jl 0x30619
callq 0x69df0
movl %eax, %edx
movslq 0xb0006(%rip), %rcx     # 0xe0610
leaq 0x1c0d0f(%rip), %rax    # 0x1f1320
movl %edx, (%rax,%rcx,4)
callq 0x69ea0
movl -0x8(%rbp), %eax
movl %eax, 0xaffee(%rip)     # 0xe0610
movslq -0x8(%rbp), %rax
leaq 0x1c0df3(%rip), %rdi    # 0x1f1420
imulq $0x104, %rax, %rax      # imm = 0x104
addq %rax, %rdi
callq 0x30210
movslq -0x8(%rbp), %rcx
leaq 0x1c0cd9(%rip), %rax    # 0x1f1320
movl (%rax,%rcx,4), %edi
xorl %esi, %esi
callq 0x69d40
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
callq 0x69d40
movl %eax, -0x4(%rbp)
jmp 0x3073b
jmp 0x30666
movslq -0x18(%rbp), %rcx
leaq 0xafe8f(%rip), %rax     # 0xe0500
cmpl $-0x1, (%rax,%rcx,4)
je 0x30734
movl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
testl %eax, %eax
je 0x3069e
jmp 0x30687
movl -0x1c(%rbp), %eax
subl $0x1, %eax
je 0x30706
jmp 0x30691
movl -0x1c(%rbp), %eax
subl $0x2, %eax
je 0x306b1
jmp 0x30721
movl -0xc(%rbp), %edx
movslq -0x8(%rbp), %rcx
leaq 0x1c0c74(%rip), %rax    # 0x1f1320
movl %edx, (%rax,%rcx,4)
jmp 0x30721
movslq -0x8(%rbp), %rcx
leaq 0xafe54(%rip), %rax     # 0xe0510
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x1c0bf3(%rip), %rax    # 0x1f12c0
movq (%rax,%rcx,8), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movslq -0x18(%rbp), %rcx
leaq 0x1c0bd8(%rip), %rax    # 0x1f12c0
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
subl (%rax,%rcx,4), %edx
addl -0xc(%rbp), %edx
movslq -0x8(%rbp), %rcx
leaq 0x1c0c1f(%rip), %rax    # 0x1f1320
movl %edx, (%rax,%rcx,4)
jmp 0x30721
movl -0xc(%rbp), %edx
movslq -0x8(%rbp), %rcx
leaq 0x1c0c0c(%rip), %rax    # 0x1f1320
addl (%rax,%rcx,4), %edx
leaq 0x1c0c02(%rip), %rax    # 0x1f1320
movl %edx, (%rax,%rcx,4)
movslq -0x8(%rbp), %rcx
leaq 0x1c0bf4(%rip), %rax    # 0x1f1320
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x3073b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)