LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC_CCITT(unsigned char*, int)
UWORD CalcCRC_CCITT(PUBYTE buf, int len)
{
	UWORD crc=~0;

	while (len--)
		crc=crctab_ccitt[*buf++^(crc>>8)] ^ (crc << 8);

	return crc;
}

// Assembly:
movl %esi, %ecx
movw $0xffff, %ax            # imm = 0xFFFF
xorl %edx, %edx
leaq 0x14146(%rip), %rsi     # 0x180f0
cmpl %edx, %ecx
je 0x3fcb
movzbl (%rdi,%rdx), %r8d
movzwl %ax, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
shll $0x8, %eax
xorw (%rsi,%r9,2), %ax
incq %rdx
jmp 0x3faa
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC16(unsigned char*, int, unsigned int)
UDWORD CalcCRC16(PUBYTE buf, int len, UDWORD seed)
{
	UWORD crc=(UWORD)seed;

	while (len--)
		crc=crctab_ccitt[*buf++^(crc>>8)] ^ (crc << 8);

	return crc;
}

// Assembly:
movl %esi, %eax
xorl %ecx, %ecx
leaq 0x14119(%rip), %rsi     # 0x180f0
cmpl %ecx, %eax
je 0x3ffd
movzbl (%rdi,%rcx), %r8d
movzwl %dx, %edx
movl %edx, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
movzwl (%rsi,%r9,2), %r8d
shll $0x8, %edx
xorl %r8d, %edx
incq %rcx
jmp 0x3fd7
movzwl %dx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC_ANSI(unsigned char*, int)
UWORD CalcCRC_ANSI(PUBYTE buf, int len)
{
	UWORD crc=0;

	while (len--)
		crc=crctab_ansi[*buf++^(crc>>8)] ^ (crc << 8);

	return crc;
}

