// File: /workspace/github_c_makefile_star2_O0/mincebert[P]maketzx/maketzx.c
// Function: ReadNormalBlock
word ReadNormalBlock(void)
{
  word loaded=0;
  pilot.freq=808;
  syncx.freq=2450;
  bit0.freq=2044;
  bit1.freq=1022;
  SetTimings();
  DataLoadOK=0;
  pilotlength=0;
  do {
       do {
		printf("Searching pilot...       \x0d");
		PilotSearch(256);
		if (!blocktype) return 0; if (!PilotLinkingOK) { pilotlength=0; break;}
		mspause=0;
		SyncSearch();
		if (!blocktype) return 0; if (!SyncLoadOK) break;
		loaded=DataRead(bit0.samples,bit1.samples,expectedlength);
		if (blocktype && ((slocktype<3 || slocktype>6) || blocks!=blockskip)) mspause+=(FindPause()/samprate)*1000;
		else mspause+=7;
	  }
       while (!DataLoadOK);
     }
  while (!DataLoadOK);
  ResetTempFile();
  if (loaded==19)
     {
       byte count;
       dword savefilepos=filepos;
       ResetTempFile();
       if (GetData(&tempfile)==0)
	  {
	    header.type=GetData(&tempfile);
	    for (count=0; count<10; count++)
		{
		  header.name[count]=GetData(&tempfile);
		  if (header.name[count]<' ') header.name[count]='*';
		}
	    header.name[10]=0;
	    header.length=(byte)(GetData(&tempfile));
	    header.length+=(word)(256*GetData(&tempfile));
	    header.start=(byte)(GetData(&tempfile));
	    header.start+=(word)(256*GetData(&tempfile));
	    expectedlength=(header.length)+2;
	    if (header.type==0) nxtloadpos=header.start=23755;
	    else nxtloadpos=header.start;
	  }
       filepos=savefilepos;
     }
  else {
	 if (header.type>3) header.start=0;
	 header.type=0xf;
       }
  return loaded;
}

