// File: /workspace/github_c_makefile_star2_O2/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, 0x8b65(%rip)      # 0xf1a5
je 0x6650
movb $0x5a, 0x8aa7(%rip)     # 0xf0f0
movb $0x0, 0x8aa1(%rip)      # 0xf0f1
movq 0x8b81(%rip), %rbx      # 0xf1d8
callq 0x15e9
cmpl $0x300, %ebp            # imm = 0x300
ja 0x684d
movzbl %r14b, %r12d
leaq 0x10e35(%rip), %r14     # 0x174a8
leaq 0x158b6(%rip), %r15     # 0x1bf30
movl %ebp, %r13d
subl $0x1, %r13d
jb 0x66c3
movq %r14, %rdi
callq 0x1d32
movb 0x8a5f(%rip), %cl       # 0xf0f0
xorb %cl, %al
addb 0x8a58(%rip), %al       # 0xf0f1
movl 0x8b91(%rip), %edx      # 0xf230
addl %r12d, %edx
movb %al, (%rdx,%r15)
cmpb $0x0, 0x8af8(%rip)      # 0xf1a5
je 0x66be
notb %al
movb %al, (%rdx,%r15)
addb $0x35, %cl
movb %cl, 0x8a32(%rip)       # 0xf0f0
incl %r12d
jmp 0x667d
movl 0x8b53(%rip), %eax      # 0xf21c
addl $0x2, %eax
cmpl %eax, 0x8b46(%rip)      # 0xf218
jne 0x6809
cmpl $0x0, 0x8b59(%rip)      # 0xf238
jne 0x6809
movb 0x8ab9(%rip), %cl       # 0xf1a4
movl 0x8b3f(%rip), %eax      # 0xf230
movb 0x8aae(%rip), %dl       # 0xf1a5
movl %ebp, %edi
xorl %r8d, %r8d
xorl %esi, %esi
cmpq %rsi, %rdi
je 0x67da
testb %cl, %cl
je 0x679a
movb (%rsi,%r15), %r9b
cmpb $-0x23, %r9b
jne 0x6746
testl %eax, %eax
setne %r10b
cmpb $0x21, 0x1(%rsi,%r15)
setne %r11b
cmpq $0x11, %rsi
setae %bpl
orb %r10b, %bpl
orb %r11b, %bpl
jne 0x6746
movzwl 0x2(%rsi,%r15), %r10d
movl %r10d, 0x8aba(%rip)     # 0xf200
testl %eax, %eax
setne %r10b
cmpb $0x11, %r9b
setne %r11b
cmpq $0x11, %rsi
setae %bpl
orb %r10b, %bpl
orb %r11b, %bpl
je 0x678a
testb %r9b, %r9b
jne 0x679a
cmpb 0x1(%rsi,%r15), %r8b
jno 0x679a
cmpb $-0x1, 0x2(%rsi,%r15)
jne 0x679a
cmpb $0x2, 0x3(%rsi,%r15)
jne 0x679a
cmpb $0x10, 0x4(%rsi,%r15)
jne 0x679a
jmp 0x67cc
movzwl 0x1(%rsi,%r15), %r9d
incl %r9d
movl %r9d, 0x8a6a(%rip)      # 0xf204
testb %dl, %dl
je 0x67c4
cmpb $0x10, (%rsi,%r15)
jne 0x67c4
cmpb $-0x1, 0x1(%rsi,%r15)
jne 0x67c4
cmpb $0x2, 0x2(%rsi,%r15)
jne 0x67c4
cmpb $0x0, 0x3(%rsi,%r15)
jne 0x67c4
cmpb 0x4(%rsi,%r15), %r8b
jo 0x67cc
incq %rsi
jmp 0x66fe
movl %esi, 0x8a5e(%rip)      # 0xf230
movl %esi, 0x8a5c(%rip)      # 0xf234
movl %esi, %eax
testl %eax, %eax
jne 0x6809
movb 0x15773(%rip), %al      # 0x1bf57
andb $-0x8, %al
cmpb $0x10, %al
jne 0x67ee
pushq $0x23
jmp 0x67fc
movb 0x157a1(%rip), %al      # 0x1bf95
andb $-0x8, %al
cmpb $0x10, %al
jne 0x6809
pushq $0x61
popq %rax
movl %eax, 0x8a2d(%rip)      # 0xf230
movl %eax, 0x8a2b(%rip)      # 0xf234
movl 0x8a25(%rip), %eax      # 0xf234
addl 0x8a13(%rip), %eax      # 0xf228
movl %eax, 0x8a11(%rip)      # 0xf22c
movq %rbx, 0x89b6(%rip)      # 0xf1d8
movzbl 0x8a47(%rip), %edi      # 0xf270
movq %rbx, %rsi
xorl %edx, %edx
callq 0x10d0
andl $0x0, 0x8b36(%rip)      # 0xf370
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15e9
pushq $0xa
popq %rdi
callq 0x13ed