LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/run-child-proc.cc
// Function: move_reserved_fd(int*, int)
static int move_reserved_fd(int *fd, int min_fd)
{
    int new_fd = fcntl(*fd, F_DUPFD_CLOEXEC, min_fd);
    if (new_fd != -1) {
        close(*fd);
        *fd = new_fd;
    }
    return new_fd;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %edx
movq %rdi, %rbx
movl (%rdi), %edi
movl $0x406, %esi            # imm = 0x406
xorl %eax, %eax
callq 0x8390
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x2fd25
movl (%rbx), %edi
callq 0x8b60
movl %ebp, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ReadBitWrap(unsigned char*, unsigned int, unsigned int, int)
uint32_t CBitBuffer::ReadBitWrap(uint8_t *buf, uint32_t bufwrap, uint32_t bitpos, int bitcnt)
{
	uint32_t res;

	// slow read mode if buffer would wrap around during reading, otherwise use fast read
	if (bitpos + bitcnt > bufwrap) {
		// slow mode; read bit by bit
		res = 0;

		// read all bits
		while (bitcnt-- > 0) {
			// shift in the next bit
			res <<= 1;
			if (ReadBit(buf, bitpos))
				res |= 1;

			// advance bit position
			bitpos++;

			// handle buffer wrap around
			if (bitpos >= bufwrap)
				bitpos -= bufwrap;
		}
	} else {
		// fast mode; read at once
		res = ReadBit(buf, bitpos, bitcnt);
	}

	return res;
}

// Assembly:
leal (%rcx,%rdx), %eax
cmpl %esi, %eax
jbe 0x49ff
testl %ecx, %ecx
jle 0x4a08
incl %ecx
xorl %r8d, %r8d
xorl %eax, %eax
movl %edx, %r9d
shrl $0x3, %r9d
movzbl (%rdi,%r9), %r9d
movl %edx, %r10d
notb %r10b
movzbl %r10b, %r10d
andl $0x7, %r10d
xorl %r11d, %r11d
btl %r10d, %r9d
setb %r11b
leal (%r11,%rax,2), %eax
leal 0x1(%rdx), %r9d
cmpl %esi, %r9d
movl %esi, %r9d
cmovbl %r8d, %r9d
negl %r9d
addl %r9d, %edx
incl %edx
decl %ecx
cmpl $0x1, %ecx
jg 0x49b8
retq
movl %edx, %esi
movl %ecx, %edx
jmp 0x4a0c
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ClearBitWrap(unsigned char*, unsigned int, unsigned int, int)
void CBitBuffer::ClearBitWrap(uint8_t *buf, uint32_t bufwrap, uint32_t bitpos, int bitcnt)
{
	// slow write mode if buffer would wrap around during writing, otherwise use fast write
	if (bitpos + bitcnt > bufwrap) {
		while (bitcnt > 0) {
			// write largest possible bitfield
			int writebc = (bitcnt >= MAX_BITBUFFER_LEN) ? MAX_BITBUFFER_LEN : bitcnt;

			// write 0 as bitfield
			WriteBitWrap(buf, bufwrap, bitpos, 0, writebc);

			// next write position
			bitcnt -= writebc;
			bitpos += writebc;

			// handle buffer wrap around
			if (bitpos >= bufwrap)
				bitpos -= bufwrap;
		}
	}	else {
		// fast mode; write at once
		ClearBit(buf, bitpos, bitcnt);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r14d
movq %rdi, %r15
leal (%rbx,%r14), %eax
cmpl %esi, %eax
jbe 0x4bdd
testl %ebx, %ebx
jle 0x4c02
movl %esi, %ebp
xorl %r13d, %r13d
cmpl $0x20, %ebx
movl $0x20, %r12d
cmovll %ebx, %r12d
movq %r15, %rdi
movl %ebp, %esi
movl %r14d, %edx
xorl %ecx, %ecx
movl %r12d, %r8d
callq 0x4a6a
addl %r12d, %r14d
cmpl %ebp, %r14d
movl %ebp, %eax
cmovbl %r13d, %eax
subl %eax, %r14d
subl %r12d, %ebx
jg 0x4ba8
jmp 0x4c02
testl %ebx, %ebx
jle 0x4c02
cmpl $0x20, %ebx
movl $0x20, %ebp
cmovll %ebx, %ebp
movq %r15, %rdi
movl %r14d, %esi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x4b12
addl %ebp, %r14d
subl %ebp, %ebx
jg 0x4be1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ClearBit(unsigned char*, unsigned int, int)
void CBitBuffer::ClearBit(uint8_t *buf, uint32_t bitpos, int bitcnt)
{
	while (bitcnt > 0) {
		// write largest possible bitfield
		int writebc = (bitcnt >= MAX_BITBUFFER_LEN) ? MAX_BITBUFFER_LEN : bitcnt;

		// write 0 as bitfield
		WriteBit(buf, bitpos, 0, writebc);

		// next write position
		bitcnt -= writebc;
		bitpos += writebc;
	}
}

// Assembly:
testl %edx, %edx
jle 0x4c52
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
cmpl $0x20, %ebx
movl $0x20, %r15d
cmovll %ebx, %r15d
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
movl %r15d, %ecx
callq 0x4b12
addl %r15d, %ebp
subl %r15d, %ebx
jg 0x4c24
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CompareBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
int CBitBuffer::CompareBit(uint8_t *buf1, uint32_t buf1pos, uint8_t *buf2, uint32_t buf2pos, int bitcnt)
{
	// compare every bit in the two fields, 32 bit at a time, and finally the remaining bits
	while (bitcnt > 0) {
		uint32_t s1, s2;

		if (bitcnt >= 32) {
			// read 32 bits from each field if the remaining field size is at least 32
			s1 = ReadBit32(buf1, buf1pos);
			s2 = ReadBit32(buf2, buf2pos);
			bitcnt -= 32;
			buf1pos += 32;
			buf2pos += 32;
		} else {
			// read the remaining 1...31 bits
			s1 = ReadBit(buf1, buf1pos, bitcnt);
			s2 = ReadBit(buf2, buf2pos, bitcnt);
			bitcnt = 0;
		}

		// error if fields are different
		if (s1 != s2)
			return -1;
	}

	// all bits compared, the fields are identical
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r12
testl %r15d, %r15d
jle 0x4d02
cmpl $0x20, %r15d
jl 0x4cd2
movl %ebp, %eax
shrl $0x3, %eax
movl %ebp, %ecx
movl (%r12,%rax), %r13d
bswapl %r13d
andl $0x7, %ecx
je 0x4ca2
shll %cl, %r13d
movzbl 0x4(%r12,%rax), %edx
movb $0x8, %al
subb %cl, %al
movl %eax, %ecx
shrl %cl, %edx
orl %edx, %r13d
movl %ebx, %edx
shrl $0x3, %edx
movl %ebx, %ecx
movl (%r14,%rdx), %eax
bswapl %eax
andl $0x7, %ecx
je 0x4cc6
shll %cl, %eax
movzbl 0x4(%r14,%rdx), %esi
movb $0x8, %dl
subb %cl, %dl
movl %edx, %ecx
shrl %cl, %esi
orl %esi, %eax
addl $-0x20, %r15d
addl $0x20, %ebp
addl $0x20, %ebx
jmp 0x4cf2
movq %r12, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4a0c
movl %eax, %r13d
movq %r14, %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x4a0c
xorl %r15d, %r15d
cmpl %eax, %r13d
je 0x4c6c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4d04
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CompareAndCountBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
int CBitBuffer::CompareAndCountBit(uint8_t *buf1, uint32_t buf1pos, uint8_t *buf2, uint32_t buf2pos, int bitcnt)
{
	// number of bits processed, size of current block
	int bitproc = 0, blocksize;
	uint32_t diff;

	// compare every bit in the two fields, in 32 bit blocks, and finally the remaining 1...31 bits
	while (bitcnt > 0) {
		uint32_t s1, s2;

		if (bitcnt >= 32) {
			// process 32 bits if the remaining field size is at least 32
			blocksize = 32;

			// read 32 bits from each field 
			s1 = ReadBit32(buf1, buf1pos);
			s2 = ReadBit32(buf2, buf2pos);
		} else {
			// process the remaining 1...31 bits
			blocksize = bitcnt;

			// read the remaining 1...31 bits from each field
			s1 = ReadBit(buf1, buf1pos, blocksize);
			s2 = ReadBit(buf2, buf2pos, blocksize);
		}

		// bits that are different in the two fiels are set to 1
		diff = s1 ^ s2;

		// stop if fields are different (any of the bits set)
		if (diff)
			break;

		// advance to the next block
		buf1pos += blocksize;
		buf2pos += blocksize;
		bitproc += blocksize;
		bitcnt -= blocksize;
	}

	// difference found, count the remaining identical bits
	if (bitcnt > 0) {
		// find the first bit set from b<blocksize-1>...0
		for (uint32_t mask = 1U << (blocksize - 1); mask; mask >>= 1) {
			if (diff & mask)
				break;

			// bit not set, another identical bit
			bitproc++;
		}
	}

	// return the number of bits processed and found to be identical
	return bitproc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
testl %r8d, %r8d
jle 0x4de4
movl %r8d, %ebp
movq %rdx, %r13
movl %esi, %r12d
movq %rdi, %rbx
xorl %r14d, %r14d
cmpl $0x20, %ebp
jb 0x4d9a
movl %r12d, %eax
shrl $0x3, %eax
movl %r12d, %ecx
movl (%rbx,%rax), %r15d
bswapl %r15d
andl $0x7, %ecx
je 0x4d68
shll %cl, %r15d
movzbl 0x4(%rbx,%rax), %edx
movb $0x8, %al
subb %cl, %al
movl %eax, %ecx
shrl %cl, %edx
orl %edx, %r15d
movl 0x4(%rsp), %ecx
movl %ecx, %esi
shrl $0x3, %esi
movl (%r13,%rsi), %eax
bswapl %eax
movl $0x20, %edx
andl $0x7, %ecx
je 0x4dba
shll %cl, %eax
movzbl 0x4(%r13,%rsi), %r9d
movb $0x8, %sil
subb %cl, %sil
movl %esi, %ecx
shrl %cl, %r9d
orl %r9d, %eax
jmp 0x4dba
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x4a0c
movl %eax, %r15d
movq %r13, %rdi
movl 0x4(%rsp), %esi
movl %ebp, %edx
callq 0x4a0c
movl %ebp, %edx
cmpl %eax, %r15d
jne 0x4dcb
addl %edx, %r12d
addl %edx, 0x4(%rsp)
addl %edx, %r14d
subl %edx, %ebp
cmpl %eax, %r15d
jne 0x4dd8
testl %ebp, %ebp
jg 0x4d3b
xorl %r15d, %eax
testl %ebp, %ebp
setg %cl
decl %edx
jmp 0x4de9
xorl %ecx, %ecx
xorl %r14d, %r14d
testb %cl, %cl
je 0x4e0d
movl $0x1, %esi
movl %edx, %ecx
shll %cl, %esi
btl %edx, %eax
jb 0x4e0d
jmp 0x4e05
shrl %esi
movl %esi, %ecx
andl %eax, %ecx
jne 0x4e0d
incl %r14d
cmpl $0x2, %esi
jae 0x4dfd
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CopyBitWrap(unsigned char*, unsigned int, unsigned int, unsigned char*, unsigned int, unsigned int, int)
void CBitBuffer::CopyBitWrap(uint8_t *srcbuf, uint32_t srcwrap, uint32_t srcpos, uint8_t *dstbuf, uint32_t dstwrap, uint32_t dstpos, int bitcnt)
{
	// copy areas in largest possible size up to the track wrap points
	while (bitcnt > 0) {
		// clamp size to largest size to copy until the destination wrap point
		int csize = (dstpos + bitcnt > dstwrap) ? dstwrap - dstpos : bitcnt;

		// clamp size to largest size to copy until the source wrap point
		if (srcpos + csize > srcwrap)
			csize = srcwrap - srcpos;

		// copy the field; it is guaranteed that source or destionation does not wrap
		CopyBit(srcbuf, srcpos, dstbuf, dstpos, csize);

		// advance bit positions forward
		srcpos += csize;
		dstpos += csize;
		bitcnt -= csize;

		// handle buffer wrap around
		if (srcpos >= srcwrap)
			srcpos -= srcwrap;

		if (dstpos >= dstwrap)
			dstpos -= dstwrap;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x50(%rsp), %r13d
testl %r13d, %r13d
jle 0x4eb2
movl %r9d, %ebx
movl %r8d, %r14d
movq %rcx, %r8
movl %edx, %r15d
movq %rdi, %rbp
movl %esi, 0xc(%rsp)
movq %rcx, 0x10(%rsp)
leal (%rbx,%r13), %eax
movl %r14d, %ecx
subl %ebx, %ecx
cmpl %r14d, %eax
cmovbel %r13d, %ecx
leal (%rcx,%r15), %eax
movl %esi, %r12d
subl %r15d, %r12d
cmpl %esi, %eax
cmovbel %ecx, %r12d
movq %rbp, %rdi
movl %r15d, %esi
movq %r8, %rdx
movl %ebx, %ecx
movl %r12d, %r8d
callq 0x4ec2
movl 0xc(%rsp), %esi
movq 0x10(%rsp), %r8
addl %r12d, %r15d
addl %r12d, %ebx
cmpl %esi, %r15d
movl %esi, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r15d
cmpl %r14d, %ebx
movl %r14d, %eax
cmovbl %ecx, %eax
subl %eax, %ebx
subl %r12d, %r13d
jg 0x4e50
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CopyBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
void CBitBuffer::CopyBit(uint8_t *srcbuf, uint32_t srcpos, uint8_t *dstbuf, uint32_t dstpos, int bitcnt)
{
	// copy the field in 32 bit blocks, and finally the remaining 1...31 bits
	while (bitcnt > 0) {
		uint32_t value;
		int blocksize;

		if (bitcnt >= 32) {
			// process 32 bits if the remaining field size is at least 32
			blocksize = 32;

			// read 32 bits from source
			value = ReadBit32(srcbuf, srcpos);
		} else {
			// process the remaining 1...31 bits
			blocksize = bitcnt;

			// read the remaining 1...31 bits from each field
			value = ReadBit(srcbuf, srcpos, blocksize);
		}

		// write the field
		WriteBit(dstbuf, dstpos, value, blocksize);

		// advance to the next block
		srcpos += blocksize;
		dstpos += blocksize;
		bitcnt -= blocksize;
	}
}

// Assembly:
testl %r8d, %r8d
jle 0x4f4f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %r12
cmpl $0x20, %ebx
jl 0x4f17
movl %r15d, %eax
shrl $0x3, %eax
movl %r15d, %ecx
movl (%r12,%rax), %edx
bswapl %edx
movl $0x20, %r13d
andl $0x7, %ecx
je 0x4f29
shll %cl, %edx
movzbl 0x4(%r12,%rax), %esi
movb $0x8, %al
subb %cl, %al
movl %eax, %ecx
shrl %cl, %esi
orl %esi, %edx
jmp 0x4f29
movq %r12, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x4a0c
movl %eax, %edx
movl %ebx, %r13d
movq %r14, %rdi
movl %ebp, %esi
movl %r13d, %ecx
callq 0x4b12
addl %r13d, %r15d
addl %r13d, %ebp
subl %r13d, %ebx
jg 0x4ee4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: MakeCRCTable()
void MakeCRCTable()
{
	UDWORD poly=0;
	int i;

	if (crcinit)
		return;

	// crc32
	for (i=0; i < sizeof(crcpoly)/sizeof(UBYTE); i++)
		poly|=1UL<<(31-crcpoly[i]);

	for (i=0; i < 256; i++) {
		UDWORD crc=i;
		int bit;

		for (bit=0; bit < 8; bit++)
			crc=crc & 1 ? poly^(crc>>1) : crc>>1;

		crctab[i]=crc;
	}

	// crc-ccitt
	for (i=0, poly=0; i < sizeof(crcpoly_ccitt)/sizeof(UBYTE); i++)
		poly|=1UL<<crcpoly_ccitt[i];

	for (i=0; i < 256; i++) {
		UWORD crc=i<<8;
		int bit;

		for (bit=0; bit < 8; bit++)
			crc=crc & 0x8000 ? (UWORD)poly^(crc<<1) : crc<<1;

		crctab_ccitt[i]=crc;
	}

	// crc-ansi
	for (i=0, poly=0; i < sizeof(crcpoly_ansi)/sizeof(UBYTE); i++)
		poly|=1UL<<crcpoly_ansi[i];

	for (i=0; i < 256; i++) {
		UWORD crc=i<<8;
		int bit;

		for (bit=0; bit < 8; bit++)
			crc=crc & 0x8000 ? (UWORD)poly^(crc<<1) : crc<<1;

		crctab_ansi[i]=crc;
	}

	crcinit=1;
}

// Assembly:
cmpl $0x0, 0x14d8d(%rip)     # 0x19ce4
je 0x4f5a
retq
xorl %edx, %edx
leaq 0x142ad(%rip), %rsi     # 0x19210
xorl %eax, %eax
movb $0x1f, %cl
subb (%rdx,%rsi), %cl
movl $0x1, %edi
shlq %cl, %rdi
orl %edi, %eax
incq %rdx
cmpq $0xe, %rdx
jne 0x4f65
xorl %ecx, %ecx
leaq 0x14d6a(%rip), %rdx     # 0x19cf0
movl $0x8, %esi
movl %ecx, %edi
movl %edi, %r8d
andl $0x1, %edi
negl %edi
shrl %r8d
andl %eax, %edi
xorl %r8d, %edi
decl %esi
jne 0x4f8d
movl %edi, (%rdx,%rcx,4)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x4f86
xorl %edx, %edx
leaq 0x14265(%rip), %rsi     # 0x1921e
xorl %eax, %eax
movb (%rdx,%rsi), %cl
movl $0x1, %edi
shlq %cl, %rdi
orl %edi, %eax
incq %rdx
cmpq $0x3, %rdx
jne 0x4fbb
xorl %ecx, %ecx
leaq 0x15116(%rip), %rdx     # 0x1a0f0
movl %ecx, %esi
shll $0x8, %esi
movl $0x8, %edi
leal (%rsi,%rsi), %r8d
testw %si, %si
movl $0x0, %esi
cmovsl %eax, %esi
xorl %r8d, %esi
decl %edi
jne 0x4fe4
movw %si, (%rdx,%rcx,2)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x4fda
xorl %edx, %edx
leaq 0x1420e(%rip), %rsi     # 0x19221
xorl %eax, %eax
movb (%rdx,%rsi), %cl
movl $0x1, %edi
shlq %cl, %rdi
orl %edi, %eax
incq %rdx
cmpq $0x3, %rdx
jne 0x5015
xorl %ecx, %ecx
leaq 0x152bc(%rip), %rdx     # 0x1a2f0
movl %ecx, %esi
shll $0x8, %esi
movl $0x8, %edi
leal (%rsi,%rsi), %r8d
testw %si, %si
movl $0x0, %esi
cmovsl %eax, %esi
xorl %r8d, %esi
decl %edi
jne 0x503e
movw %si, (%rdx,%rcx,2)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x5034
movl $0x1, 0x14c76(%rip)     # 0x19ce4
retq
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC(unsigned char*, int)
UDWORD CalcCRC(PUBYTE buf, int len)
{
	UDWORD crc=~0;

	while (len--)
		crc=crctab[(crc^*buf++) & 0xff] ^ (crc >> 8);

	return crc^~0;
}

// Assembly:
testl %esi, %esi
je 0x509f
movl %esi, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edx, %edx
leaq 0x14c6d(%rip), %rsi     # 0x19cf0
movb (%rdi,%rdx), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rsi,%r8,4), %eax
incq %rdx
cmpl %edx, %ecx
jne 0x5083
notl %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC32(unsigned char*, int, unsigned int)
UDWORD CalcCRC32(PUBYTE buf, int len, UDWORD seed)
{
	UDWORD crc=~seed;

	while (len--)
		crc=crctab[(crc^*buf++) & 0xff] ^ (crc >> 8);

	return crc^~0;
}

// Assembly:
movl %edx, %eax
testl %esi, %esi
je 0x50d0
notl %eax
movl %esi, %ecx
xorl %edx, %edx
leaq 0x14c3b(%rip), %rsi     # 0x19cf0
movb (%rdi,%rdx), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rsi,%r8,4), %eax
incq %rdx
cmpl %edx, %ecx
jne 0x50b5
notl %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %esi, %esi
je 0x5104
movl %esi, %ecx
movw $0xffff, %ax            # imm = 0xFFFF
xorl %edx, %edx
leaq 0x1500c(%rip), %rsi     # 0x1a0f0
movzbl (%rdi,%rdx), %r8d
movzwl %ax, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
shll $0x8, %eax
xorw (%rsi,%r9,2), %ax
incq %rdx
cmpl %edx, %ecx
jne 0x50e4
retq
movw $0xffff, %ax            # imm = 0xFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %esi, %esi
je 0x513c
movl %esi, %eax
xorl %ecx, %ecx
leaq 0x14fd8(%rip), %rsi     # 0x1a0f0
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
cmpl %ecx, %eax
jne 0x5118
movzwl %dx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %esi, %esi
je 0x5171
movl %esi, %ecx
xorl %edx, %edx
leaq 0x151a1(%rip), %rsi     # 0x1a2f0
xorl %eax, %eax
movzbl (%rdi,%rdx), %r8d
movzwl %ax, %r9d
shrl $0x8, %r9d
xorl %r8d, %r9d
shll $0x8, %eax
xorw (%rsi,%r9,2), %ax
incq %rdx
cmpl %edx, %ecx
jne 0x5151
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x51c0
callq 0x4280
movq $0x0, 0x20(%rbx)
movl $0x0, 0x28(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x51dd
callq 0x4280
movq $0x0, 0x10(%rbx)
movl $0x0, 0x18(%rbx)
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x51fd
callq 0x4280
movq $0x0, 0x88(%rbx)
movl $0x0, 0x90(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x5220
callq 0x4280
addq $0x8, %rbx
movl $0xb8, %edx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x4140
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5312
callq 0x4280
movq $0x0, 0x30(%rbx)
xorl %eax, %eax
movl %eax, 0x38(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x6c(%rbx)
movl %eax, 0x7c(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5352
incl %esi
movl (%rdi), %eax
bswapl %eax
movl %eax, (%rdi)
addq $0x4, %rdi
decl %esi
cmpl $0x1, %esi
jg 0x5341
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x51ae
movl $0x7, %ebp
cmpl $0x8, %r12d
jl 0x5459
leaq 0x8(%rbx), %rdi
movq (%r15), %rax
movq %rax, 0x8(%rbx)
movl $0x8, %esi
callq 0x5338
movl 0x8(%rbx), %r13d
movl 0xc(%rbx), %r14d
leal (%r14,%r13), %eax
addl $0x8, %eax
cmpl %r12d, %eax
jg 0x5459
addq $0x8, %r15
movq %rsp, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x546a
testq %rax, %rax
je 0x544d
movslq %r13d, %r12
addq %r15, %r12
movq %rsp, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x546a
testq %rax, %rax
je 0x5454
movq %r15, 0x20(%rbx)
movl %r13d, 0x28(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x54f0
movl %eax, %ebp
testl %eax, %eax
jne 0x5407
movq %rbx, %rdi
xorl %esi, %esi
callq 0x54f0
movl %eax, %ebp
movq $0x0, 0x20(%rbx)
testl %ebp, %ebp
jne 0x5459
movq %r12, 0x88(%rbx)
movl %r14d, 0x90(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x55c4
movl %eax, %ebp
testl %eax, %eax
jne 0x5440
movq %rbx, %rdi
xorl %esi, %esi
callq 0x55c4
movl %eax, %ebp
movq $0x0, 0x88(%rbx)
jmp 0x5459
movl $0xb, %ebp
jmp 0x5459
movl $0x8, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5482
cmpl $0x4b434150, (%rsi)     # imm = 0x4B434150
je 0x5485
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
movl $0x4, %esi
callq 0x5338
movl 0x14(%rbx), %r14d
movl $0x0, 0x14(%rbx)
movq %rbx, %rdi
movl $0x18, %esi
callq 0x506f
cmpl %eax, %r14d
jne 0x54e9
leaq 0x4(%rbx), %rdi
movl $0x14, %esi
callq 0x5338
movl %ebp, %ecx
movl 0xc(%rbx), %edx
addq $0x18, %rdx
xorl %eax, %eax
cmpq %rcx, %rdx
cmoveq %rbx, %rax
jmp 0x54eb
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
jne 0x550f
movq %rbx, %rdi
callq 0x527a
movq 0x20(%rbx), %rsi
movl 0x28(%rbx), %edx
movq %rsp, %rdi
callq 0x546a
testq %rax, %rax
je 0x5599
movq %rax, %r14
testl %ebp, %ebp
je 0x554a
movl 0xc(%r14), %esi
movl 0x10(%r14), %r15d
movq 0x20(%rbx), %rdi
addq $0x18, %rdi
callq 0x506f
movl $0xc, %r12d
cmpl %eax, %r15d
jne 0x55b2
movq 0x20(%rbx), %rdi
movl 0x28(%rbx), %esi
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x56d2
movq %rax, %r15
testl %ebp, %ebp
je 0x55a1
movl 0x4(%r14), %esi
movq %r15, %rdi
callq 0x5338
movl 0x4(%r14), %esi
movl 0x8(%r14), %ebx
movq %r15, %rdi
callq 0x506f
cmpl %eax, %ebx
movl $0xd, %r12d
cmovel %r13d, %r12d
testq %r15, %r15
je 0x55b2
movq %r15, %rdi
callq 0x4280
jmp 0x55b2
movl $0xb, %r12d
jmp 0x55b2
movq %r15, 0x10(%rbx)
movl 0x4(%r14), %eax
shrl $0x2, %eax
movl %eax, 0x18(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
jne 0x55e6
movq %rbx, %rdi
callq 0x52ca
movq 0x88(%rbx), %rsi
movl 0x90(%rbx), %edx
leaq 0x8(%rsp), %rdi
callq 0x546a
testq %rax, %rax
je 0x567a
movq %rax, %r14
testl %ebp, %ebp
je 0x5630
movl 0xc(%r14), %esi
movl 0x10(%r14), %r15d
movq 0x88(%rbx), %rdi
addq $0x18, %rdi
callq 0x506f
movl $0x9, %r12d
cmpl %eax, %r15d
jne 0x56bd
movq 0x88(%rbx), %rsi
movl 0x90(%rbx), %edx
xorl %r13d, %r13d
leaq 0x20(%rsp), %rdi
xorl %ecx, %ecx
callq 0x582a
movq %rax, %r15
testl %ebp, %ebp
je 0x5682
movl 0x8(%r14), %ebx
movq 0x30(%r15), %rdi
movl 0x38(%r15), %esi
callq 0x506f
cmpl %eax, %ebx
movl $0xa, %r12d
cmovel %r13d, %r12d
movq %r15, %rdi
callq 0x5300
jmp 0x56bd
movl $0x8, %r12d
jmp 0x56bd
movq 0x30(%r15), %rax
movq %rax, 0x38(%rbx)
movl 0x38(%r15), %eax
movl %eax, 0x40(%rbx)
xorl %eax, %eax
movq 0x40(%r15,%rax,2), %rcx
movq %rcx, 0x48(%rbx,%rax,2)
movl 0x68(%r15,%rax), %ecx
movl %ecx, 0x70(%rbx,%rax)
addq $0x4, %rax
cmpq $0x14, %rax
jne 0x5693
movl 0x7c(%r15), %eax
movl %eax, 0x84(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x546a
testq %rax, %rax
je 0x594b
movq %rax, %r12
movq $0x0, 0x30(%rbx)
movq %rbx, %rdi
callq 0x5300
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 0x5889
movslq %eax, %rdi
callq 0x4040
movq %rax, 0x30(%rbx)
leaq 0x19(%r14), %rax
movq %rax, 0x90(%rbx)
movzbl 0x18(%r14), %edx
movl %edx, 0x7c(%rbx)
testl %edx, %edx
je 0x58eb
movq 0x30(%rbx), %rax
xorl %ecx, %ecx
movq 0x90(%rbx), %rdx
incq %rdx
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
xorl %esi, %esi
shll $0x8, %esi
movq %rdx, 0x90(%rbx)
movzbl -0x1(%rdx), %r8d
movslq %esi, %rsi
orq %r8, %rsi
incq %rdx
incl %edi
jne 0x58b7
movl %esi, 0x68(%rbx,%rcx,4)
movq %rax, 0x40(%rbx,%rcx,8)
addq %rsi, %rax
incq %rcx
movslq 0x7c(%rbx), %rdx
cmpq %rdx, %rcx
jl 0x58a6
testl %edx, %edx
je 0x591e
movq 0x40(%rbx), %rdi
movq 0x90(%rbx), %rsi
movq %rdi, 0x98(%rbx)
movslq 0x68(%rbx), %rdx
movl %edx, 0xa0(%rbx)
callq 0x4330
movslq 0xa0(%rbx), %rax
addq %rax, 0x90(%rbx)
movl $0x1, 0xa4(%rbx)
cmpl $0x2, 0x7c(%rbx)
jl 0x594d
movq %rbx, %rdi
callq 0x5988
movl 0xa4(%rbx), %eax
incl %eax
movl %eax, 0xa4(%rbx)
cmpl 0x7c(%rbx), %eax
jl 0x592e
jmp 0x594d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %esi, %esi
je 0x5984
movq 0x90(%rdi), %rcx
incq %rcx
xorl %eax, %eax
shll $0x8, %eax
movq %rcx, 0x90(%rdi)
movzbl -0x1(%rcx), %edx
orl %edx, %eax
incq %rcx
decl %esi
jne 0x596c
retq
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
movq 0x90(%rdi), %r8
movslq 0xa4(%rdi), %rcx
movslq 0x68(%rdi,%rcx,4), %rax
testq %rax, %rax
jle 0x5aa1
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x98(%rdi), %rdx
movq 0x40(%rdi,%rcx,8), %r9
addq %r9, %rax
leaq 0x1(%rdx), %rsi
movzbl (%r8), %r10d
testb %r10b, %r10b
js 0x59fa
shll $0x8, %r10d
movzbl 0x1(%r8), %r11d
addq $0x2, %r8
orl %r10d, %r11d
je 0x5a84
leaq 0x1(%r8), %rcx
leaq 0x1(%r9), %r10
movb (%r8), %r8b
movb %r8b, (%r9)
movq %rcx, %r8
movq %r10, %r9
decl %r11d
jne 0x59dc
jmp 0x5a8a
movl %r10d, %ecx
shrl $0x4, %ecx
andl $0xf, %r10d
shll $0x8, %r10d
movzbl 0x1(%r8), %ebx
leal (%r10,%rbx), %ebp
movzbl 0x2(%r8), %r11d
shll $0x8, %r11d
movzbl 0x3(%r8), %r14d
addq $0x4, %r8
andl $0x7, %ecx
je 0x5a62
testl %ebp, %ebp
je 0x5a84
leaq (%r11,%r14), %r15
movzbl (%rdx,%r15), %ebp
addq %r14, %r11
addq %rsi, %r11
addl %ebx, %r10d
xorl %ebx, %ebx
shll $0x8, %ebp
movzbl (%r11,%rbx), %r14d
orl %r14d, %ebp
movl %ebp, %r14d
shrl %cl, %r14d
movb %r14b, (%r9,%rbx)
incq %rbx
cmpl %ebx, %r10d
jne 0x5a40
addq %rbx, %r9
jmp 0x5a84
testl %ebp, %ebp
je 0x5a84
addq %r14, %r11
addq %rdx, %r11
addl %ebx, %r10d
xorl %ecx, %ecx
movb (%r11,%rcx), %bl
movb %bl, (%r9,%rcx)
incq %rcx
cmpl %ecx, %r10d
jne 0x5a71
addq %rcx, %r9
movq %r9, %r10
movq %r8, %rcx
movq %rcx, %r8
movq %r10, %r9
cmpq %rax, %r10
jb 0x59bd
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5aa4
movq %r8, %rcx
movq %rcx, 0x90(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4200
movq %rax, %rbx
movq %rax, %rdi
callq 0xe700
movq 0x14a0d(%rip), %rsi     # 0x1a518
movq 0x149fe(%rip), %rax     # 0x1a510
movq %rsi, %rcx
movq %rbx, (%rsp)
subq %rax, %rcx
je 0x5b36
sarq $0x3, %rcx
xorl %r14d, %r14d
cmpq $0x0, (%rax,%r14,8)
je 0x5b4f
incl %r14d
cmpq %r14, %rcx
ja 0x5b25
jmp 0x5b39
xorl %r14d, %r14d
cmpq 0x149e0(%rip), %rsi     # 0x1a520
je 0x5b55
movq %rbx, (%rsi)
addq $0x8, 0x149cb(%rip)     # 0x1a518
jmp 0x5b64
movq %rbx, (%rax,%r14,8)
jmp 0x5b64
leaq 0x149b4(%rip), %rdi     # 0x1a510
movq %rsp, %rdx
callq 0x65b0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movl $0xb8, %esi
movq %rbx, %rdi
callq 0x4210
movq %r14, %rdi
callq 0x43a0
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %edi, %edi
js 0x5bda
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movl %edi, %r14d
movq 0x14978(%rip), %rdx     # 0x1a518
movq 0x14969(%rip), %rcx     # 0x1a510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x5bd3
movq (%rcx,%r14,8), %rdi
testq %rdi, %rdi
je 0x5bc2
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x14947(%rip), %rax     # 0x1a510
movq $0x0, (%rax,%r14,8)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl $0x3, %eax
testl %edi, %edi
js 0x5c2b
movl %edi, %ecx
movq 0x1492b(%rip), %r8      # 0x1a518
movq 0x1491c(%rip), %rdx     # 0x1a510
subq %rdx, %r8
sarq $0x3, %r8
cmpq %rcx, %r8
jbe 0x5c2b
cmpq $0x0, (%rdx,%rcx,8)
je 0x5c2b
subq $0x18, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rsi, (%rax)
movq %rax, %rsi
callq 0x5c2c
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf37c
cmpl $0x1, %eax
je 0x5c4d
testl %eax, %eax
jne 0x5c56
movl $0x5, %ecx
jmp 0x5c52
movl $0x6, %ecx
xorl %edx, %edx
jmp 0x5c5a
xorl %ecx, %ecx
movb $0x1, %dl
testb %dl, %dl
je 0x5ca2
movl %eax, %edi
callq 0xf6ac
testq %rax, %rax
je 0x5c9d
movq %rax, %r14
movl %ebp, %edi
callq 0x5b87
movslq %ebp, %rax
movq 0x14892(%rip), %rcx     # 0x1a510
movq %r14, (%rcx,%rax,8)
movq 0x14887(%rip), %rcx     # 0x1a510
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
movl $0x2, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl $0x3, %eax
testl %edi, %edi
js 0x5d0e
movl %edi, %r8d
movq 0x1485c(%rip), %r10     # 0x1a518
movq 0x1484d(%rip), %r9      # 0x1a510
subq %r9, %r10
sarq $0x3, %r10
cmpq %r8, %r10
jbe 0x5d0e
cmpq $0x0, (%r9,%r8,8)
je 0x5d0e
subq $0x18, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%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 0x5c2c
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5d3e
movl %edi, %eax
movq 0x147fc(%rip), %rdx     # 0x1a518
movq 0x147ed(%rip), %rcx     # 0x1a510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x5d3e
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x5d3e
movq (%rdi), %rax
jmpq *0x18(%rax)
movl $0x3, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5d78
movl %edi, %eax
movq 0x147c7(%rip), %rdx     # 0x1a518
movq 0x147b8(%rip), %rcx     # 0x1a510
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x5d78
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x5d78
movq (%rdi), %rax
movq 0x20(%rax), %rax
xorl %edx, %edx
jmpq *%rax
movl $0x3, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
movl $0x2, %eax
testq %rdi, %rdi
je 0x5ea5
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq $0x0, 0x40(%rdi)
movl $0x3, %eax
testl %esi, %esi
js 0x5e9e
movl %esi, %ecx
movq 0x14755(%rip), %rsi     # 0x1a518
movq 0x14746(%rip), %rdx     # 0x1a510
subq %rdx, %rsi
sarq $0x3, %rsi
cmpq %rcx, %rsi
jbe 0x5e9e
movq (%rdx,%rcx,8), %rcx
testq %rcx, %rcx
je 0x5e9e
xorl %r14d, %r14d
cmpl $0x0, 0x8(%rcx)
leaq 0x8(%rcx), %rax
cmovneq %rax, %r14
movl $0x2, %eax
je 0x5e9e
cmpl $0x0, 0x40(%r14)
je 0x5e63
xorl %eax, %eax
cmpl $0x1, 0x44(%r14)
sete %al
movl %eax, (%rbx)
movl 0x50(%r14), %eax
movl %eax, 0x4(%rbx)
movl 0x54(%r14), %eax
movl %eax, 0x8(%rbx)
movl 0x5c(%r14), %eax
movl %eax, 0xc(%rbx)
movl 0x60(%r14), %eax
movl %eax, 0x10(%rbx)
movl 0x64(%r14), %eax
movl %eax, 0x14(%rbx)
movl 0x68(%r14), %eax
movl %eax, 0x18(%rbx)
leaq 0x1c(%rbx), %rdi
leaq 0x6c(%r14), %rsi
callq 0xefb4
xorl %eax, %eax
xorl %ecx, %ecx
movl 0x74(%r14,%rcx,4), %edx
movl %edx, 0x38(%rbx,%rcx,4)
incq %rcx
cmpq $0x4, %rcx
jne 0x5e4f
jmp 0x5e9e
cmpl $0x0, 0x28(%r14)
je 0x5e96
movq $0x1, (%rbx)
movl $0x0, 0x8(%rbx)
movl 0x18(%r14), %eax
movl %eax, 0xc(%rbx)
movl 0x1c(%r14), %eax
movl %eax, 0x10(%rbx)
movl 0x20(%r14), %eax
movl %eax, 0x14(%rbx)
movl 0x24(%r14), %eax
movl %eax, 0x18(%rbx)
jmp 0x5e9c
movl $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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)
movl 0x10(%rsi), %eax
movl %eax, 0x4(%rdi)
movl 0x14(%rsi), %eax
movl %eax, 0x8(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
movl $0x0, 0x10(%rdi)
movl 0x28(%rsi), %eax
movl %eax, 0x14(%rdi)
movq 0x48(%rsi), %rax
movq %rax, 0x18(%rdi)
leaq 0xe8(%rsi), %rax
leaq 0x50(%rsi), %rdx
btl $0xc, %ecx
cmovaeq %rdx, %rax
movl (%rax), %eax
movl %eax, 0x20(%rdi)
movl 0xa8(%rsi), %eax
movl %eax, 0x60(%rdi)
movq 0xb0(%rsi), %rax
movq %rax, 0x64(%rdi)
cmpl $0x0, 0x28(%rsi)
jle 0x60b3
xorl %eax, %eax
movq 0x58(%rsi,%rax,8), %rcx
movq %rcx, 0x24(%rdi,%rax,8)
movl 0x80(%rsi,%rax,4), %ecx
movl %ecx, 0x4c(%rdi,%rax,4)
incq %rax
movslq 0x28(%rsi), %rcx
cmpq %rcx, %rax
jl 0x6092
retq
// File: /workspace/github_cpp_makefile_star2_O1/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)
movl 0x10(%rsi), %eax
movl %eax, 0x4(%rdi)
movl 0x14(%rsi), %eax
movl %eax, 0x8(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
movl $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_O1/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)
movl 0x10(%rsi), %eax
movl %eax, 0x4(%rdi)
movl 0x14(%rsi), %eax
movl %eax, 0x8(%rdi)
movl 0x18(%rsi), %eax
movl %eax, 0xc(%rdi)
movl $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