// Assembly:
subq $0x28, %rsp
movl $0x0, 0x20(%rsp)
movsd 0x9b84(%rip), %xmm0     # 0xf9e8
movsd %xmm0, 0x198ac(%rip)    # 0x1f718
movsd 0x9bf4(%rip), %xmm0     # 0xfa68
movsd %xmm0, 0x198bc(%rip)    # 0x1f738
movsd 0x9bdc(%rip), %xmm0     # 0xfa60
movsd %xmm0, 0x198cc(%rip)    # 0x1f758
movsd 0x9bc4(%rip), %xmm0     # 0xfa58
movsd %xmm0, 0x198dc(%rip)    # 0x1f778
callq 0x2d90
movb $0x0, 0x19d21(%rip)     # 0x1fbc9
movq $0x0, 0x19d0d(%rip) # 0x1fbc0
jmp 0x5eb5
leaq 0xa6a2(%rip), %rdi      # 0x1055e
movb $0x0, %al
callq 0x1090
movl $0x100, %edi            # imm = 0x100
callq 0x39e0
cmpb $0x0, 0x197cd(%rip)     # 0x1f6a1
jne 0x5ee3
movl $0x0, 0x24(%rsp)
jmp 0x61c9
cmpb $0x0, 0x19cce(%rip)     # 0x1fbb8
jne 0x5efc
movq $0x0, 0x19cc9(%rip) # 0x1fbc0
jmp 0x6021
xorps %xmm0, %xmm0
movsd %xmm0, 0xd2f9(%rip)     # 0x13200
callq 0x3ec0
cmpb $0x0, 0x1978e(%rip)     # 0x1f6a1
jne 0x5f22
movl $0x0, 0x24(%rsp)
jmp 0x61c9
cmpb $0x0, 0x19871(%rip)     # 0x1f79a
jne 0x5f30
jmp 0x6021
movsd 0x19830(%rip), %xmm0    # 0x1f768
movsd 0x19848(%rip), %xmm1    # 0x1f788
movl 0xd2ae(%rip), %edi      # 0x131f4
callq 0x4d70
movl %eax, 0x20(%rsp)
movzbl 0x1974b(%rip), %eax     # 0x1f6a1
cmpl $0x0, %eax
je 0x5ff3
movzbl 0xd22e(%rip), %eax      # 0x13194
cmpl $0x3, %eax
jl 0x5f85
movzbl 0xd222(%rip), %eax      # 0x13194
cmpl $0x6, %eax
jg 0x5f85
movl 0xd28b(%rip), %eax      # 0x13208
cmpl 0xd289(%rip), %eax      # 0x1320c
je 0x5ff3
callq 0x5d40
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, 0x8(%rsp)
testq %rax, %rax
movss %xmm0, 0xc(%rsp)
js 0x5fc3
movss 0x8(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0xc(%rsp), %xmm0
divss 0xd1ff(%rip), %xmm0     # 0x131d0
movss 0x9b6b(%rip), %xmm1     # 0xfb44
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
addsd 0xd217(%rip), %xmm0     # 0x13200
movsd %xmm0, 0xd20f(%rip)     # 0x13200
jmp 0x600b
movsd 0x9a75(%rip), %xmm0     # 0xfa70
addsd 0xd1fd(%rip), %xmm0     # 0x13200
movsd %xmm0, 0xd1f5(%rip)     # 0x13200
jmp 0x600d
cmpb $0x0, 0x19bb5(%rip)     # 0x1fbc9
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5eb5
jmp 0x6023
cmpb $0x0, 0x19b9f(%rip)     # 0x1fbc9
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5eb3
callq 0x18a0
cmpl $0x13, 0x20(%rsp)
jne 0x61a4
movq 0xd17a(%rip), %rax      # 0x131c8
movq %rax, 0x10(%rsp)
callq 0x18a0
leaq 0x15439(%rip), %rdi     # 0x1b498
callq 0x2370
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x6196
leaq 0x15421(%rip), %rdi     # 0x1b498
callq 0x2370
movb %al, 0x19b4e(%rip)      # 0x1fbd0
movb $0x0, 0x1f(%rsp)
movzbl 0x1f(%rsp), %eax
cmpl $0xa, %eax
jge 0x60ea
leaq 0x15400(%rip), %rdi     # 0x1b498
callq 0x2370
movb %al, %dl
movzbl 0x1f(%rsp), %eax
movl %eax, %ecx
leaq 0x19b23(%rip), %rax     # 0x1fbd0
movb %dl, 0x1(%rax,%rcx)
movzbl 0x1f(%rsp), %eax
movl %eax, %ecx
leaq 0x19b11(%rip), %rax     # 0x1fbd0
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x20, %eax
jge 0x60dc
movzbl 0x1f(%rsp), %eax
movl %eax, %ecx
leaq 0x19af9(%rip), %rax     # 0x1fbd0
movb $0x2a, 0x1(%rax,%rcx)
jmp 0x60de
movb 0x1f(%rsp), %al
addb $0x1, %al
movb %al, 0x1f(%rsp)
jmp 0x6087
movb $0x0, 0x19aea(%rip)     # 0x1fbdb
leaq 0x153a0(%rip), %rdi     # 0x1b498
callq 0x2370
movzbl %al, %eax
movl %eax, 0x19ad6(%rip)     # 0x1fbdc
leaq 0x1538b(%rip), %rdi     # 0x1b498
callq 0x2370
movzbl %al, %eax
shll $0x8, %eax
addl 0x19abe(%rip), %eax     # 0x1fbdc
movl %eax, 0x19ab8(%rip)     # 0x1fbdc
leaq 0x1536d(%rip), %rdi     # 0x1b498
callq 0x2370
movzbl %al, %eax
movl %eax, 0x19aa7(%rip)     # 0x1fbe0
leaq 0x15358(%rip), %rdi     # 0x1b498
callq 0x2370
movzbl %al, %eax
shll $0x8, %eax
addl 0x19a8f(%rip), %eax     # 0x1fbe0
movl %eax, 0x19a89(%rip)     # 0x1fbe0
movl 0x19a7f(%rip), %eax     # 0x1fbdc
addl $0x2, %eax
movl %eax, 0xd08e(%rip)      # 0x131f4
movzbl 0x19a63(%rip), %eax     # 0x1fbd0
cmpl $0x0, %eax
jne 0x6188
movl $0x5ccb, 0x19a64(%rip)  # imm = 0x5CCB
movl $0x5ccb, 0xd06a(%rip)   # imm = 0x5CCB
jmp 0x6194
movl 0x19a52(%rip), %eax     # 0x1fbe0
movl %eax, 0xd05c(%rip)      # 0x131f0
jmp 0x6196
movq 0x10(%rsp), %rax
movq %rax, 0xd026(%rip)      # 0x131c8
jmp 0x61c1
movzbl 0x19a25(%rip), %eax     # 0x1fbd0
cmpl $0x3, %eax
jle 0x61ba
movl $0x0, 0x19a26(%rip)     # 0x1fbe0
movb $0xf, 0x19a0f(%rip)     # 0x1fbd0
movl 0x20(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)