// Assembly:
movl %esi, %ecx
xorl %edx, %edx
leaq 0x142e4(%rip), %rsi     # 0x182f0
xorl %eax, %eax
cmpl %edx, %ecx
je 0x402f
movzbl (%rdi,%rdx), %r8d
movzwl %ax, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
shll $0x8, %eax
xorw (%rsi,%r9,2), %ax
incq %rdx
jmp 0x400e
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodec.cpp
// Function: CCTRawCodec::Free()
void CCTRawCodec::Free()
{
	FreeCompressedDensity();
	FreeUncompressedDensity();
	FreeCompressedTrack();
	FreeUncompressedTrack();
	Clear();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x40b8
movq %rbx, %rdi
callq 0x40d6
movq %rbx, %rdi
callq 0x40f4
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x4124
movl $0xb8, %edx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x3110
nop
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodec.cpp
// Function: CCTRawCodec::FreeUncompressedTrack(CapsWH*)
void CCTRawCodec::FreeUncompressedTrack(PCAPSWH w)
{
	delete[] w->rawbuf;
	w->rawbuf = NULL;
	w->rawlen = 0;

	for (int trk = 0; trk < CAPS_MTRS; trk++) {
		w->trkbuf[trk] = NULL;
		w->trklen[trk] = 0;
	}

	w->trkcnt = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x4136
callq 0x3250
andq $0x0, 0x30(%rbx)
andl $0x0, 0x38(%rbx)
pushq $-0x14
popq %rax
testq %rax, %rax
je 0x4158
andq $0x0, 0x68(%rbx,%rax,2)
andl $0x0, 0x7c(%rbx,%rax)
addq $0x4, %rax
jmp 0x4142
andl $0x0, 0x7c(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodec.cpp
// Function: CCTRawCodec::Swap(unsigned int*, int)
void CCTRawCodec::Swap(PUDWORD buf, int cnt)
{
#ifdef INTEL
	for (cnt >>= 2; cnt > 0; cnt--, buf++) {
		UDWORD src = *buf;
		UDWORD dst = _lrotl(src, 8) & 0x00ff00ff | _lrotr(src, 8) & 0xff00ff00;
		*buf = dst;
	}
#endif
}

// Assembly:
sarl $0x2, %esi
testl %esi, %esi
jle 0x4173
movl (%rdi), %eax
bswapl %eax
movl %eax, (%rdi)
decl %esi
addq $0x4, %rdi
jmp 0x4161
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::DecompressDump(unsigned char*, int)
int CCTRawCodec::DecompressDump(PUBYTE buf, int len)
{
	CapsPack cpk;
	PCAPSPACK pk;

	// free all buffers
	Free();

	// check dump header
	int hlen = sizeof(CapsRaw);
	if (len < hlen)
		return imgeShort;
	wh.cr = *(PCAPSRAW)buf;
	Swap((PUDWORD)&wh.cr, sizeof(CapsRaw));

	// check dump size
	int tlen = wh.cr.time;
	int rlen = wh.cr.raw;
	if (len < hlen + tlen + rlen)
		return imgeShort;

	// check density information
	PUBYTE denbuf = buf + hlen;
	pk = GetPackHeader(&cpk, denbuf, tlen);
	if (!pk)
		return imgeDensityHeader;

	// check track information
	PUBYTE trkbuf = denbuf + tlen;
	pk = GetPackHeader(&cpk, trkbuf, rlen);
	if (!pk)
		return imgeTrackHeader;

	int err;

	// decompress density information
	wh.cdbuf = denbuf;
	wh.cdlen = tlen;
	if (!(err = DecompressDensity(1)))
		err = DecompressDensity();
	wh.cdbuf = NULL;
	if (err)
		return err;

	// decompress track data
	wh.ctbuf = trkbuf;
	wh.ctlen = rlen;
	if (!(err = DecompressTrack(1)))
		err = DecompressTrack();
	wh.ctbuf = NULL;

	return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
callq 0x406a
pushq $0x7
popq %rbp
cmpl $0x8, %r12d
jl 0x4220
leaq 0x8(%rbx), %rdi
movq (%r15), %rax
movq %rax, 0x8(%rbx)
pushq $0x8
popq %rsi
callq 0x415e
movl 0x8(%rbx), %r13d
movl 0xc(%rbx), %r14d
leal (%r14,%r13), %eax
addl $0x8, %eax
cmpl %r12d, %eax
jg 0x4220
addq $0x8, %r15
movq %rsp, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x4278
testq %rax, %rax
je 0x421d
movslq %r13d, %r12
addq %r15, %r12
movq %rsp, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x4278
pushq $0x8
popq %rbp
testq %rax, %rax
je 0x4220
movq %r15, 0x20(%rbx)
movl %r13d, 0x28(%rbx)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x42f6
testl %eax, %eax
je 0x4231
movl %eax, %ebp
addq $0x20, %rbx
movq %rbx, %r15
andq $0x0, (%r15)
jmp 0x4220
pushq $0xb
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
callq 0x42f6
movl %eax, %ebp
andq $0x0, 0x20(%rbx)
testl %eax, %eax
jne 0x4220
leaq 0x88(%rbx), %r15
movq %r12, 0x88(%rbx)
movl %r14d, 0x90(%rbx)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x43be
testl %eax, %eax
jne 0x4274
movq %rbx, %rdi
xorl %esi, %esi
callq 0x43be
movl %eax, %ebp
jmp 0x4217
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::GetPackHeader(CapsPack*, unsigned char*, int)
PCAPSPACK CCTRawCodec::GetPackHeader(PCAPSPACK cpk, PUBYTE src, int slen)
{
	// check header size
	if (!src || slen<sizeof(CapsPack))
		return NULL;

	// check signature
	if (memcmp(src, CAPS_IDPACK, sizeof(cpk->sign)))
		return NULL;

	// copy header to result
	memcpy(cpk, src, sizeof(CapsPack));

	// change header crc to host format and check crc
	Swap(&cpk->hcrc, sizeof(cpk->hcrc));
	UDWORD hcrc = cpk->hcrc;
	cpk->hcrc = 0;
	if (hcrc != CalcCRC((PUBYTE)cpk, sizeof(CapsPack)))
		return NULL;

	// change header to host format
	Swap(PUDWORD(PUBYTE(cpk) + sizeof(cpk->sign)), sizeof(CapsPack) - sizeof(cpk->sign));

	// buffer length must match the size of header and compressed data size
	if ((UDWORD)slen != sizeof(CapsPack) + cpk->csize)
		return NULL;

	return cpk;
}

// Assembly:
testq %rsi, %rsi
sete %al
cmpl $0x18, %edx
setb %cl
orb %al, %cl
jne 0x4290
cmpl $0x4b434150, (%rsi)     # imm = 0x4B434150
je 0x4293
xorl %eax, %eax
retq
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq %rax, 0x10(%rdi)
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
addq $0x14, %rdi
pushq $0x4
popq %rsi
callq 0x415e
movl 0x14(%rbx), %r14d
andl $0x0, 0x14(%rbx)
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x3f42
cmpl %eax, %r14d
jne 0x42ee
leaq 0x4(%rbx), %rdi
pushq $0x14
popq %rsi
callq 0x415e
movl %ebp, %ecx
movl 0xc(%rbx), %edx
addq $0x18, %rdx
xorl %eax, %eax
cmpq %rcx, %rdx
cmoveq %rbx, %rax
jmp 0x42f0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::DecompressDensity(int)
int CCTRawCodec::DecompressDensity(int verify)
{
	CapsPack cpk;

	// in decompress mode free result buffer first
	if (!verify)
		FreeUncompressedDensity();

	// get density header
	PCAPSPACK pk = GetPackHeader(&cpk, wh.cdbuf, wh.cdlen);
	if (!pk)
		return imgeDensityHeader;

	// check crc on compressed data in verify mode
	if (verify)
		if (pk->ccrc != CalcCRC(wh.cdbuf + sizeof(CapsPack), pk->csize))
			return imgeDensityStream;

	// decompress density data
	PUDWORD dst = DecompressDensity(wh.cdbuf, wh.cdlen);
	int res = imgeOk;

	if (verify) {
		// in verify mode get density data in target format
		Swap(dst, pk->usize);

		// check crc on uncompressed data
		if (pk->ucrc != CalcCRC((PUBYTE)dst, pk->usize))
			res = imgeDensityData;

		// free density data
		delete[] dst;
	}	else {
		// in decompress mode save density data
		wh.timbuf = dst;
		wh.timlen = pk->usize >> 2;
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
jne 0x4313
movq %rbx, %rdi
callq 0x40d6
movq 0x20(%rbx), %rsi
movl 0x28(%rbx), %edx
leaq 0x8(%rsp), %rdi
callq 0x4278
testq %rax, %rax
je 0x4396
movq %rax, %r14
testl %ebp, %ebp
je 0x434a
movl 0xc(%r14), %esi
movl 0x10(%r14), %r15d
movq 0x20(%rbx), %rdi
addq $0x18, %rdi
callq 0x3f42
cmpl %eax, %r15d
jne 0x439a
movq 0x20(%rbx), %rdi
movl 0x28(%rbx), %esi
xorl %r12d, %r12d
xorl %edx, %edx
callq 0x44ba
movq %rax, %r15
testl %ebp, %ebp
je 0x439f
movl 0x4(%r14), %esi
movq %r15, %rdi
callq 0x415e
movl 0x4(%r14), %esi
movl 0x8(%r14), %ebx
movq %r15, %rdi
callq 0x3f42
cmpl %eax, %ebx
pushq $0xd
popq %rbx
cmovel %r12d, %ebx
testq %r15, %r15
je 0x43af
movq %r15, %rdi
callq 0x3250
jmp 0x43af
pushq $0xb
jmp 0x439c
pushq $0xc
popq %rbx
jmp 0x43af
movq %r15, 0x10(%rbx)
movl 0x4(%r14), %eax
shrl $0x2, %eax
movl %eax, 0x18(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::DecompressTrack(int)
int CCTRawCodec::DecompressTrack(int verify)
{
	CapsPack cpk;
	CapsWH cwh;

	// in decompress mode free result buffer first
	if (!verify)
		FreeUncompressedTrack();

	// get track header
	PCAPSPACK pk = GetPackHeader(&cpk, wh.ctbuf, wh.ctlen);
	if (!pk)
		return imgeTrackHeader;

	// check crc on compressed data in verify mode
	if (verify)
		if (pk->ccrc != CalcCRC(wh.ctbuf + sizeof(CapsPack), pk->csize))
			return imgeTrackStream;

	// decompress track data
	PCAPSWH wb = DecompressTrack(&cwh, wh.ctbuf, wh.ctlen);
	int res = imgeOk;

	if (verify) {
		// in verify mode check crc on uncompressed data
		if (pk->ucrc != CalcCRC(wb->rawbuf, wb->rawlen))
			res = imgeTrackData;

		// free track data
		FreeUncompressedTrack(wb);
	} else {
		// in decompress mode save track data
		wh.rawbuf = wb->rawbuf;
		wh.rawlen = wb->rawlen;

		for (int trk = 0; trk < CAPS_MTRS; trk++) {
			wh.trkbuf[trk] = wb->trkbuf[trk];
			wh.trklen[trk] = wb->trklen[trk];
		}

		wh.trkcnt = wb->trkcnt;
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
jne 0x43de
movq %rbx, %rdi
callq 0x411a
movq 0x88(%rbx), %rsi
movl 0x90(%rbx), %edx
movq %rsp, %rdi
callq 0x4278
testq %rax, %rax
je 0x4463
movq %rax, %r15
testl %ebp, %ebp
je 0x441c
movl 0xc(%r15), %esi
movl 0x10(%r15), %r14d
movq 0x88(%rbx), %rdi
addq $0x18, %rdi
callq 0x3f42
cmpl %eax, %r14d
jne 0x4467
movq 0x88(%rbx), %rsi
movl 0x90(%rbx), %edx
xorl %r12d, %r12d
leaq 0x18(%rsp), %rdi
xorl %ecx, %ecx
callq 0x45da
movq %rax, %r14
testl %ebp, %ebp
je 0x446c
movl 0x8(%r15), %ebx
movq 0x30(%r14), %rdi
movl 0x38(%r14), %esi
callq 0x3f42
cmpl %eax, %ebx
pushq $0xa
popq %rbx
cmovel %r12d, %ebx
movq %r14, %rdi
callq 0x4124
jmp 0x44a8
pushq $0x8
jmp 0x4469
pushq $0x9
popq %rbx
jmp 0x44a8
movq 0x30(%r14), %rax
movq %rax, 0x38(%rbx)
movl 0x38(%r14), %eax
movl %eax, 0x40(%rbx)
xorl %eax, %eax
cmpq $0x14, %rax
je 0x449c
movq 0x40(%r14,%rax,2), %rcx
movq %rcx, 0x48(%rbx,%rax,2)
movl 0x68(%r14,%rax), %ecx
movl %ecx, 0x70(%rbx,%rax)
addq $0x4, %rax
jmp 0x447d
movl 0x7c(%r14), %eax
movl %eax, 0x84(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::DecompressTrack(CapsWH*, unsigned char*, int, unsigned char*)
PCAPSWH CCTRawCodec::DecompressTrack(PCAPSWH w, PUBYTE src, int slen, PUBYTE dst)
{
	CapsPack cpk;

	// get track header
	PCAPSPACK pk = GetPackHeader(&cpk, src, slen);
	if (!pk)
		return NULL;

	// use caller supplied buffer or allocate a new one
	w->rawbuf = NULL;
	FreeUncompressedTrack(w);
	w->rawlen = pk->usize;
	w->rawbuf = dst;
	if (!w->rawbuf && w->rawlen)
		w->rawbuf = new UBYTE[w->rawlen];

	// read track number
	w->ctmem = src + sizeof(CapsPack);
	w->trkcnt = CTR(w, 1);

	// read <track number> track sizes and calculate track buffer positions
	dst = w->rawbuf;
	for (int trk = 0; trk < w->trkcnt; trk++) {
		w->trklen[trk] = CTR(w, 2);
		w->trkbuf[trk] = dst;
		dst += w->trklen[trk];
	}

	// first track is stored
	if (w->trkcnt) {
		w->txsrc = w->trkbuf[0];
		w->txlen = w->trklen[0];
		memmove(w->txsrc, w->ctmem, w->txlen);
		w->ctmem += w->txlen;
	}

	// other tracks are compressed as deltas against the stored track
	for (w->txact = 1; w->txact < w->trkcnt; w->txact++)
		DecompressTrackData(w);

	return w;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4278
testq %rax, %rax
je 0x46db
movq %rax, %r12
andq $0x0, 0x30(%rbx)
movq %rbx, %rdi
callq 0x4124
movl 0x4(%r12), %eax
movl %eax, 0x38(%rbx)
movq %r15, 0x30(%rbx)
testq %r15, %r15
setne %cl
testl %eax, %eax
sete %dl
orb %cl, %dl
jne 0x4639
movslq %eax, %rdi
callq 0x3040
movq %rax, 0x30(%rbx)
addq $0x18, %r14
movq %r14, 0x90(%rbx)
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x46ee
movl %eax, 0x7c(%rbx)
movq 0x30(%rbx), %r15
xorl %r12d, %r12d
pushq $0x2
popq %r14
movslq %eax, %rcx
cmpq %rcx, %r12
jge 0x4689
movq %rbx, %rdi
movl %r14d, %esi
callq 0x46ee
movl %eax, 0x68(%rbx,%r12,4)
movq %r15, 0x40(%rbx,%r12,8)
cltq
addq %rax, %r15
incq %r12
movl 0x7c(%rbx), %eax
jmp 0x465f
testl %eax, %eax
je 0x46ce
movq 0x40(%rbx), %rdi
movq 0x90(%rbx), %rsi
movq %rdi, 0x98(%rbx)
movslq 0x68(%rbx), %rdx
movl %edx, 0xa0(%rbx)
callq 0x3330
movslq 0xa0(%rbx), %rax
addq %rax, 0x90(%rbx)
jmp 0x46ce
movq %rbx, %rdi
callq 0x4712
movl 0xa4(%rbx), %ebp
incl %ebp
movl %ebp, 0xa4(%rbx)
cmpl 0x7c(%rbx), %ebp
jl 0x46be
jmp 0x46dd
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::CTR(CapsWH*, int)
UDWORD CCTRawCodec::CTR(PCAPSWH w, int size)
{
	UDWORD res = 0;

	for (; size; size--) {
		res <<= 8;
		res |= *w->ctmem++;
	}

	return res;
}

// Assembly:
xorl %eax, %eax
subl $0x1, %esi
jb 0x4711
shll $0x8, %eax
movq 0x90(%rdi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x90(%rdi)
movzbl (%rcx), %ecx
orl %ecx, %eax
jmp 0x46f0
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/Codec/CTRawCodecDecompressor.cpp
// Function: CCTRawCodec::DecompressTrackData(CapsWH*)
void CCTRawCodec::DecompressTrackData(PCAPSWH w)
{
	// source stream
	PUBYTE src = w->ctmem;

	// destination buffer
	PUBYTE dst = w->trkbuf[w->txact];

	// end of destination buffer
	PUBYTE max = dst + w->trklen[w->txact];

	// first, stored track
	PUBYTE mem = w->txsrc;

	// decode the data, see compressor for encoding
	while (dst < max) {
		UDWORD size = *src++;

		if (size & 0x80) {
			// copy block
			// 3 bit shift
			int shift = size >> 4 & 7;

			// 12 bit size
			size = ((size & 0xf) << 8) | (*src++);

			// 16 bit offset
			UDWORD ofs = *src++;
			ofs = (ofs << 8) | (*src++);
			PUBYTE buf = mem + ofs;

			if (shift) {
				// bitshift copy
				ofs = *buf++;
				while (size--) {
					ofs = (ofs << 8) | (*buf++);
					*dst++ = (UBYTE)(ofs >> shift);
				}
			} else {
				// simple copy
				while (size--)
					*dst++ = *buf++;
			}
		} else {
			// data block, 15 bit size
			size = (size << 8) | (*src++);
			while (size--)
				*dst++ = *src++;
		}
	}

	// update the source stream position
	w->ctmem = src;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x90(%rdi), %rbx
movq 0x98(%rdi), %rax
movslq 0xa4(%rdi), %rcx
movq 0x40(%rdi,%rcx,8), %rdx
movslq 0x68(%rdi,%rcx,4), %rsi
addq %rdx, %rsi
leaq 0x1(%rax), %r8
cmpq %rsi, %rdx
jae 0x47f5
movzbl (%rbx), %r9d
testb %r9b, %r9b
js 0x4770
shll $0x8, %r9d
movzbl 0x1(%rbx), %ecx
addq $0x2, %rbx
orl %r9d, %ecx
subl $0x1, %ecx
jb 0x473c
movb (%rbx), %r9b
incq %rbx
movb %r9b, (%rdx)
incq %rdx
jmp 0x475d
movl %r9d, %ecx
shrl $0x4, %ecx
andl $0xf, %r9d
shll $0x8, %r9d
movzbl 0x2(%rbx), %r11d
shll $0x8, %r11d
leaq 0x4(%rbx), %r10
movzbl 0x3(%rbx), %r14d
movzbl 0x1(%rbx), %ebp
andl $0x7, %ecx
je 0x47ce
leaq (%r11,%r14), %rbx
movzbl (%rax,%rbx), %ebx
addl %ebp, %r9d
addq %r14, %r11
addq %r8, %r11
xorl %r14d, %r14d
cmpl %r14d, %r9d
je 0x47c9
shll $0x8, %ebx
movzbl (%r11,%r14), %ebp
orl %ebp, %ebx
movl %ebx, %ebp
shrl %cl, %ebp
movb %bpl, (%rdx,%r14)
incq %r14
jmp 0x47ad
addq %r14, %rdx
jmp 0x47ed
addl %ebp, %r9d
addq %r14, %r11
addq %rax, %r11
xorl %ecx, %ecx
cmpl %ecx, %r9d
je 0x47ea
movb (%r11,%rcx), %bl
movb %bl, (%rdx,%rcx)
incq %rcx
jmp 0x47d9
addq %rcx, %rdx
movq %r10, %rbx
jmp 0x473c
movq %rbx, 0x90(%rdi)
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSAddImage()
SDWORD __cdecl CAPSAddImage()
{
	// use the base image type as a placeholder, returning errors for the functions
	PCDISKIMAGE pi = new CDiskImage;
	unsigned pos;

	for (pos = 0; pos < img.size(); pos++) {
		if (img[pos])
			continue;

		img[pos] = pi;
		return pos;
	}

	img.push_back(pi);

	return pos;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0xb8, %edi
callq 0x31e0
movq %rax, %rbx
movq %rax, %rdi
callq 0xc5ac
movq %rbx, (%rsp)
movq 0x13cb4(%rip), %rcx     # 0x18518
movq 0x13ca5(%rip), %rax     # 0x18510
subq %rax, %rcx
sarq $0x3, %rcx
xorl %r14d, %r14d
movl %r14d, %r14d
cmpq %r14, %rcx
jbe 0x4889
cmpq $0x0, (%rax,%r14,8)
je 0x489a
incl %r14d
jmp 0x4875
leaq 0x13c80(%rip), %rdi     # 0x18510
movq %rsp, %rsi
callq 0x5152
jmp 0x489e
movq %rbx, (%rax,%r14,8)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movl $0xb8, %esi
movq %rbx, %rdi
callq 0x31f0
movq %r14, %rdi
callq 0x3380
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSRemImage(int)
SDWORD __cdecl CAPSRemImage(SDWORD id)
{
	if (id<0 || (unsigned)id>=img.size())
		return -1;

	delete img[id];
	img[id]=NULL;
	return id;
}

// Assembly:
pushq $-0x1
popq %rax
testl %edi, %edi
js 0x490f
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movl %edi, %r14d
movq 0x13c40(%rip), %rdx     # 0x18518
movq 0x13c31(%rip), %rcx     # 0x18510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x4908
movq (%rcx,%r14,8), %rdi
testq %rdi, %rdi
je 0x4901
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x13c0f(%rip), %rcx     # 0x18510
andq $0x0, (%rcx,%r14,8)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockImage(int, char*)
SDWORD __cdecl CAPSLockImage(SDWORD id, PCHAR name)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	CapsFile cf;
	memset(&cf, 0, sizeof(CapsFile));
	cf.name=name;

	return CAPSLockImage(id, &cf);
}

// Assembly:
pushq $0x3
popq %rax
testl %edi, %edi
js 0x4957
movl %edi, %ecx
movq 0x13bf8(%rip), %r8      # 0x18518
movq 0x13be9(%rip), %rdx     # 0x18510
subq %rdx, %r8
sarq $0x3, %r8
cmpq %rcx, %r8
jbe 0x4957
cmpq $0x0, (%rdx,%rcx,8)
je 0x4957
subq $0x18, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rax
movups %xmm0, 0x8(%rax)
movq %rsi, (%rax)
movq %rax, %rsi
callq 0x4958
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockImage(int, CapsFile*)
int CAPSLockImage(int id, PCAPSFILE pcf)
{
	int res = imgeOk;

	// get the possible image type used by the file
	int type = imgfactory.GetImageType(pcf);

	// check for file errors
	switch (type) {
		// problem with the file
		case citError:
			res = imgeOpen;
			break;

		// unknown file content
		case citUnknown:
			res = imgeType;
			break;
	}

	// file type is known and supported
	if (res == imgeOk) {
		PCDISKIMAGE newimg = imgfactory.CreateImage(type);

		if (newimg) {
			// delete the existing image class regardless of type since it can no longer be used
			CAPSRemImage(id);

			// add the new image class
			img[id] = newimg;

			// try to lock the file; this can still give an error as the checks will be more thorough
			res = img[id]->Lock(pcf);
		} else
			res = imgeGeneric;
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
movq %rsi, %rdi
callq 0xcfe0
testl %eax, %eax
je 0x4976
cmpl $0x1, %eax
jne 0x497a
pushq $0x6
jmp 0x49bb
pushq $0x5
jmp 0x49bb
movl %eax, %edi
callq 0xd26e
testq %rax, %rax
je 0x49b9
movq %rax, %r14
movl %ebp, %edi
callq 0x48c1
movslq %ebp, %rax
movq 0x13b76(%rip), %rcx     # 0x18510
movq %r14, (%rcx,%rax,8)
movq 0x13b6b(%rip), %rcx     # 0x18510
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
pushq $0x2
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockImageMemory(int, unsigned char*, unsigned int, unsigned int)
SDWORD __cdecl CAPSLockImageMemory(SDWORD id, PUBYTE buffer, UDWORD length, UDWORD flag)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	CapsFile cf;
	memset(&cf, 0, sizeof(CapsFile));
	cf.memmap=buffer;
	cf.size=length;
	cf.flag|=CFF_MEMMAP;
	if (flag & DI_LOCK_MEMREF)
		cf.flag|=CFF_MEMREF;

	return CAPSLockImage(id, &cf);
}

// Assembly:
pushq $0x3
popq %rax
testl %edi, %edi
js 0x4a1a
movl %edi, %r8d
movq 0x13b46(%rip), %r10     # 0x18518
movq 0x13b37(%rip), %r9      # 0x18510
subq %r9, %r10
sarq $0x3, %r10
cmpq %r8, %r10
jbe 0x4a1a
cmpq $0x0, (%r9,%r8,8)
je 0x4a1a
subq $0x18, %rsp
movq %rsp, %rax
andq $0x0, (%rax)
movq %rsi, 0x8(%rax)
movl %edx, 0x14(%rax)
shrb $0x7, %cl
movzbl %cl, %ecx
leal 0x2(,%rcx,4), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rsi
callq 0x4958
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSUnlockImage(int)
SDWORD __cdecl CAPSUnlockImage(SDWORD id)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	int res=img[id]->Unlock();

	return res;
}

// Assembly:
testl %edi, %edi
js 0x4a4a
movl %edi, %eax
movq 0x13af0(%rip), %rdx     # 0x18518
movq 0x13ae1(%rip), %rcx     # 0x18510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x4a4a
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x4a4a
movq (%rdi), %rax
jmpq *0x18(%rax)
pushq $0x3
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLoadImage(int, unsigned int)
SDWORD __cdecl CAPSLoadImage(SDWORD id, UDWORD flag)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	int res=img[id]->LoadImage(flag);

	return res;
}

// Assembly:
testl %edi, %edi
js 0x4a82
movl %edi, %eax
movq 0x13abd(%rip), %rdx     # 0x18518
movq 0x13aae(%rip), %rcx     # 0x18510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x4a82
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x4a82
movq (%rdi), %rax
movq 0x20(%rax), %rax
xorl %edx, %edx
jmpq *%rax
pushq $0x3
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetImageInfo(CapsImageInfo*, int)
SDWORD __cdecl CAPSGetImageInfo(PCAPSIMAGEINFO pi, SDWORD id)
{
	if (!pi)
		return imgeGeneric;

	memset(pi, 0, sizeof(CapsImageInfo));

	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	PDISKIMAGEINFO pd=img[id]->GetInfo();
	if (!pd)
		return imgeGeneric;

	// convert image info
	if (pd->civalid) {
		// use image info if available
		switch (pd->ci.type) {
			case cpimtFDD:
				pi->type = ciitFDD;
				break;

			default:
				pi->type = ciitNA;
				break;
		}

		pi->release = pd->ci.release;
		pi->revision = pd->ci.revision;
		pi->mincylinder = pd->ci.mincylinder;
		pi->maxcylinder = pd->ci.maxcylinder;
		pi->minhead = pd->ci.minhead;
		pi->maxhead = pd->ci.maxhead;
		CDiskImage::DecodeDateTime(&pi->crdt, &pd->ci.crdt);

		for (int plt = 0; plt < CAPS_MAXPLATFORM; plt++)
			pi->platform[plt] = pd->ci.platform[plt];
	} else {
		// image info not available
		if (pd->dmpcount) {
			// if there is at least one track dumped use dump information
			pi->type = ciitFDD;
			pi->release = 0;
			pi->revision = 0;
			pi->mincylinder = pd->umincylinder;
			pi->maxcylinder = pd->umaxcylinder;
			pi->minhead = pd->uminhead;
			pi->maxhead = pd->umaxhead;
		}	else {
			// invalid image type if not a dumped image and there is no information available
			pi->type = ciitNA;
		}
	}

	return imgeOk;
}

// Assembly:
pushq $0x2
popq %rcx
testq %rdi, %rdi
je 0x4b40
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
andq $0x0, 0x40(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
pushq $0x3
popq %rax
testl %esi, %esi
js 0x4b5f
movl %esi, %edx
movq 0x13a54(%rip), %rdi     # 0x18518
movq 0x13a45(%rip), %rsi     # 0x18510
subq %rsi, %rdi
sarq $0x3, %rdi
cmpq %rdx, %rdi
jbe 0x4b5f
movq (%rsi,%rdx,8), %r14
testq %r14, %r14
je 0x4b5f
cmpl $0x0, 0x8(%r14)
movl %ecx, %eax
je 0x4b5f
cmpl $0x0, 0x48(%r14)
je 0x4b43
xorl %eax, %eax
cmpl $0x1, 0x4c(%r14)
sete %al
movl %eax, (%rbx)
movsd 0x64(%r14), %xmm0
movsd 0x58(%r14), %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, 0x4(%rbx)
movq 0x6c(%r14), %rax
movq %rax, 0x14(%rbx)
leaq 0x1c(%rbx), %rdi
leaq 0x74(%r14), %rsi
callq 0xcca0
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x4b5f
movl 0x7c(%r14,%rcx,4), %edx
movl %edx, 0x38(%rbx,%rcx,4)
incq %rcx
jmp 0x4b2c
movl %ecx, %eax
retq
xorl %eax, %eax
cmpl $0x0, 0x30(%r14)
je 0x4b5f
movl $0x1, (%rbx)
andl $0x0, 0x8(%rbx)
movups 0x20(%r14), %xmm0
movups %xmm0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockTrackT0(CapsTrackInfo*, DiskTrackInfo*, unsigned int, unsigned int)
void CAPSLockTrackT0(PCAPSTRACKINFO pi, PDISKTRACKINFO pt, UDWORD ttype, UDWORD flag)
{
	pi->type=ttype;
	pi->cylinder=pt->cylinder;
	pi->head=pt->head;
	pi->sectorcnt=pt->sectorcnt;
	pi->sectorsize=0;
	pi->trackcnt=pt->trackcnt;
	pi->trackbuf=pt->trackbuf;
	pi->tracklen=(flag & DI_LOCK_TRKBIT) ? pt->trackbc : pt->tracklen;
	pi->timelen=pt->timecnt;
	pi->timebuf=pt->timebuf;

	for (int trk=0; trk < pt->trackcnt; trk++) {
		pi->trackdata[trk]=pt->trackdata[trk];
		pi->tracksize[trk]=pt->tracksize[trk];
	}
}

// Assembly:
movl %edx, (%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x4(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
andl $0x0, 0x10(%rdi)
movl 0x28(%rsi), %eax
movl %eax, 0x14(%rdi)
movq 0x48(%rsi), %rdx
leaq 0xe8(%rsi), %r8
btl $0xc, %ecx
leaq 0x50(%rsi), %rcx
cmovaeq %rcx, %r8
movq %rdx, 0x18(%rdi)
movl (%r8), %ecx
movl %ecx, 0x20(%rdi)
movl 0xa8(%rsi), %ecx
movl %ecx, 0x60(%rdi)
movq 0xb0(%rsi), %rcx
movq %rcx, 0x64(%rdi)
xorl %ecx, %ecx
cltq
cmpq %rax, %rcx
jge 0x4d62
movq 0x58(%rsi,%rcx,8), %rax
movq %rax, 0x24(%rdi,%rcx,8)
movl 0x80(%rsi,%rcx,4), %eax
movl %eax, 0x4c(%rdi,%rcx,4)
incq %rcx
movl 0x28(%rsi), %eax
jmp 0x4d3e
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockTrackT1(CapsTrackInfoT1*, DiskTrackInfo*, unsigned int, unsigned int)
void CAPSLockTrackT1(PCAPSTRACKINFOT1 pi, PDISKTRACKINFO pt, UDWORD ttype, UDWORD flag)
{
	pi->type=ttype;
	pi->cylinder=pt->cylinder;
	pi->head=pt->head;
	pi->sectorcnt=pt->sectorcnt;
	pi->sectorsize=0;
	pi->trackbuf=pt->trackbuf;
	pi->tracklen=(flag & DI_LOCK_TRKBIT) ? pt->trackbc : pt->tracklen;
	pi->timelen=pt->timecnt;
	pi->timebuf=pt->timebuf;
	pi->overlap=pt->overlap;
}

// Assembly:
movl %edx, (%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x4(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
andl $0x0, 0x10(%rdi)
movq 0x48(%rsi), %rax
movq %rax, 0x14(%rdi)
leaq 0xe8(%rsi), %rax
leaq 0x50(%rsi), %rdx
btl $0xc, %ecx
cmovaeq %rdx, %rax
movl (%rax), %eax
movl %eax, 0x1c(%rdi)
movl 0xa8(%rsi), %eax
movl %eax, 0x20(%rdi)
movq 0xb0(%rsi), %rax
movq %rax, 0x24(%rdi)
movl 0xe0(%rsi), %eax
movl %eax, 0x2c(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSLockTrackT2(CapsTrackInfoT2*, DiskTrackInfo*, unsigned int, unsigned int)
void CAPSLockTrackT2(PCAPSTRACKINFOT2 pi, PDISKTRACKINFO pt, UDWORD ttype, UDWORD flag)
{
	pi->type=ttype;
	pi->cylinder=pt->cylinder;
	pi->head=pt->head;
	pi->sectorcnt=pt->sectorcnt;
	pi->sectorsize=0;
	pi->trackbuf=pt->trackbuf;
	pi->tracklen=(flag & DI_LOCK_TRKBIT) ? pt->trackbc : pt->tracklen;
	pi->timelen=pt->timecnt;
	pi->timebuf=pt->timebuf;
	pi->overlap=pt->overlap;
	pi->startbit=pt->startbit;
	pi->wseed=pt->wseed;
	pi->weakcnt=pt->fdpsize;
}

// Assembly:
movl %edx, (%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x4(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
andl $0x0, 0x10(%rdi)
movq 0x48(%rsi), %rax
movq %rax, 0x14(%rdi)
leaq 0xe8(%rsi), %rax
leaq 0x50(%rsi), %rdx
btl $0xc, %ecx
cmovaeq %rdx, %rax
movl (%rax), %eax
movl %eax, 0x1c(%rdi)
movl 0xa8(%rsi), %eax
movl %eax, 0x20(%rdi)
movq 0xb0(%rsi), %rax
movq %rax, 0x24(%rdi)
movl 0xe0(%rsi), %eax
movl %eax, 0x2c(%rdi)
movl 0xf0(%rsi), %eax
movl %eax, 0x30(%rdi)
movl 0xc4(%rsi), %eax
movl %eax, 0x34(%rdi)
movl 0xd0(%rsi), %eax
movl %eax, 0x38(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSUnlockTrack(int, unsigned int, unsigned int)
SDWORD __cdecl CAPSUnlockTrack(SDWORD id, UDWORD cylinder, UDWORD head)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	PDISKTRACKINFO pt=img[id]->UnlockTrack(cylinder, head);

	return pt ? imgeOk : imgeOutOfRange;
}

// Assembly:
pushq $0x3
popq %rax
testl %edi, %edi
js 0x4e65
movl %edi, %ecx
movq 0x136e6(%rip), %r8      # 0x18518
movq 0x136d7(%rip), %rdi     # 0x18510
subq %rdi, %r8
sarq $0x3, %r8
cmpq %rcx, %r8
jbe 0x4e65
movq (%rdi,%rcx,8), %rdi
testq %rdi, %rdi
je 0x4e65
pushq %rax
xorl %ecx, %ecx
callq 0xc7f8
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
leal (%rcx,%rcx,2), %eax
addq $0x8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSUnlockAllTracks(int)
SDWORD __cdecl CAPSUnlockAllTracks(SDWORD id)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	img[id]->UnlockTrack();

	return imgeOk;
}

// Assembly:
pushq %rbx
pushq $0x3
popq %rbx
testl %edi, %edi
js 0x4e9c
movl %edi, %eax
movq 0x136a1(%rip), %rdx     # 0x18518
movq 0x13692(%rip), %rcx     # 0x18510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x4e9c
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x4e9c
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xc750
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetVersionInfo(void*, unsigned int)
SDWORD __cdecl CAPSGetVersionInfo(PVOID pversioninfo, UDWORD flag)
{
	if (!pversioninfo)
		return imgeGeneric;

	// structure revision is zero, unless newer one requested
	unsigned rev=0;
	if (flag & DI_LOCK_TYPE)
		rev=*(PUDWORD)pversioninfo;

	// if unsupported type set the highest supported version
	if (rev > 0) {
		*(PUDWORD)pversioninfo=0;
		return imgeUnsupportedType;
	}

	// clear structure
	memset(pversioninfo, 0, sizeversioninfo[rev]);

	// get the correct structure
	switch (rev) {
		case 0:
			CAPSGetVersionInfoT0((PCAPSVERSIONINFO)pversioninfo);
			break;
	}

	return imgeOk;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4eec
movq %rdi, %rbx
btl $0x9, %esi
jae 0x4ec2
cmpl $0x0, (%rbx)
je 0x4ec2
andl $0x0, (%rbx)
pushq $0xf
jmp 0x4eee
movslq 0x1235b(%rip), %rdx     # 0x17224
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3110
movabsq $0x100000005, %rax      # imm = 0x100000005
movq %rax, 0x4(%rbx)
movl $0x7fff, 0xc(%rbx)      # imm = 0x7FFF
jmp 0x4eef
pushq $0x2
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetInfo(void*, int, unsigned int, unsigned int, unsigned int, unsigned int)
SDWORD __cdecl CAPSGetInfo(PVOID pinfo, SDWORD id, UDWORD cylinder, UDWORD head, UDWORD inftype, UDWORD infid)
{
	if (!pinfo)
		return imgeGeneric;

	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	PDISKIMAGEINFO pd = img[id]->GetInfo();
	PDISKTRACKINFO pt = img[id]->GetTrack(cylinder, head);

	int res=imgeUnsupportedType;

	switch (inftype) {
		case cgiitSector:
			res=CAPSGetSectorInfo((PCAPSSECTORINFO)pinfo, pd, pt, infid);
			break;

		case cgiitWeak:
			res=CAPSGetWeakInfo((PCAPSDATAINFO)pinfo, pd, pt, infid);
			break;

		case cgiitRevolution:
			res = CAPSGetRevolutionInfo((PCAPSREVOLUTIONINFO)pinfo, pd, pt, infid);
			break;
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4f92
pushq $0x3
popq %r15
testl %esi, %esi
js 0x4f96
movq %rdi, %rbx
movl %esi, %eax
movq 0x135e6(%rip), %rdi     # 0x18518
movq 0x135d7(%rip), %rsi     # 0x18510
subq %rsi, %rdi
sarq $0x3, %rdi
cmpq %rax, %rdi
jbe 0x4f96
movq (%rsi,%rax,8), %r12
testq %r12, %r12
je 0x4f96
movl %r9d, %ebp
movl %r8d, %r14d
movl 0x8(%r12), %r13d
movq %r12, %rdi
movl %edx, %esi
movl %ecx, %edx
callq 0xc9c4
cmpl $0x3, %r14d
je 0x4fc3
cmpl $0x2, %r14d
je 0x4fa8
cmpl $0x1, %r14d
jne 0x4fe3
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4fe7
pushq $0x2
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %rax, %rdx
movl %ebp, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5042
addq $0x8, %r12
xorl %r15d, %r15d
testl %r13d, %r13d
movl $0x0, %esi
cmovneq %r12, %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x508d
jmp 0x4f96
pushq $0xf
jmp 0x4f94
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetWeakInfo(CapsDataInfo*, DiskImageInfo*, DiskTrackInfo*, unsigned int)
int CAPSGetWeakInfo(PCAPSDATAINFO pi, PDISKIMAGEINFO pd, PDISKTRACKINFO pt, UDWORD infid)
{
	memset(pi, 0, sizeof(CapsDataInfo));

	if (!pt)
		return imgeOutOfRange;

	if (pt->fdpsize <= 0 || !pt->fdp)
		return imgeOutOfRange;

	if (infid >= (unsigned)pt->fdpsize)
		return imgeOutOfRange;

	PDISKDATAMARK dm=pt->fdp+infid;

	pi->type=cditWeak;
	pi->start=dm->position;
	pi->size=dm->size;

	return imgeOk;
}

// Assembly:
andl $0x0, 0x8(%rdi)
andq $0x0, (%rdi)
pushq $0x3
popq %rax
testq %rdx, %rdx
je 0x508c
movl 0xd0(%rdx), %esi
testl %esi, %esi
jle 0x508c
movq 0xd8(%rdx), %rdx
testq %rdx, %rdx
sete %r8b
cmpl %ecx, %esi
setbe %sil
orb %r8b, %sil
jne 0x508c
movl %ecx, %eax
movl $0x1, (%rdi)
imulq $0xc, %rax, %rax
movq 0x4(%rdx,%rax), %rax
movq %rax, 0x4(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetRevolutionInfo(CapsRevolutionInfo*, DiskImageInfo*, DiskTrackInfo*, unsigned int)
int CAPSGetRevolutionInfo(PCAPSREVOLUTIONINFO pi, PDISKIMAGEINFO pd, PDISKTRACKINFO pt, UDWORD infid)
{
	memset(pi, 0, sizeof(CapsRevolutionInfo));

	// set image data if image is valid
	if (pd) {
		// next, last and real revolution used by lock track
		pi->next = pd->nextrev;
		pi->last = pd->lastrev;
		pi->real = pd->realrev;
	}

	// set track data if track is valid
	if (pt) {
		// use the revolutions sampled for raw dumps, -1 (unlimited/randomized) otherwise
		pi->max = (pt->rawdump) ? pt->rawtrackcnt : -1;
	}

	return imgeOk;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
testq %rsi, %rsi
je 0x50a5
movq 0x34(%rsi), %rax
movq %rax, (%rdi)
movl 0x3c(%rsi), %eax
movl %eax, 0x8(%rdi)
testq %rdx, %rdx
je 0x50bb
cmpl $0x0, 0x44(%rdx)
je 0x50b5
movl 0x2c(%rdx), %eax
jmp 0x50b8
pushq $-0x1
popq %rax
movl %eax, 0xc(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSSetRevolution(int, unsigned int)
SDWORD __cdecl CAPSSetRevolution(SDWORD id, UDWORD value)
{
	if (id<0 || (unsigned)id >= img.size() || !img[id])
		return imgeOutOfRange;

	PDISKIMAGEINFO pd = img[id]->GetInfo();
	if (!pd)
		return imgeGeneric;

	// set revolution
	pd->nextrev = value;

	return imgeOk;
}

// Assembly:
pushq $0x3
popq %rax
testl %edi, %edi
js 0x50f5
movl %edi, %ecx
movq 0x1344a(%rip), %rdi     # 0x18518
movq 0x1343b(%rip), %rdx     # 0x18510
subq %rdx, %rdi
sarq $0x3, %rdi
cmpq %rcx, %rdi
jbe 0x50f5
movq (%rdx,%rcx,8), %rcx
testq %rcx, %rcx
je 0x50f5
cmpl $0x0, 0x8(%rcx)
je 0x50f6
movl %esi, 0x3c(%rcx)
xorl %eax, %eax
retq
pushq $0x2
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsAPI.cpp
// Function: CAPSGetImageTypeMemory(unsigned char*, unsigned int)
SDWORD __cdecl CAPSGetImageTypeMemory(PUBYTE buffer, UDWORD length)
{
	CapsFile cf;
	memset(&cf, 0, sizeof(CapsFile));
	cf.memmap = buffer;
	cf.size = length;
	cf.flag |= CFF_MEMMAP | CFF_MEMREF;

	// get the possible image type used by the file
	return imgfactory.GetImageType(&cf);
}

// Assembly:
subq $0x18, %rsp
movq %rsp, %rax
andq $0x0, (%rax)
movq %rdi, 0x8(%rax)
movl %esi, 0x14(%rax)
movl $0x6, 0x10(%rax)
movq %rax, %rdi
callq 0xcfe0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsFDCEmulator.cpp
// Function: FdcComT1_SpinupLoop(CapsFdc*)
void FdcComT1_SpinupLoop(PCAPSFDC pc)
{
	// clock cycles to complete
	UDWORD cmax=pc->clockreq-pc->clockact;

	// if no drive selected run all cycles index can't happen
	if (!pc->driveprc) {
		FdcComIdle(pc, cmax);
		return;
	}

	// if index can't happen on enabled drive run all cycles
	PCAPSDRIVE pd=pc->driveprc;
	if ((pd->diskattr & CAPSDRIVE_DA_IPMASK) != CAPSDRIVE_DA_IPMASK) {
		FdcComIdle(pc, cmax);
		return;
	}

	// if index or spin-up event won't happen, run it all
	if ((pd->idistance+cmax<pd->clockrev) || (pc->spinupcnt+1 < pc->spinuplimit)){
		FdcComIdle(pc, cmax);
		return;
	}

	// cycles until index
	cmax=pd->clockrev-pd->idistance;

	// index and spin-up happens now, only run cycles until index
	if (FdcComIdle(pc, cmax) != cmax)
		return;

	// end loop, but only if wait was complete
	pc->runstate++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %esi
subl 0xc(%rdi), %esi
movq 0x100(%rdi), %rcx
testq %rcx, %rcx
je 0x5395
movl 0x20(%rcx), %eax
notl %eax
testb $0x5, %al
jne 0x5395
movl 0x24(%rcx), %eax
movl 0x28(%rcx), %ebp
leal (%rax,%rsi), %ecx
cmpl %ebp, %ecx
jb 0x5395
movl 0xa4(%rbx), %ecx
incl %ecx
cmpl 0xa8(%rbx), %ecx
jge 0x53a3
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x63c9
subl %eax, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x63c9
cmpl %ebp, %eax
jne 0x53b6
incl 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsFDCEmulator.cpp
// Function: FdcComT1_VerifyLoop(CapsFdc*)
void FdcComT1_VerifyLoop(PCAPSFDC pc)
{
	// update data access
	FdcUpdateData(pc);

	// get access hook, crc
	FDCREAD ph=FdcGetReadAccess(pc);

	// clock cycles to complete
	UDWORD cst=pc->clockact;

	// process requested cycles
	while (!pc->endrequest && pc->clockact<pc->clockreq) {
		// read byte when ready
		if (!ph(pc))
			continue;

		// check ID
		switch (pc->dataphase) {
			case 0:
				// AM detected, read returns on dsr ready
				pc->amisigmask=CAPSFDC_AI_DSRREADY;
				pc->dataphase++;
				break;

			case 1:
				//if not fc...ff, restart
				if (pc->dsr < 0xfc) {
					FdcResetAm(pc);
					continue;
				}

				pc->dataphase++;
				break;

			case 2:
				//if not the track, restart
				if (pc->dsr != pc->r_track) {
					FdcResetAm(pc);
					continue;
				}

				pc->dataphase++;
				break;

			// skip rest ofID
			case 3:
			case 4:
			case 5:
			case 6:
				pc->dataphase++;
				break;

			case 7:
				// if crc error, set crc flag, restart
				if (pc->crc & 0xffff) {
					FdcResetAm(pc);
					pc->r_st0|=CAPSFDC_SR_CRCERR;
					continue;
				}

				// clear crc flag, stop
				pc->r_st0&=~CAPSFDC_SR_CRCERR;

				// run cycles used on unselected drives
				FdcComIdleOther(pc, pc->clockact-cst);

				// end
				pc->endrequest|=CAPSFDC_ER_COMEND;
				return;

			default:
				NODEFAULT;
		}
	}

	// end requested, set seek error
	if (pc->endrequest & CAPSFDC_ER_COMEND)
		pc->r_st0|=CAPSFDC_SR_RNF;

	// run cycles on unselected drives
	FdcComIdleOther(pc, pc->clockact-cst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x647b
movq %rbx, %rdi
callq 0x653e
movq %rax, %r14
movl 0xc(%rbx), %ebp
leaq 0x9ae5(%rip), %r15      # 0xf07c
movl 0x8(%rbx), %eax
testl %eax, %eax
jne 0x565f
movl 0xc(%rbx), %eax
cmpl 0x10(%rbx), %eax
jae 0x5667
movq %rbx, %rdi
callq *%r14
testl %eax, %eax
je 0x5597
movl 0x8c(%rbx), %eax
movslq (%r15,%rax,4), %rcx
addq %r15, %rcx
jmpq *%rcx
incl %eax
movl %eax, 0x8c(%rbx)
jmp 0x5597
movl 0x78(%rbx), %eax
cmpl 0x40(%rbx), %eax
jne 0x5630
movl $0x3, 0x8c(%rbx)
jmp 0x5597
cmpw $0x0, 0x54(%rbx)
je 0x567e
movl 0x60(%rbx), %eax
andl $-0x10, %eax
orl $0x3, %eax
movl %eax, 0x60(%rbx)
movl $0x200, 0x64(%rbx)      # imm = 0x200
andq $0x0, 0x8c(%rbx)
orb $0x8, 0x30(%rbx)
jmp 0x5597
movl $0x100, 0x64(%rbx)      # imm = 0x100
movl $0x1, 0x8c(%rbx)
jmp 0x5597
cmpl $0xfb, 0x78(%rbx)
ja 0x5650
movl 0x60(%rbx), %eax
andl $-0x10, %eax
orl $0x3, %eax
movl %eax, 0x60(%rbx)
movl $0x200, 0x64(%rbx)      # imm = 0x200
andq $0x0, 0x8c(%rbx)
jmp 0x5597
movl $0x2, 0x8c(%rbx)
jmp 0x5597
testb $0x1, %al
je 0x5667
orb $0x10, 0x30(%rbx)
movl 0xc(%rbx), %esi
subl %ebp, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6572
andb $-0x9, 0x30(%rbx)
movl 0xc(%rbx), %esi
subl %ebp, %esi
movq %rbx, %rdi
callq 0x6572
orb $0x1, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsFDCEmulator.cpp
// Function: FdcComT3_IndexLoop(CapsFdc*)
void FdcComT3_IndexLoop(PCAPSFDC pc)
{
	// clock cycles to complete
	UDWORD cmax=pc->clockreq-pc->clockact;

	// if no drive selected run all cycles index can't happen
	if (!pc->driveprc) {
		FdcComIdle(pc, cmax);
		return;
	}

	// if index can't happen on enabled drive run all cycles
	PCAPSDRIVE pd=pc->driveprc;
	if ((pd->diskattr & CAPSDRIVE_DA_IPMASK) != CAPSDRIVE_DA_IPMASK) {
		FdcComIdle(pc, cmax);
		return;
	}

	// if index event won't happen, run it all
	if (pd->idistance+cmax < pd->clockrev){
		FdcComIdle(pc, cmax);
		return;
	}

	// cycles until index
	cmax=pd->clockrev-pd->idistance;

	// index happens now, only run cycles until index
	if (FdcComIdle(pc, cmax) != cmax)
		return;

	// end loop, but only if wait was complete
	pc->runstate++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %esi
subl 0xc(%rdi), %esi
movq 0x100(%rdi), %rax
testq %rax, %rax
je 0x5a30
movl 0x20(%rax), %ecx
notl %ecx
testb $0x5, %cl
jne 0x5a30
movl 0x24(%rax), %ecx
movl 0x28(%rax), %ebp
leal (%rcx,%rsi), %eax
cmpl %ebp, %eax
jae 0x5a3e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x63c9
subl %ecx, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x63c9
cmpl %ebp, %eax
jne 0x5a51
incl 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsFDCEmulator.cpp
// Function: FdcComT3_ReadLoop(CapsFdc*)
void FdcComT3_ReadLoop(PCAPSFDC pc)
{
	// update data access
	FdcUpdateData(pc);

	// get access hook, crc
	FDCREAD ph=FdcGetReadAccess(pc);

	// clock cycles to complete
	UDWORD cst=pc->clockact;

	// process requested cycles
	while (!pc->endrequest && pc->clockact<pc->clockreq) {
		// read byte when ready
		if (!ph(pc))
			continue;

		// dsr to data, drq signal
		pc->r_data=pc->dsr;
		FdcSetLine(pc, pc->lineout|CAPSFDC_LO_DRQSET);
	}

	// run cycles on unselected drives
	FdcComIdleOther(pc, pc->clockact-cst);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x647b
movq %rbx, %rdi
callq 0x653e
movq %rax, %r14
movl 0xc(%rbx), %ebp
movl %ebp, %esi
cmpl $0x0, 0x8(%rbx)
jne 0x5ac5
cmpl 0x10(%rbx), %esi
jae 0x5ac5
movq %rbx, %rdi
callq *%r14
testl %eax, %eax
je 0x5ac0
movl 0x24(%rbx), %esi
movl 0x78(%rbx), %eax
movl %eax, 0x48(%rbx)
orl $0x40, %esi
movq %rbx, %rdi
callq 0x61aa
movl 0xc(%rbx), %esi
jmp 0x5a97
subl %ebp, %esi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6572
// File: /workspace/github_cpp_makefile_star2_O2/OpenFodder[P]SOS_Unpacker/capsimg/CAPSImg/CapsFDCEmulator.cpp
// Function: FdcComT3_AddressLoop(CapsFdc*)
void FdcComT3_AddressLoop(PCAPSFDC pc)
{
	// update data access
	FdcUpdateData(pc);

	// get access hook, crc
	FDCREAD ph=FdcGetReadAccess(pc);

	// clock cycles to complete
	UDWORD cst=pc->clockact;

	// process requested cycles
	while (!pc->endrequest && pc->clockact<pc->clockreq) {
		// read byte when ready
		if (!ph(pc))
			continue;

		// check ID
		switch (pc->dataphase) {
			// detect a1 sync
			case 0:
				// AM detected, read returns on dsr ready
				pc->amisigmask=CAPSFDC_AI_DSRREADY;
				pc->dataphase++;
				break;

			case 1:
				//if not fc...ff, restart
				if (pc->dsr < 0xfc) {
					FdcResetAm(pc);
					continue;
				}

				pc->dataphase++;
				break;

			case 2:
				// set the sector register to the track number
				pc->r_sector=pc->dsr;

			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
				// dsr to data, drq signal
				pc->r_data=pc->dsr;
				FdcSetLine(pc, pc->lineout|CAPSFDC_LO_DRQSET);

				// next phase
				if (pc->dataphase++ == 7) {
					// if crc error, set crc flag
					if (pc->crc & 0xffff)
						pc->r_st0|=CAPSFDC_SR_CRCERR;

					// run cycles used on unselected drives
					FdcComIdleOther(pc, pc->clockact-cst);

					// end
					pc->endrequest|=CAPSFDC_ER_COMEND;
					return;
				}
				break;

			default:
				NODEFAULT;
		}
	}

	// end requested, set seek error
	if (pc->endrequest & CAPSFDC_ER_COMEND)
		pc->r_st0|=CAPSFDC_SR_RNF;

	// run cycles on unselected drives
	FdcComIdleOther(pc, pc->clockact-cst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x647b
movq %rbx, %rdi
callq 0x653e
movq %rax, %r14
movl 0xc(%rbx), %ebp
leaq 0x95b5(%rip), %r15      # 0xf0d8
movl 0x8(%rbx), %eax
testl %eax, %eax
jne 0x5bd0
movl 0xc(%rbx), %eax
cmpl 0x10(%rbx), %eax
jae 0x5bd8
movq %rbx, %rdi
callq *%r14
testl %eax, %eax
je 0x5b23
movl 0x8c(%rbx), %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movl 0x24(%rbx), %esi
movl 0x78(%rbx), %eax
movl %eax, 0x48(%rbx)
orl $0x40, %esi
movq %rbx, %rdi
callq 0x61aa
movl 0x8c(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x8c(%rbx)
cmpl $0x7, %eax
jne 0x5b23
jmp 0x5bef
movl $0x100, 0x64(%rbx)      # imm = 0x100
movl $0x1, 0x8c(%rbx)
jmp 0x5b23
cmpl $0xfb, 0x78(%rbx)
ja 0x5bc1
movl 0x60(%rbx), %eax
andl $-0x10, %eax
orl $0x3, %eax
movl %eax, 0x60(%rbx)
movl $0x200, 0x64(%rbx)      # imm = 0x200
andq $0x0, 0x8c(%rbx)
jmp 0x5b23
movl 0x78(%rbx), %eax
movl %eax, 0x44(%rbx)
jmp 0x5b53
movl $0x2, 0x8c(%rbx)
jmp 0x5b23
testb $0x1, %al
je 0x5bd8
orb $0x10, 0x30(%rbx)
movl 0xc(%rbx), %esi
subl %ebp, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6572
cmpw $0x0, 0x54(%rbx)
je 0x5bfa
orb $0x8, 0x30(%rbx)
movl 0xc(%rbx), %esi
subl %ebp, %esi
movq %rbx, %rdi
callq 0x6572
orb $0x1, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq