// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: DecodeSpeedlockTable
void DecodeSpeedlockTable(word limit,byte offset)
{
  word count;
  dword savepos=filepos;
  if (zeta) { xorbyte=0x5a; addbyte=0; }
  ResetTempFile();
  if (limit>sizeof(slockdata)) Error(10);
  for (count=0; count<limit; count++)
      {
	slockdata[count+offset+tableoffset]=(byte)((GetData(&tempfile) ^ xorbyte)+addbyte);
	if (zeta)
	   {
	     slockdata[count+offset+tableoffset]^=0xff;
	     xorbyte+=0x35;
	   }
      }
  if (blocks==blockskip+2 && !subblocks)
     {
       for (count=0; count<limit; count++)
	   {
	     if (slocktype)
		{
		  if (slockdata[count]==0xdd && slockdata[count+1]==0x21 && count<0x11 && !tableoffset) { nxtloadpos=slockdata[count+2]+(256*slockdata[count+3]); }
		  if (slockdata[count]==0x11 && count<0x11 && !tableoffset) { expectedlength=1+slockdata[count+1]+(256*slockdata[count+2]); }
		  if ((slockdata[count]==0) && (slockdata[count+1]==0x80) && (slockdata[count+2]==0xff) && (slockdata[count+3]==0x02) && (slockdata[count+4]==0x10))
		     { tablepointer=tableoffset=count; break; }
		}
	     if (zeta)
		{
		  if ((slockdata[count]==0x10) && (slockdata[count+1]==0xff) && (slockdata[count+2]==0x02) && (slockdata[count+3]==0) && (slockdata[count+4]==0x80))
		     { tablepointer=tableoffset=count; break; }
		}
	   }
       if (!tableoffset)
	  {
	    byte rpage1=slockdata[0x27],rpage2=slockdata[0x65];
	    if (rpage1>=0x10 && rpage1<=0x17) tablepointer=tableoffset=0x23;
	    else if (rpage2>=0x10 && rpage2<=0x17) tablepointer=tableoffset=0x61;
	  }
     }
  loadertableadd=slockloadaddress+tablepointer;
  filepos=savepos;
  lseek(inpfile.handle,filepos,SEEK_SET);
  inpfile.bufpoint=0;
  ResetTempFile();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %ebp
cmpb $0x0, 0x84d4(%rip)      # 0xf1b5
je 0x6cf1
movb $0x5a, 0x8416(%rip)     # 0xf100
movb $0x0, 0x8410(%rip)      # 0xf101
movq 0x84f0(%rip), %rbx      # 0xf1e8
callq 0x161e
cmpl $0x300, %ebp            # imm = 0x300
ja 0x6f23
testl %ebp, %ebp
je 0x6d65
movzbl %r14b, %r15d
leaq 0x107a0(%rip), %r14     # 0x174b8
leaq 0x15221(%rip), %r12     # 0x1bf40
movl %ebp, %r13d
movq %r14, %rdi
callq 0x1d8c
movb 0x83d0(%rip), %cl       # 0xf100
xorb %cl, %al
addb 0x83c9(%rip), %al       # 0xf101
movl 0x8502(%rip), %edx      # 0xf240
addl %r15d, %edx
movb %al, (%rdx,%r12)
cmpb $0x0, 0x8469(%rip)      # 0xf1b5
je 0x6d5d
notb %al
movb %al, (%rdx,%r12)
addb $0x35, %cl
movb %cl, 0x83a3(%rip)       # 0xf100
incl %r15d
decl %r13d
jne 0x6d22
movl 0x84c1(%rip), %eax      # 0xf22c
addl $0x2, %eax
cmpl %eax, 0x84b4(%rip)      # 0xf228
jne 0x6ec9
cmpl $0x0, 0x84c7(%rip)      # 0xf248
jne 0x6ec9
movl 0x84b3(%rip), %eax      # 0xf240
testl %ebp, %ebp
je 0x6e93
movb 0x8419(%rip), %cl       # 0xf1b4
movb 0x8414(%rip), %dl       # 0xf1b5
movl %ebp, %esi
xorl %r8d, %r8d
leaq 0x15193(%rip), %r9      # 0x1bf40
xorl %edi, %edi
testb %cl, %cl
je 0x6e50
movb (%rdi,%r9), %r10b
cmpb $-0x23, %r10b
jne 0x6df0
testl %eax, %eax
setne %r10b
cmpb $0x21, 0x1(%rdi,%r9)
setne %r11b
cmpq $0x11, %rdi
setae %bpl
orb %r10b, %bpl
orb %r11b, %bpl
jne 0x6e50
movzwl 0x2(%rdi,%r9), %r10d
movl %r10d, 0x8422(%rip)     # 0xf210
jmp 0x6e50
testl %eax, %eax
setne %r11b
cmpb $0x11, %r10b
setne %bpl
cmpq $0x11, %rdi
setae %r14b
orb %r11b, %r14b
orb %bpl, %r14b
je 0x6e40
testb %r10b, %r10b
jne 0x6e50
cmpb 0x1(%rdi,%r9), %r8b
jno 0x6e50
leal 0x2(%rdi), %r10d
cmpb $-0x1, (%r10,%r9)
jne 0x6e50
leal 0x3(%rdi), %r10d
cmpb $0x2, (%r10,%r9)
jne 0x6e50
leal 0x4(%rdi), %r10d
cmpb $0x10, (%r10,%r9)
jne 0x6e50
jmp 0x6f10
movzwl 0x1(%rdi,%r9), %r10d
incl %r10d
movl %r10d, 0x83c4(%rip)     # 0xf214
testb %dl, %dl
je 0x6e87
cmpb $0x10, (%rdi,%r9)
jne 0x6e87
cmpb $-0x1, 0x1(%rdi,%r9)
jne 0x6e87
leal 0x2(%rdi), %r10d
cmpb $0x2, (%r10,%r9)
jne 0x6e87
leal 0x3(%rdi), %r10d
cmpb $0x0, (%r10,%r9)
jne 0x6e87
leal 0x4(%rdi), %r10d
cmpb (%r10,%r9), %r8b
jo 0x6f10
incq %rdi
cmpq %rdi, %rsi
jne 0x6daf
testl %eax, %eax
jne 0x6ec9
movb 0x150ca(%rip), %cl      # 0x1bf67
andb $-0x8, %cl
movl $0x23, %eax
cmpb $0x10, %cl
je 0x6ebd
movb 0x150f5(%rip), %cl      # 0x1bfa5
andb $-0x8, %cl
movl $0x61, %eax
cmpb $0x10, %cl
jne 0x6ec9
movl %eax, 0x837d(%rip)      # 0xf240
movl %eax, 0x837b(%rip)      # 0xf244
movl 0x8375(%rip), %eax      # 0xf244
addl 0x8363(%rip), %eax      # 0xf238
movl %eax, 0x8361(%rip)      # 0xf23c
movq %rbx, 0x8306(%rip)      # 0xf1e8
movzbl 0x8397(%rip), %edi      # 0xf280
movq %rbx, %rsi
xorl %edx, %edx
callq 0x10d0
movl $0x0, 0x8483(%rip)      # 0xf380
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x161e
movl %edi, 0x832a(%rip)      # 0xf240
movl %edi, 0x8328(%rip)      # 0xf244
movl %edi, %eax
jmp 0x6e93
movl $0xa, %edi
callq 0x140c