// File: /workspace/github_c_makefile_star2_O1/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::ted_process(short*, unsigned int)
void TED::ted_process(short *buffer, unsigned int count)
{
    do {
        switch(++beamx) {

            default:
                break;

            case 2:
                if (VertSubActive)
                	VertSubCount = (VertSubCount+1)&7;
                break;

            case 3:
				if (AttribFetch && beamy==0) {
					VertSubCount = 7;
				}
				break;

             case 4:
                 if (AttribFetch) {
					BadLine |= ((vshift)&7) == (beamy&7);
					if ( BadLine ) {
						ClockingState = THALT1;
					} else
                 		ClockingState = TSS;
                 	if (beamy==203) {
						AttribFetch = false;
						if (!(BadLine & 2)) ClockingState = TSS;
					}
				}
                break;

            case 8:
				HBlanking = false;
				break;

            case 10:
				if (VertSubActive)
					CharacterPosition = CharacterPositionReload;
                break;

            case 16:
				if (ScreenOn) {
					SideBorderFlipFlop = true;
					memset( scrptr, mcol[0], hshift);
					if (nrwscr)
						CharacterWindow = true;
					x = 0;
				}
				if (BadLine & 1)
					DoDMA(tmpClrbuf, 0);
				if (BadLine & 2)
					DoDMA(chrbuf, (BadLine & 1) ? 0 : 0x400);
                break;

			case 18:
				if (ScreenOn && !nrwscr) {
					CharacterWindow = true;
				}
				break;

			case 89:
				if (/*VertSubActive &&*/ VertSubCount == 6)
					CharacterCount = (CharacterCount + 40)&0x3FF;
				break;

            case 90:
    			if ( VertSubActive && VertSubCount == 7 )
					CharacterPositionReload = (CharacterPosition + 40)&0x3FF;
				break;

            case 91:
		    	ClockingState = TRFSH;
		    	break;

			case 94:
				if (ScreenOn && !nrwscr)
  					SideBorderFlipFlop = CharacterWindow = false;
				break;

  			case 96:
				if (ScreenOn && nrwscr)
  					SideBorderFlipFlop = CharacterWindow = false;
				// FIXME this breaks on FF1E writes
				if (BadLine & 1) {
					// swap DMA fetch pointers for colour DMA...
					unsigned char *tmpbuf = clrbuf;
					clrbuf = tmpClrbuf;
					tmpClrbuf = tmpbuf;
				}
  			    break;

			case 111:
				if ((BadLine&1)) {
    			    BadLine = 2;
					VertSubActive = true;
				} else if (BadLine&2) {// in the second bad line, we're finished...
   					BadLine &= ~2;
				}
				break;

            case 102:
		    	ClockingState = fastmode ? TDS : TSS;
		    	break;

		    case 104:
				HBlanking = true;
				break;

		    case 107: // HSYNC start
				break;

			case 256:
			case 128:
				beamx = 15;
				break;
			case 114: // HSYNC end
    			beamx=0;
    			// the beam reached a new line
    			TVScanLineCounter += 1;
    			if ( TVScanLineCounter >= 340 ) {
					TVScanLineCounter = 0;
					scrptr=screen;
//					render_ok=true;
				}
    			switch (++beamy) {

    			    case 4:
    			        if (!fltscr) ScreenOn = AttribFetch;
    			        break;

    			    case 8:
						if (fltscr) ScreenOn = AttribFetch;
    			        break;

					case 200:
						if (fltscr) ScreenOn = false;
						break;

    			    case 204:
						if (!fltscr) ScreenOn = false;
						break;

    			    case 205:
						CharacterCount = 0;
					    // cursor phase counter in TED register $1F
						VertSubActive = false;
						if ((++crsrphase&0x0F) == 0x0F)
    			        	crsrblinkon ^= 1;
    			        break;

					case 251:
						VBlanking = true;
						break;

    			    case 261: // Vertical retrace
						// frame ready...
						//render_ok=true;
						// reset screen pointer ("TV" electron beam)
						scrptr=screen;
						TVScanLineCounter = 0;
						break;

					case 271:
						VBlanking = false;
						break;

					case 512:
					case 312:
					    beamy = 0;
					    CharacterPosition = CharacterPositionReload = 0;
					    AttribFetch = (Ram[0xFF06]&0x10) != 0;
				}
				// is there raster interrupt?
				if (beamy == irqline)
					Ram[0xFF09] |= Ram[0xFF0A]&0x02 ? 0x82 : 0x02;
		}

		if (beamx&1) {	// perform these only in every second cycle
			if (t2on && !((timer2--)&0xFFFF)) {// Timer2 permitted
				timer2=0xFFFF;
				Ram[0xFF09] |= Ram[0xFF0A]&0x10 ? 0x90 : 0x10; // interrupt
			}
			if (t3on && !((timer3--)&0xFFFF)) {// Timer3 permitted
				timer3=0xFFFF;
				Ram[0xFF09] |= Ram[0xFF0A]&0x40 ? 0xC0 : 0x40; // interrupt
			}
			if (!CharacterWindow && !HBlanking && !VBlanking) {
				// we are on the border area, so use the frame color
				*((int*)(scrptr+4)) = framecol;
			}
			if (scrptr != endptr)
				scrptr+=8;
		} else {
			if (t1on && !timer1--) { // Timer1 permitted decreased and zero
				timer1=(t1start-1)&0xFFFF;
				Ram[0xFF09] |= Ram[0xFF0A]&0x08 ? 0x88 : 0x08; // interrupt
			}

			if (!(HBlanking |VBlanking)) {
				if (SideBorderFlipFlop) { // drawing the visible part of the screen
					// call the relevant rendering function
					//switch (scrattr) {
					//	case 0:
					//		hi_text();
					//		break;
					//	case REVERSE :
					//		rv_text();
					//		break;
					//	case MULTICOLOR|REVERSE :
					//	    mc_text_rvs();
					//	    break;
					//	case MULTICOLOR :
					//		mc_text();
					//		break;
					//	case EXTCOLOR|REVERSE :
					//	case EXTCOLOR :
					//		ec_text();
					//		break;
					//	case GRAPHMODE|REVERSE :
					//	case GRAPHMODE :
					//		hi_bitmap();
					//		break;
					//	case EXTCOLOR|MULTICOLOR :
					//	case GRAPHMODE|EXTCOLOR :
					//	case GRAPHMODE|MULTICOLOR|EXTCOLOR :
					//	case REVERSE|MULTICOLOR|EXTCOLOR :
					//	case GRAPHMODE|MULTICOLOR|EXTCOLOR|REVERSE :
					//		mcec();
					//		break;
					//	case GRAPHMODE|MULTICOLOR :
					//	case GRAPHMODE|MULTICOLOR|REVERSE :
					//		mc_bitmap();
					//		break;
					//	default:
				 //   		illegalbank();
				 //   		break;
					//}
					x = (x + 1) & 0x3F;
				}
				if (!CharacterWindow) {
					// we are on the border area, so use the frame color
					*((int*)scrptr) = framecol;
				}
			}

			CycleCounter++;
			if (!(CycleCounter & 0x03) && buffer && int(count) > 0) {
				static unsigned int remainder = 0;
				unsigned int samples = (playbackSpeed + remainder) / 4;
				if (samples) {
					renderSound(samples, buffer);
					if (sidCard) {
						short imBuf[128];
						sidCard->calcSamples(imBuf, samples);
						unsigned int i = samples - 1;
						do {
							buffer[i] += (short)(int(imBuf[i]) * int(masterVolume) / 1000);
						}while (i--);
					}
					storeToBuffer(buffer, samples);
				}
				remainder = (playbackSpeed + remainder) % 4;
				count -= samples;
				buffer += samples;
			}
		}
		if (aligned_write) {
			*aw_addr_ptr = aw_value;
			aligned_write = false;
		}
		switch (ClockingState|(beamx&1)) {
        	case TRFSH|1:
 	    	case TSS|1:
 	    	case TDS|1:
       		case TDS:
     	    	cpuptr->process();
     	    	break;
      		case THALT1|1:
  	    	case THALT2|1:
        	case THALT3|1:
            	cpuptr->stopcycle();
            	ClockingState<<=1;
            	break;
		}

	} while (int(count) > 0 && buffer);

	render_ok = false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x824(%rdi), %rax
movq %rax, 0x8(%rsp)
movl $0x47, %r13d
movl 0x81c(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x81c(%r14)
cmpl $0x57, %eax
jle 0xb2c2
cmpl $0x6d, %eax
jg 0xb300
addl $-0x58, %eax
cmpl $0xf, %eax
ja 0xb864
leaq 0x53b9(%rip), %rcx      # 0x1064c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x6, 0x1a1e5(%rip)     # 0x25488
jne 0xb864
movl 0x1a205(%rip), %eax     # 0x254b4
addl $0x28, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, 0x1a1f7(%rip)     # 0x254b4
jmp 0xb864
decl %eax
cmpl $0x10, %eax
ja 0xb864
leaq 0x5334(%rip), %rcx      # 0x10608
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x1, 0x1a1b4(%rip)     # 0x25498
jne 0xb864
movl 0x1a198(%rip), %eax     # 0x25488
incl %eax
andl $0x7, %eax
movl %eax, 0x1a18d(%rip)     # 0x25488
jmp 0xb864
cmpl $0x7e, %eax
jg 0xb3d1
cmpl $0x6e, %eax
je 0xb678
cmpl $0x71, %eax
jne 0xb864
movl $0x0, 0x81c(%r14)
movl 0x1a1a4(%rip), %eax     # 0x254d0
incl %eax
movl %eax, 0x1a19c(%rip)     # 0x254d0
cmpl $0x154, %eax            # imm = 0x154
jb 0xb351
movl $0x0, 0x1a18b(%rip)     # 0x254d0
movq 0x8(%rsp), %rax
movq %rax, 0xb6160(%r14)
movl 0x820(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x820(%r14)
cmpl $0xf9, %eax
jg 0xb6ae
cmpl $0xc6, %eax
jle 0xb7b5
cmpl $0xc7, %eax
je 0xb812
cmpl $0xcb, %eax
je 0xb827
cmpl $0xcc, %eax
jne 0xb838
movl $0x0, 0x1a111(%rip)     # 0x254b4
movb $0x0, 0x1a0ee(%rip)     # 0x25498
movl 0x45fac(%r14), %eax
incl %eax
movl %eax, 0x45fac(%r14)
notl %eax
testb $0xf, %al
jne 0xb838
xorb $0x1, 0x45fb0(%r14)
jmp 0xb838
cmpl $0x7f, %eax
je 0xb3e1
cmpl $0xff, %eax
jne 0xb864
movl $0xf, 0x81c(%r14)
jmp 0xb864
cmpb $0x1, 0x1a0b4(%rip)     # 0x254ac
jne 0xb864
cmpl $0x0, 0x820(%r14)
jne 0xb864
movl $0x7, 0x1a072(%rip)     # 0x25488
jmp 0xb864
cmpb $0x1, 0x1a08a(%rip)     # 0x254ac
jne 0xb864
movl 0x820(%r14), %ecx
movl 0xb6020(%r14), %eax
xorl %ecx, %eax
xorl %edx, %edx
testb $0x7, %al
sete %dl
movl 0x1a063(%rip), %eax     # 0x254a8
orl %eax, %edx
movl %edx, 0x1a05b(%rip)     # 0x254a8
movl $0x10, %edx
movl $0x2, %esi
cmovel %esi, %edx
movl %edx, 0x1a050(%rip)     # 0x254b0
cmpl $0xcb, %ecx
jne 0xb864
movb $0x0, 0x1a039(%rip)     # 0x254ac
testb $0x2, %al
jne 0xb864
movl $0x2, 0x1a02b(%rip)     # 0x254b0
jmp 0xb864
cmpb $0x1, 0x1a007(%rip)     # 0x25498
jne 0xb864
movl 0x1a003(%rip), %eax     # 0x254a0
movl %eax, 0x19ff9(%rip)     # 0x2549c
jmp 0xb864
movb $0x0, 0x1a01a(%rip)     # 0x254c9
jmp 0xb864
cmpb $0x1, 0x1a00f(%rip)     # 0x254ca
jne 0xb4fa
movb $0x1, 0x19fe0(%rip)     # 0x254a4
movq 0xb6160(%r14), %rdi
movl 0xb601c(%r14), %edx
movzbl 0xb618a(%r14), %esi
callq 0x3130
cmpl $0x0, 0xb6024(%r14)
je 0xb4f0
movb $0x1, 0x19fdb(%rip)     # 0x254cb
movl $0x0, 0x19fd2(%rip)     # 0x254cc
movl 0x19fa7(%rip), %r12d    # 0x254a8
testb $0x1, %r12b
je 0xb721
movq 0xb6100(%r14), %r13
movl 0x19f9c(%rip), %ebp     # 0x254b4
movq 0x19f71(%rip), %rax     # 0x25490
leaq (%rax,%rbp), %rsi
cmpq $0x3d8, %rbp            # imm = 0x3D8
jb 0xb702
movl $0x400, %edx            # imm = 0x400
subl %ebp, %edx
movq %r13, %rdi
movq %rax, (%rsp)
callq 0x31b0
subq %rbp, %r13
addq $0x400, %r13            # imm = 0x400
leal 0x28(%rbp), %edx
andl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
movq (%rsp), %rsi
callq 0x31b0
jmp 0xb71b
cmpb $0x1, 0x19f5c(%rip)     # 0x254ca
jne 0xb864
cmpl $0x0, 0xb6024(%r14)
jne 0xb864
movb $0x1, 0x19f42(%rip)     # 0x254cb
jmp 0xb864
cmpb $0x1, 0x19f35(%rip)     # 0x254ca
jne 0xb5af
cmpl $0x0, 0xb6024(%r14)
je 0xb5af
xorl %eax, %eax
movb %al, 0x19f22(%rip)      # 0x254cb
movb %al, 0x19ef5(%rip)      # 0x254a4
testb $0x1, 0x19ef2(%rip)     # 0x254a8
je 0xb864
movq 0xb60f8(%r14), %rax
movq 0xb6100(%r14), %rcx
movq %rcx, 0xb60f8(%r14)
movq %rax, 0xb6100(%r14)
jmp 0xb864
movl $0x8, 0x19ec9(%rip)     # 0x254b0
jmp 0xb864
cmpb $0x1, 0x19ea5(%rip)     # 0x25498
jne 0xb864
cmpl $0x7, 0x19e88(%rip)     # 0x25488
jne 0xb864
movl 0x19e90(%rip), %eax     # 0x2549c
addl $0x28, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, 0x19e86(%rip)     # 0x254a0
jmp 0xb864
cmpb $0x1, 0x19ea4(%rip)     # 0x254ca
jne 0xb864
cmpl $0x0, 0xb6024(%r14)
jne 0xb864
xorl %eax, %eax
movb %al, 0x19e89(%rip)      # 0x254cb
movb %al, 0x19e5c(%rip)      # 0x254a4
jmp 0xb864
movb $0x1, 0x19e75(%rip)     # 0x254c9
jmp 0xb864
xorl %eax, %eax
cmpl $0x0, 0xb6180(%r14)
setne %al
leal 0x2(,%rax,2), %eax
movl %eax, 0x19e3d(%rip)     # 0x254b0
jmp 0xb864
movl 0x19e2a(%rip), %eax     # 0x254a8
testb $0x1, %al
jne 0xb698
testb $0x2, %al
je 0xb864
andl $-0x4, %eax
movl %eax, 0x19e15(%rip)     # 0x254a8
jmp 0xb864
movl $0x2, 0x19e06(%rip)     # 0x254a8
movb $0x1, 0x19def(%rip)     # 0x25498
jmp 0xb864
cmpl $0x10d, %eax            # imm = 0x10D
jle 0xb7cb
cmpl $0x10e, %eax            # imm = 0x10E
je 0xb81e
cmpl $0x137, %eax            # imm = 0x137
je 0xb6d6
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0xb838
xorl %eax, %eax
movl %eax, 0x820(%r14)
movl %eax, 0x19dbb(%rip)     # 0x254a0
movl %eax, 0x19db1(%rip)     # 0x2549c
movb 0x55ec6(%r14), %al
shrb $0x4, %al
andb $0x1, %al
movb %al, 0x19daf(%rip)      # 0x254ac
jmp 0xb838
movq 0x20(%rsi), %rax
movq %rax, 0x20(%r13)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movl $0x47, %r13d
testb $0x2, %r12b
je 0xb864
movq 0xb60f0(%r14), %r13
notl %r12d
andl $0x1, %r12d
shll $0xa, %r12d
movl 0x19d71(%rip), %ebp     # 0x254b4
movq 0x19d46(%rip), %rax     # 0x25490
leaq (%rax,%rbp), %rsi
addq %r12, %rsi
cmpq $0x3d8, %rbp            # imm = 0x3D8
jb 0xb791
movl $0x400, %edx            # imm = 0x400
subl %ebp, %edx
movq %r13, %rdi
movq %rax, (%rsp)
callq 0x31b0
subq %rbp, %r13
addq $0x400, %r13            # imm = 0x400
movq (%rsp), %rsi
addq %r12, %rsi
leal 0x28(%rbp), %edx
andl $0x3ff, %edx            # imm = 0x3FF
movq %r13, %rdi
callq 0x31b0
jmp 0xb7aa
movq 0x20(%rsi), %rax
movq %rax, 0x20(%r13)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movl $0x47, %r13d
jmp 0xb864
cmpl $0x3, %eax
je 0xb7f1
cmpl $0x7, %eax
jne 0xb838
cmpl $0x0, 0xb6028(%r14)
jne 0xb7fb
jmp 0xb838
cmpl $0xfa, %eax
je 0xb809
cmpl $0x104, %eax            # imm = 0x104
jne 0xb838
movq 0x8(%rsp), %rax
movq %rax, 0xb6160(%r14)
movl $0x0, 0x19ce1(%rip)     # 0x254d0
jmp 0xb838
cmpl $0x0, 0xb6028(%r14)
jne 0xb838
movb 0x19cab(%rip), %al      # 0x254ac
movb %al, 0x19cc3(%rip)      # 0x254ca
jmp 0xb838
movb $0x1, 0x19cc4(%rip)     # 0x254d4
jmp 0xb838
cmpl $0x0, 0xb6028(%r14)
jne 0xb831
jmp 0xb838
movb $0x0, 0x19caf(%rip)     # 0x254d4
jmp 0xb838
cmpl $0x0, 0xb6028(%r14)
jne 0xb838
movb $0x0, 0x19c92(%rip)     # 0x254ca
movl 0x820(%r14), %eax
cmpl 0xb6184(%r14), %eax
jne 0xb864
testb $0x2, 0x55eca(%r14)
movl $0x82, %eax
movl $0x2, %ecx
cmovel %ecx, %eax
orb %al, 0x55ec9(%r14)
testb $0x1, 0x81c(%r14)
jne 0xb9d9
cmpb $0x1, 0x65fc0(%r14)
jne 0xb8b5
subl $0x1, 0x65fc4(%r14)
jae 0xb8b5
movl 0x65fd0(%r14), %eax
decl %eax
movzwl %ax, %eax
movl %eax, 0x65fc4(%r14)
testb $0x8, 0x55eca(%r14)
movl $0x88, %eax
movl $0x8, %ecx
cmovel %ecx, %eax
orb %al, 0x55ec9(%r14)
cmpb $0x0, 0x19c0d(%rip)     # 0x254c9
jne 0xb8fa
testb $0x1, 0x19c0f(%rip)     # 0x254d4
jne 0xb8fa
cmpb $0x1, 0x19bd6(%rip)     # 0x254a4
jne 0xb8e1
movl 0x19bf6(%rip), %eax     # 0x254cc
incl %eax
andl $0x3f, %eax
movl %eax, 0x19beb(%rip)     # 0x254cc
cmpb $0x0, 0x19be3(%rip)     # 0x254cb
jne 0xb8fa
movl 0xb6138(%r14), %eax
movq 0xb6160(%r14), %rcx
movl %eax, (%rcx)
movq 0x19b77(%rip), %rax     # 0x25478
incq %rax
movq %rax, 0x19b6d(%rip)     # 0x25478
testb $0x3, %al
jne 0xbaae
testq %r15, %r15
je 0xbaae
testl %ebx, %ebx
jle 0xbaae
movl 0x19bae(%rip), %eax     # 0x254d8
addl 0xb71b8(%r14), %eax
movl %eax, %r13d
shrl $0x2, %r13d
movl %r13d, %ebp
cmpl $0x4, %eax
jb 0xb9b1
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0xbf9e
movq 0xb71d0(%r14), %rdi
testq %rdi, %rdi
je 0xb9a3
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq *0x48(%rax)
leaq 0x19b71(%rip), %rax     # 0x254e0
movl (%rax), %eax
leal -0x1(%r13), %ecx
movl %r13d, %edx
movswl 0x10(%rsp,%rcx,2), %esi
imull %eax, %esi
movslq %esi, %rsi
imulq $0x10624dd3, %rsi, %rsi # imm = 0x10624DD3
movq %rsi, %rdi
shrq $0x3f, %rdi
shrq $0x26, %rsi
addl %edi, %esi
addw %si, (%r15,%rcx,2)
decq %rcx
decl %edx
jne 0xb978
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0xbf0a
movl 0x19b21(%rip), %eax     # 0x254d8
addl 0xb71b8(%r14), %eax
andl $0x3, %eax
movl %eax, 0x19b11(%rip)     # 0x254d8
subl %r13d, %ebx
leaq (%r15,%rbp,2), %r15
movl $0x47, %r13d
jmp 0xbaae
cmpb $0x1, 0x65fc1(%r14)
jne 0xba20
movl 0x65fc8(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x65fc8(%r14)
testw %ax, %ax
jne 0xba20
movl $0xffff, 0x65fc8(%r14) # imm = 0xFFFF
testb $0x10, 0x55eca(%r14)
movl $0x90, %eax
movl $0x10, %ecx
cmovel %ecx, %eax
orb %al, 0x55ec9(%r14)
cmpb $0x1, 0x65fc2(%r14)
jne 0xba67
movl 0x65fcc(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x65fcc(%r14)
testw %ax, %ax
jne 0xba67
movl $0xffff, 0x65fcc(%r14) # imm = 0xFFFF
testb $0x40, 0x55eca(%r14)
movl $0xc0, %eax
movl $0x40, %ecx
cmovel %ecx, %eax
orb %al, 0x55ec9(%r14)
cmpb $0x0, 0x19a5d(%rip)     # 0x254cb
jne 0xba93
cmpb $0x0, 0x19a52(%rip)     # 0x254c9
jne 0xba93
cmpb $0x0, 0x19a54(%rip)     # 0x254d4
jne 0xba93
movl 0xb6138(%r14), %eax
movq 0xb6160(%r14), %rcx
movl %eax, 0x4(%rcx)
movq 0xb6160(%r14), %rax
cmpq 0xb6168(%r14), %rax
je 0xbaae
addq $0x8, %rax
movq %rax, 0xb6160(%r14)
cmpb $0x1, 0x19a07(%rip)     # 0x254bc
jne 0xbacd
movb 0x19a0b(%rip), %al      # 0x254c8
movq 0x199fc(%rip), %rcx     # 0x254c0
movb %al, (%rcx)
movb $0x0, 0x199ef(%rip)     # 0x254bc
movl 0x81c(%r14), %eax
andl $0x1, %eax
orl 0x199d3(%rip), %eax     # 0x254b0
addl $-0x3, %eax
cmpl $0x3e, %eax
ja 0xbb1b
btq %rax, %r13
jae 0xbaf9
movq 0x45fb8(%r14), %rdi
callq 0x44b6
jmp 0xbb1b
movabsq $0x4000000040004000, %rcx # imm = 0x4000000040004000
btq %rax, %rcx
jae 0xbb1b
movq 0x45fb8(%r14), %rdi
callq 0x742e
shll 0x19995(%rip)           # 0x254b0
testl %ebx, %ebx
jle 0xbb28
testq %r15, %r15
jne 0xb261
movb $0x0, 0x45fa4(%r14)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq