LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/lemire[P]simdprune/benchmark.c
// Function: testepi8
void testepi8() {
  for(int mask = 0; mask < (1<<16); mask++) {
    __m128i source = _mm_set_epi8(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
    __m128i m1 = prune_epi8(source, mask);
    check_prune_epi8(source, m1, mask);
    __m128i m2 = thinprune_epi8(source, mask);
    check_prune_epi8(source, m2, mask);
    __m128i m3 = skinnyprune_epi8(source, mask);
    check_prune_epi8(source, m3, mask);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x1b81(%rip), %r14      # 0x3020
xorl %ebx, %ebx
leaq 0x101b78(%rip), %r15    # 0x103020
leaq 0x102371(%rip), %r12    # 0x103820
leaq 0x10246a(%rip), %r13    # 0x103920
vmovdqa 0x105682(%rip), %xmm0   # 0x106b40
vpshufb (%r14), %xmm0, %xmm1
movl %ebx, %edi
callq 0x1439
movzbl %bl, %eax
popcntl %eax, %eax
movzbl %bl, %ebp
movl %ebp, %ecx
movl %ebx, %edx
shrl $0x8, %edx
vmovq (%r15,%rdx,8), %xmm1
vmovdqa %xmm1, 0x10(%rsp)
vpbroadcastb 0x1b21(%rip), %xmm0 # 0x3011
vpaddb %xmm0, %xmm1, %xmm0
shll $0x3, %eax
movl $0x40, %edx
subl %eax, %edx
vmovd %edx, %xmm1
vpsllq %xmm1, %xmm0, %xmm1
vpslldq $0x8, %xmm0, %xmm0      # xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
vmovd %eax, %xmm2
vpsrlq %xmm2, %xmm0, %xmm2
vmovq (%r15,%rcx,8), %xmm0
vmovdqa %xmm0, (%rsp)
vpternlogq $0xfe, %xmm0, %xmm1, %xmm2
vmovdqa 0x105613(%rip), %xmm0   # 0x106b40
vpshufb %xmm2, %xmm0, %xmm1
movl %ebx, %edi
callq 0x1439
vmovdqa (%rsp), %xmm0
vpunpcklqdq 0x10(%rsp), %xmm0, %xmm0 # xmm0 = xmm0[0],mem[0]
vpaddb 0x1055e4(%rip), %xmm0, %xmm1 # 0x106b30
vmovdqa 0x1055ec(%rip), %xmm0   # 0x106b40
vpshufb %xmm1, %xmm0, %xmm1
movzbl (%rbp,%r12), %eax
vpshufb (%r13,%rax,8), %xmm1, %xmm1
movl %ebx, %edi
callq 0x1439
incq %rbx
addq $0x10, %r14
cmpq $0x10000, %rbx          # imm = 0x10000
jne 0x14b6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: readfile
int readfile(char* path, char* buf, int maxlen) {
	FILE *infile = fopen(path,"rb");
	if (!infile) {
		printf("Can't open file '%s'\n",path);
		return -1;		// failed to open file
	}
	fseek(infile, 0, SEEK_END);
	int iflen = ftell(infile);
	rewind(infile);
	if (iflen <= maxlen) {
		fread(buf, iflen, 1, infile);
	} else {
		printf("File '%s' is too long (max is 0x%X bytes)\n", path, maxlen);
		iflen = -2;
	}
	fclose(infile);
	return iflen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
leaq 0x9d7eb(%rip), %rsi     # 0x49f051
callq 0x414900
testq %rax, %rax
je 0x4018b6
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x414b00
movq %rax, %r13
movq %rbx, %rdi
callq 0x418d50
cmpl %r12d, %r13d
jle 0x4018cf
leaq 0x9d7c9(%rip), %rdi     # 0x49f06a
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x40dea0
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
jmp 0x4018e2
leaq 0x9d797(%rip), %rdi     # 0x49f054
movq %r14, %rsi
xorl %eax, %eax
callq 0x40dea0
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x4018ea
movslq %r13d, %rsi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x414a00
movq %rbx, %rdi
callq 0x4144c0
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: savefile
int savefile(char* path, char* buf, int len) {
	FILE *file = fopen(path, "wb");
	if (!file) {
		printf("Can't open file '%s' for writing\n",path);
		return 0;
	}
	if (buf && (len > 0)) fwrite(buf, len, 1, file);
	fclose(file);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x9d77e(%rip), %rsi     # 0x49f095
callq 0x414900
testq %rax, %rax
je 0x401956
movq %rax, %r14
testq %rbx, %rbx
sete %al
testl %r15d, %r15d
setle %cl
orb %al, %cl
jne 0x401947
movl %r15d, %esi
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x414c50
movq %r14, %rdi
callq 0x4144c0
movl $0x1, %ebx
jmp 0x401969
leaq 0x9d73b(%rip), %rdi     # 0x49f098
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x40dea0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: getFileType
int getFileType(char* path) {
	FILE* file = fopen(path, "rb");
	char buf[9];
	int res = TYPE_UNKNOWN;
	if (testExt(path, "tap")) {
		res = TYPE_TAP;
	} else if (testExt(path, "scl") && file) {
		fread(buf, 9, 1, file);
		if ((strncmp(buf, "SINCLAIR", 8) == 0) && ((unsigned)buf[8] < 129))
			res = TYPE_SCL;
	} else if (testExt(path, "trd") && file) {
		fseek(file, 0, SEEK_END);
		size_t size = ftell(file);
		fseek(file, 0x8e7, SEEK_SET);
		int type = fgetc(file);
		if ((size > 0x8ff) && (size < 0xa0001) && (type == 0x10))
			res = TYPE_TRD;
	}
	if (file) fclose(file);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
leaq 0x9d63d(%rip), %rsi     # 0x49f051
callq 0x414900
movq %rax, %rbx
leaq 0x9d697(%rip), %rsi     # 0x49f0ba
movq %r15, %rdi
callq 0x401974
movl $0x3, %r14d
testl %eax, %eax
je 0x401a43
testq %rbx, %rbx
jne 0x401b00
jmp 0x401b08
leaq 0x9d674(%rip), %rsi     # 0x49f0be
movq %r15, %rdi
callq 0x401974
testq %rbx, %rbx
je 0x401a94
testl %eax, %eax
je 0x401a94
leaq -0x21(%rbp), %r14
movl $0x9, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x414a00
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
cmpq %rax, (%r14)
sete %al
cmpb $0x0, 0x8(%r14)
setns %cl
andb %al, %cl
movzbl %cl, %r14d
jmp 0x401b00
leaq 0x9d630(%rip), %rsi     # 0x49f0cb
movq %r15, %rdi
callq 0x401974
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x401a35
testl %eax, %eax
je 0x401a35
movq %rbx, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x414b00
movq %rax, %r14
movl $0x8e7, %esi            # imm = 0x8E7
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x418c30
addq $-0x900, %r14           # imm = 0xF700
cmpq $0x9f701, %r14          # imm = 0x9F701
setb %cl
cmpl $0x10, %eax
sete %al
andb %cl, %al
movzbl %al, %r14d
addl %r14d, %r14d
movq %rbx, %rdi
callq 0x4144c0
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: stdAccumulate
int stdAccumulate(unsigned char* ptr, int size, int res) {
	while (size > 0) {
		res += *ptr;
		ptr++;
		size--;
	}
	return res;
}

// Assembly:
movl %edx, %eax
testl %esi, %esi
jle 0x401c04
pushq %rbp
movq %rsp, %rbp
incl %esi
movzbl (%rdi), %ecx
addl %ecx, %eax
incq %rdi
decl %esi
cmpl $0x1, %esi
ja 0x401bf4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: fgeti
int fgeti(FILE* file) {
	int res = fgetc(file) & 0xff;
	res |= (fgetc(file) << 8);
	res |= (fgetc(file) << 16);
	res |= (fgetc(file) << 24);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x418c30
movzbl %al, %r15d
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r14d
shll $0x8, %r14d
orl %r15d, %r14d
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r15d
shll $0x10, %r15d
movq %rbx, %rdi
callq 0x418c30
shll $0x18, %eax
orl %r15d, %eax
orl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: fputi
void fputi(FILE* file, int val) {
	fputc(val & 0xff, file);
	fputc((val >> 8) & 0xff, file);
	fputc((val >> 16) & 0xff, file);
	fputc((val >> 24) & 0xff, file);	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl $0xff, %r15d
movl %esi, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418a10
movl %r14d, %edi
shrl $0x8, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418a10
movl %r14d, %edi
shrl $0x10, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418a10
shrl $0x18, %r14d
movl %r14d, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x418a10
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: makeName
void makeName(char* name, char* buf) {
	if (name == NULL) return;
	memset(buf, 0x20, 9);
	char* ptr = strrchr(name, '.');
	if (ptr) {
		memcpy(buf, name, ((ptr - name) > 8) ? 8 : (ptr - name));
		ptr++;
		if (*ptr) buf[8] = *ptr;
	} else {
		memcpy(buf, name, (strlen(name) > 8) ? 8 : strlen(name));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x401d14
movq %rsi, %rbx
movq %rdi, %r14
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, (%rsi)
movb $0x20, 0x8(%rsi)
movl $0x2e, %esi
callq 0x401050
testq %rax, %rax
je 0x401d1f
movq %rax, %r15
subq %r14, %rax
cmpq $0x8, %rax
movl $0x8, %edx
cmovlq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x401040
movb 0x1(%r15), %al
testb %al, %al
je 0x401d14
movb %al, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x4010d8
cmpq $0x8, %rax
movl $0x8, %edx
cmovbq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x401040
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: getSum
int getSum(char* data, int len) {
	unsigned int crc = 0;
	while (len--) {
		crc += (unsigned char)*data;
		data++;
	}
	return crc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %esi, %esi
je 0x401d66
movl %esi, %ecx
xorl %edx, %edx
xorl %eax, %eax
movzbl (%rdi,%rdx), %esi
addl %esi, %eax
incq %rdx
cmpl %edx, %ecx
jne 0x401d57
jmp 0x401d68
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: makeDSC
trdFile makeDSC(char* path, int len) {
	trdFile hd;
	xName nm = cutName(path);
	memcpy(hd.name, nm.name, 8);
	hd.lnl = len & 0xff;
	hd.lnh = (len >> 8) & 0xff;
	if (opt.isBasic) {
		hd.ext = 'B';
		hd.stl = hd.lnl;
		hd.sth = hd.lnh;
		len += 4;		// 80,AA,<AS.line>
	} else {
		hd.ext = nm.ext[0];
		hd.stl = nm.ext[1];
		hd.sth = nm.ext[2];
	}
	hd.slen = ((len >> 8) & 0xff) + ((len & 0xff) ? 1 : 0);
	return hd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
callq 0x401b16
movl %ebx, %esi
shrl $0x8, %esi
testb $0x1, 0xd062d(%rip)     # 0x4d23b0
jne 0x401dab
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq %rdx, %rcx
shrl $0x10, %edx
movq %rcx, %rdi
shrq $0x18, %rdi
shrq $0x20, %rcx
movzbl %dl, %r8d
movl %esi, %edx
movl %ebx, %r9d
jmp 0x401dbf
movl %ebx, %edi
movl %esi, %ecx
leal 0x4(%rbx), %r9d
movl %r9d, %edx
shrl $0x8, %edx
movl $0x42, %r8d
xorl %r10d, %r10d
testb %r9b, %r9b
setne %r10b
addl %edx, %r10d
movl $0xff, %edx
andl %edx, %r10d
shlq $0x28, %r10
andl %edx, %esi
shlq $0x20, %rsi
orq %r10, %rsi
shll $0x18, %ebx
orq %rsi, %rbx
andl %edx, %ecx
shll $0x10, %ecx
orq %rbx, %rcx
shll $0x8, %edi
movzwl %di, %edx
orq %rcx, %rdx
orq %r8, %rdx
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: prepareFile
trdFile prepareFile(char* path, char* buf) {
	memset(buf, 0x00, 0x10000);
	trdFile hd;
	int ilen;
	memset(hd.name, 0x00, sizeof(trdFile));
	if (opt.asHobeta) {
		ilen = readfile(path, buf, 0xff11);	// +17 bytes header
		if (ilen > 0) {
			if (!buf[13])
				buf[13] = buf[14];
			memcpy((char*)&hd, buf, 15);
			memcpy(buf, buf+17, ilen-17);
		}
	} else {
		ilen = readfile(path, buf, 0xff00);
		if (ilen > 0) {
			if (opt.isBasic) {
				buf[ilen] = 0x80;
				buf[ilen+1] = 0xaa;
				buf[ilen+2] = opt.aStart & 0xff;
				buf[ilen+3] = (opt.aStart >> 8) & 0xff;
			}
			hd = makeDSC(path, ilen);
		}
	}
	return hd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x10000, %edx          # imm = 0x10000
movq %rsi, %rdi
xorl %esi, %esi
callq 0x4010a0
testb $0x4, 0xd0588(%rip)     # 0x4d23b0
jne 0x401e79
movq %r14, %rdi
movq %rbx, %rsi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x401848
testl %eax, %eax
jle 0x401ec8
testb $0x1, 0xd0567(%rip)     # 0x4d23b0
je 0x401e67
movl %eax, %ecx
movw $0xaa80, (%rbx,%rcx)    # imm = 0xAA80
movb 0xd055b(%rip), %dl      # 0x4d23b4
movb %dl, 0x2(%rbx,%rcx)
movb 0xd0552(%rip), %dl      # 0x4d23b5
movb %dl, 0x3(%rbx,%rcx)
movq %r14, %rdi
movl %eax, %esi
callq 0x401d6a
movq %rax, %r14
movq %rdx, %r15
jmp 0x401ece
movq %r14, %rdi
movq %rbx, %rsi
movl $0xff11, %edx           # imm = 0xFF11
callq 0x401848
testl %eax, %eax
jle 0x401ec8
cmpb $0x0, 0xd(%rbx)
jne 0x401e99
movb 0xe(%rbx), %cl
movb %cl, 0xd(%rbx)
movq (%rbx), %r14
movzwl 0xc(%rbx), %ecx
movzbl 0xe(%rbx), %edx
shll $0x10, %edx
orl %ecx, %edx
shlq $0x20, %rdx
movl 0x8(%rbx), %r15d
orq %rdx, %r15
leaq 0x11(%rbx), %rsi
addl $-0x11, %eax
movslq %eax, %rdx
movq %rbx, %rdi
callq 0x401040
jmp 0x401ece
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %r14, %rax
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: saveoutput
int saveoutput(char* oname, char* buf, trdFile hd) {
	int len;
	if ((hd.lnh + (hd.lnl ? 1 : 0)) == hd.slen) {
		len = hd.lnl | (hd.lnh << 8);
	} else {
		len = hd.slen << 8;
	}
	int res;
	if (opt.asHobeta) {
		char hbuf[0x10010];
		memcpy(hbuf, (char*)&hd, 13);
		hbuf[13] = 0x00;
		hbuf[14] = hd.slen;
		int crc = ((105 + 257 * stdAccumulate((unsigned char*)hbuf, 15, 0)) & 0xffff);
		hbuf[15] = crc & 0xff;
		hbuf[16] = ((crc & 0xff00) >> 8);
		memcpy(hbuf + 17, buf, len);
		res = savefile(oname, hbuf, len + 17);
	} else {
		res = savefile(oname, buf, len);
	}
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10010, %rsp          # imm = 0x10010
movq %rdi, %rbx
movq %rcx, %rax
shrq $0x20, %rax
movl $0xff, %r8d
movl %eax, %r14d
andl %r8d, %r14d
cmpl $0x1000000, %ecx        # imm = 0x1000000
movl %r14d, %r9d
sbbl $-0x1, %r9d
movq %rcx, %rdi
shrq $0x28, %rdi
andl %edi, %r8d
cmpl %r8d, %r9d
jne 0x401f26
shldl $0x8, %ecx, %r14d
jmp 0x401f2d
shll $0x8, %r8d
movl %r8d, %r14d
testb $0x4, 0xd047c(%rip)     # 0x4d23b0
jne 0x401f4c
movq %rbx, %rdi
movl %r14d, %edx
addq $0x10010, %rsp          # imm = 0x10010
popq %rbx
popq %r14
popq %rbp
jmp 0x4018fc
movq %rdx, -0x10020(%rbp)
movl %ecx, -0x10018(%rbp)
movb %al, -0x10014(%rbp)
movb $0x0, -0x10013(%rbp)
movb %dil, -0x10012(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
movzbl -0x10020(%rbp,%rcx), %edx
addl %edx, %eax
incq %rcx
cmpq $0xf, %rcx
jne 0x401f71
movl %eax, %ecx
shll $0x8, %ecx
addl %ecx, %eax
addl $0x69, %eax
leaq -0x1000f(%rbp), %rdi
movw %ax, -0x2(%rdi)
movl %r14d, %edx
callq 0x401040
addl $0x11, %r14d
leaq -0x10020(%rbp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x4018fc
addq $0x10010, %rsp          # imm = 0x10010
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: tapAddBlock
void tapAddBlock(FILE* file, int len, char* buf, int type) {
	int crc = type & 0xff;
	for (int i = 0; i < len; i++) {
		crc ^= buf[i];
	}
	fputc((len + 2) & 0xff, file);
	fputc(((len + 2) >> 8) & 0xff, file);
	fputc(type, file);
	fwrite(buf, len, 1, file);
	fputc(crc, file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rbx
movl %ecx, -0x2c(%rbp)
movzbl %cl, %r14d
testl %esi, %esi
jle 0x401ffa
movl %r12d, %eax
xorl %ecx, %ecx
movsbl (%r15,%rcx), %edx
xorl %edx, %r14d
incq %rcx
cmpq %rcx, %rax
jne 0x401fea
leal 0x2(%r12), %r13d
movl $0xff, %eax
movl %r13d, %edi
andl %eax, %edi
movq %rbx, %rsi
callq 0x418a10
shrl $0x8, %r13d
movl $0xff, %eax
andl %eax, %r13d
movl %r13d, %edi
movq %rbx, %rsi
callq 0x418a10
movl -0x2c(%rbp), %edi
movq %rbx, %rsi
callq 0x418a10
movslq %r12d, %rsi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x414c50
movl %r14d, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x418a10
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: tapList
void tapList(char* path) {
	FILE* file = fopen(path, "rb");
	if (!file) {
		printf("Can't open image '%s'\n",path);
		return;
	}
	int len;
	tHead hd;
	int blk = 0;
	printf("Name\t\tType\tStart\tSize\n");
	printf("------------------------------------\n");
	while (1) {
		len = fgetc(file);
		len |= (fgetc(file) << 8);
		if (feof(file)) break;
		int type = fgetc(file);
		if (type == 0x00) {
			fread((char*)&hd, sizeof(tHead), 1, file);
			printf("%.10s\t%s\t%i\t%i\n",hd.name, hd.type ? "Bytes" : "Prog", hd.asl | (hd.ash << 8), hd.dll | (hd.dlh << 8));
			fgetc(file);		// skip crc
		} else {
			fseek(file, len - 1, SEEK_CUR);
			printf("blk-%.3i\t\t\t\t%i\n",blk,len - 2);
		}
		blk++;
	}
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x9cfc9(%rip), %rsi     # 0x49f051
callq 0x414900
testq %rax, %rax
je 0x4021b4
movq %rax, %rbx
leaq 0x9d3cb(%rip), %rdi     # 0x49f46b
callq 0x414f20
leaq 0x9d3d5(%rip), %rdi     # 0x49f481
callq 0x414f20
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r14d
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r15d
movq %rbx, %rdi
callq 0x418940
testl %eax, %eax
jne 0x40219d
shll $0x8, %r15d
orl %r14d, %r15d
leaq 0x9d01c(%rip), %r13     # 0x49f101
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x418c30
testl %eax, %eax
je 0x40211e
leal -0x1(%r15), %eax
movslq %eax, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x418b50
addl $-0x2, %r15d
movq %r13, %rdi
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x40dea0
jmp 0x40216d
movl $0x11, %esi
movl $0x1, %edx
leaq -0x39(%rbp), %rdi
movq %rbx, %rcx
callq 0x414a00
cmpb $0x0, -0x39(%rbp)
leaq 0x9cfb7(%rip), %rdx     # 0x49f0f6
leaq 0x9cfb6(%rip), %rax     # 0x49f0fc
cmoveq %rax, %rdx
movzwl -0x2c(%rbp), %ecx
movzwl -0x2e(%rbp), %r8d
leaq 0x9cf8c(%rip), %rdi     # 0x49f0e6
leaq -0x38(%rbp), %rsi
xorl %eax, %eax
callq 0x40dea0
movq %rbx, %rdi
callq 0x418c30
incl %r14d
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r12d
movq %rbx, %rdi
callq 0x418c30
movl %eax, %r15d
shll $0x8, %r15d
orl %r12d, %r15d
movq %rbx, %rdi
callq 0x418940
testl %eax, %eax
je 0x4020e8
movq %rbx, %rdi
callq 0x4144c0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9cf14(%rip), %rdi     # 0x49f0cf
movq %r14, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: tapPush
void tapPush(char* iname, char* fname) {
	char buf[0x10000];
	int flen = readfile(fname, buf, 0xfffd);
	if (flen < 0) return;	
	FILE* file = fopen(iname, "ab");
	if (!file) {
		printf("Can't open '%s' for append\n", iname);
		return;
	}
	if (!opt.headLess) {
		tHead hd;
		memset(hd.name, 0x20, 10);
		xName nm = cutName(fname);
		memcpy(hd.name, nm.name, 10);
		hd.dll = flen & 0xff;
		hd.dlh = (flen >> 8) & 0xff;
		if (opt.isBasic) {
			hd.type = 0x00;
			hd.asl = opt.aStart & 0xff;
			hd.ash = (opt.aStart >> 8) & 0xff;
			hd.pll = hd.dll;
			hd.plh = hd.dlh;
		} else {
			hd.type = 0x03;
			hd.asl = 0;
			hd.ash = 0;
			hd.pll = 0;
			hd.plh = 0x80;
		}
		tapAddBlock(file, sizeof(tHead), (char*)&hd, 0x00);
	}
	tapAddBlock(file, flen, buf, 0xff);		// data
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10020, %rsp          # imm = 0x10020
movq %rsi, %r15
movq %rdi, %r12
leaq -0x10040(%rbp), %rsi
movq %r15, %rdi
movl $0xfffd, %edx           # imm = 0xFFFD
callq 0x401848
testl %eax, %eax
js 0x40225b
movl %eax, %ebx
leaq 0x9cf05(%rip), %rsi     # 0x49f111
movq %r12, %rdi
callq 0x414900
testq %rax, %rax
je 0x40226b
movq %rax, %r14
testb $0x2, 0xd018d(%rip)     # 0x4d23b0
jne 0x4022bf
movq %r15, %rdi
callq 0x401b16
movq %rax, -0x30(%rbp)
movw %dx, -0x28(%rbp)
movb %bl, -0x26(%rbp)
movl %ebx, %eax
shrl $0x8, %eax
movb %al, -0x25(%rbp)
testb $0x1, 0xd0165(%rip)     # 0x4d23b0
jne 0x40228b
movb $-0x80, %al
movb $0x3, %sil
xorl %ecx, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
jmp 0x40229b
addq $0x10020, %rsp          # imm = 0x10020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9cea2(%rip), %rdi     # 0x49f114
movq %r12, %rsi
xorl %eax, %eax
addq $0x10020, %rsp          # imm = 0x10020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
movl 0xd0123(%rip), %ecx     # 0x4d23b4
movl %ecx, %edi
shrl $0x8, %edi
xorl %esi, %esi
movl %ebx, %r8d
leaq -0x31(%rbp), %rdx
movb %sil, (%rdx)
movb %cl, 0xd(%rdx)
movb %dil, 0xe(%rdx)
movb %r8b, 0xf(%rdx)
movb %al, 0x10(%rdx)
movq %r14, %rdi
movl $0x11, %esi
xorl %ecx, %ecx
callq 0x401fc3
leaq -0x10040(%rbp), %rdx
movq %r14, %rdi
movl %ebx, %esi
movl $0xff, %ecx
callq 0x401fc3
movq %r14, %rdi
addq $0x10020, %rsp          # imm = 0x10020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4144c0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: sclList
void sclList(char* path) {
	FILE* file = fopen(path, "rb");
	if (!file) {
		printf("Can't open image '%s'\n",path);
		return;
	}
	trdFile hd;
	printf("Name\t\tExt\tStart\tSize\tSLen\n---------------------------\n");
	fseek(file, 8, SEEK_SET);
	int cnt = fgetc(file);
	unsigned short start, len;
	while (cnt > 0) {
		fread((char*)&hd, 14, 1, file);
		start = hd.stl | (hd.sth << 8);
		len = hd.lnl | (hd.lnh << 8);
		printf("%.8s\t%c\t%i\t%i\t%i\n",hd.name, hd.ext, start, len, hd.slen);
		cnt--;
	}
	fclose (file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x9ccf3(%rip), %rsi     # 0x49f051
callq 0x414900
testq %rax, %rax
je 0x4023f9
movq %rax, %rbx
leaq 0x9d142(%rip), %rdi     # 0x49f4b8
callq 0x414f20
movl $0x8, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x418c30
testl %eax, %eax
jle 0x4023e4
movl %eax, %r14d
incl %r14d
leaq -0x30(%rbp), %r15
leaq 0x9cd89(%rip), %r12     # 0x49f130
movl $0xe, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x414a00
movzwl -0x27(%rbp), %ecx
movzwl -0x25(%rbp), %r8d
movsbl -0x28(%rbp), %edx
movzbl -0x23(%rbp), %r9d
movq %r12, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x40dea0
decl %r14d
cmpl $0x1, %r14d
ja 0x4023a7
movq %rbx, %rdi
callq 0x4144c0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9cccf(%rip), %rdi     # 0x49f0cf
movq %r14, %rsi
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: sclSeekFile
int sclSeekFile(FILE* file, char* name, trdFile* hd) {
	fseek(file, 8, SEEK_SET);
	int cnt = fgetc(file);
	int find = 0;
	int pos = 9;
	while ((cnt > 0) && !find) {
		fread((char*)hd, 14, 1, file);
		if (memcmp((char*)hd, name, 9) == 0) {
			find = 1;
		} else {
			pos += 14;
			cnt--;
		}
	}
	return find ? pos : -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x8, %esi
xorl %edx, %edx
callq 0x418b50
movq %r15, %rdi
callq 0x418c30
testl %eax, %eax
jle 0x40298d
movl %eax, %r12d
movl $0x9, %eax
movl %eax, %r13d
movl $0xe, %esi
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x414a00
movq (%rbx), %rdx
xorq (%r14), %rdx
movb 0x8(%rbx), %al
xorb 0x8(%r14), %al
movzbl %al, %ecx
leal 0xe(%r13), %eax
xorl %esi, %esi
orq %rdx, %rcx
setne %sil
cmovel %r13d, %eax
subl %esi, %r12d
je 0x402981
testq %rcx, %rcx
jne 0x40293e
xorl %eax, %eax
negq %rcx
sbbl %eax, %eax
orl %r13d, %eax
jmp 0x402992
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: sclRename
void sclRename(char* ipath, char* oname, char* nname) {
	FILE* file = fopen(ipath, "r+");
	if (!file) {
		printf("Can't open file '%s'\n",ipath);
		return;
	}
	char nbuf[9];
	makeName(oname, nbuf);
	trdFile hd;
	int pos = sclSeekFile(file, nbuf, &hd);
	if (pos < 0) {
		printf("File '%s' not found in image\n",oname);
	} else {
		int oldSum = getSum(nbuf, 9);
		makeName(nname, nbuf);
		int dif = getSum(nbuf, 9) - oldSum;	// diff to new CRC
		fseek(file, pos, SEEK_SET);		// read old CRC
		fwrite(nbuf, 9, 1, file);
		fseek(file, -4, SEEK_END);
		int crc = fgeti(file);
		crc += dif;				// change it
		fseek(file, -4, SEEK_END);		// write back
		fputi(file, crc);
	}
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
leaq 0x9c7d0(%rip), %rsi     # 0x49f190
callq 0x414900
testq %rax, %rax
je 0x402a96
movq %rax, %rbx
leaq -0x29(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x401cb6
leaq -0x39(%rbp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x402907
testl %eax, %eax
js 0x402ab3
movl %eax, %r15d
xorl %eax, %eax
xorl %r12d, %r12d
movzbl -0x29(%rbp,%rax), %ecx
addl %ecx, %r12d
incq %rax
cmpl $0x9, %eax
jne 0x4029ff
leaq -0x29(%rbp), %rsi
movq %r14, %rdi
callq 0x401cb6
xorl %eax, %eax
xorl %r14d, %r14d
movzbl -0x29(%rbp,%rax), %ecx
addl %ecx, %r14d
incq %rax
cmpl $0x9, %eax
jne 0x402a20
subl %r12d, %r14d
movl %r15d, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
leaq -0x29(%rbp), %rdi
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x414c50
movq %rbx, %rdi
movq $-0x4, %rsi
movl $0x2, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x401c05
addl %eax, %r14d
movq %rbx, %rdi
movq $-0x4, %rsi
movl $0x2, %edx
callq 0x418b50
movq %rbx, %rdi
movl %r14d, %esi
callq 0x401c58
jmp 0x402ac4
leaq 0x9c5b7(%rip), %rdi     # 0x49f054
movq %r15, %rsi
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
leaq 0x9c6b8(%rip), %rdi     # 0x49f172
movq %r12, %rsi
xorl %eax, %eax
callq 0x40dea0
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4144c0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdCreate
void trdCreate(char* path) {
	char buf[0xa0000];
	memset(buf, 0x00, 0xa0000);
	buf[0x8e2] = 0x01;
	buf[0x8e3] = 0x16;
	buf[0x8e5] = 0xf0;
	buf[0x8e6] = 0x09;
	buf[0x8e7] = 0x10;
	FILE *file = fopen(path, "wb");
	if (!file) {
		printf("Can't write to file '%s'\n",path);
	} else {
		fwrite(buf, 0xa0000, 1, file);
		fclose(file);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0000, %rsp          # imm = 0xA0000
movq %rdi, %rbx
leaq -0xa0010(%rbp), %r14
movl $0xa0000, %edx          # imm = 0xA0000
movq %r14, %rdi
xorl %esi, %esi
callq 0x4010a0
movw $0x1601, 0x8e2(%r14)    # imm = 0x1601
movw $0x9f0, 0x8e5(%r14)     # imm = 0x9F0
movb $0x10, 0x8e7(%r14)
leaq 0x9c573(%rip), %rsi     # 0x49f095
movq %rbx, %rdi
callq 0x414900
testq %rax, %rax
je 0x402b5e
movq %rax, %r14
leaq -0xa0010(%rbp), %rdi
movl $0xa0000, %esi          # imm = 0xA0000
movl $0x1, %edx
movq %rax, %rcx
callq 0x414c50
movq %r14, %rdi
addq $0xa0000, %rsp          # imm = 0xA0000
popq %rbx
popq %r14
popq %rbp
jmp 0x4144c0
leaq 0x9c62e(%rip), %rdi     # 0x49f193
movq %rbx, %rsi
xorl %eax, %eax
addq $0xa0000, %rsp          # imm = 0xA0000
popq %rbx
popq %r14
popq %rbp
jmp 0x40dea0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdList
void trdList(char* path) {
	FILE* file = fopen(path, "rb");
	if (!file) {
		printf("Can't open image '%s'\n", path);
		return;
	}
	printf("Name\t\tExt\tStart\tSize\tSLen\tSec\tTrk\n---------------------------\n");
	trdFile hd;
	int cnt = 0;
	int start,len;
	while (cnt < 128) {
		fread((char*)&hd, 16, 1, file);
		if (hd.name[0] == 0x00) break;
		if (hd.name[0] != 0x01) {
			start = hd.stl | (hd.sth << 8);
			len = hd.lnl | (hd.lnh << 8);
			printf("%.8s\t%c\t%i\t%i\t%i\t%i\t%i\n", hd.name, hd.ext, start, len, hd.slen, hd.sec, hd.trk);
		}
	}
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x9c4c0(%rip), %rsi     # 0x49f051
callq 0x414900
testq %rax, %rax
je 0x402c21
movq %rax, %rbx
leaq 0x9c95d(%rip), %rdi     # 0x49f506
callq 0x414f20
leaq -0x28(%rbp), %r14
leaq 0x9c5f4(%rip), %r15     # 0x49f1ad
movl $0x10, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x414a00
movzbl -0x28(%rbp), %eax
cmpl $0x1, %eax
je 0x402bb9
testl %eax, %eax
je 0x402c0e
movzwl -0x1f(%rbp), %ecx
movzwl -0x1d(%rbp), %r8d
movsbl -0x20(%rbp), %edx
movzbl -0x1b(%rbp), %r9d
movzbl -0x1a(%rbp), %r10d
movzbl -0x19(%rbp), %r11d
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x40dea0
addq $0x10, %rsp
jmp 0x402bb9
movq %rbx, %rdi
callq 0x4144c0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9c4a7(%rip), %rdi     # 0x49f0cf
movq %r14, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trd_put_data
void trd_put_data(char* img, char* buf, int trk, int sec, int len, int dt) {
	if ((dt == 0x18) || (dt == 0x19)) {
		sec = (trk << 5) | (sec & 0x0f);
		char* ptr = buf;
		while (len > 0) {
			memcpy(img + (sec << 8), ptr, 0x100);
			sec++;
			if ((sec & 0x0f) == 0)
				sec += 0x10;
			ptr += 0x100;
			len--;
		}
	} else {
		sec = (trk << 4) | (sec & 0x0f);
		memcpy(img + (sec << 8), buf, len << 8);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebx
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %r15
andl $-0x2, %r9d
cmpl $0x18, %r9d
jne 0x402cac
testl %ebx, %ebx
jle 0x402ca3
andl $0xf, %ecx
shll $0x5, %r12d
orl %ecx, %r12d
incl %ebx
movl %r12d, %eax
shll $0x8, %eax
movslq %eax, %rdi
addq %r15, %rdi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rsi
callq 0x401040
leal 0x1(%r12), %eax
addl $0x11, %r12d
testb $0xf, %al
cmovnel %eax, %r12d
addq $0x100, %r14            # imm = 0x100
decl %ebx
cmpl $0x1, %ebx
ja 0x402c6d
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
shll $0xc, %r12d
andl $0xf, %ecx
shll $0x8, %ecx
orl %r12d, %ecx
movslq %ecx, %rax
addq %rax, %r15
shll $0x8, %ebx
movslq %ebx, %rdx
movq %r15, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x401040
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdPush
void trdPush(char* ipath, char* fpath) {
	char buf[0x10000];
	trdFile hd = prepareFile(fpath, buf);
	if (hd.name[0] == 0) return;
	char img[0xa0000];
	memset(img, 0, 0xa0000);
	if (readfile(ipath, img, 0xa0000) < 0) {
		printf("Can't read image '%s'\n", ipath);
		return;
	}
	int files = img[0x8e4];			// test files count
	if (files > 127) {
		printf("Too many files in image\n");
		return;
	}
	int freesec = (img[0x8e5] & 0xff) | ((img[0x8e6] & 0xff) << 8);
	
	if (freesec < hd.slen) {		// test free sectors
		printf("No room for file\n");
		return;
	}
	int lastsec = img[0x8e1] & 0xff;
	int lasttrk = img[0x8e2] & 0xff;
	hd.sec = lastsec;
	hd.trk = lasttrk;
	files++;
	img[0x8e4] = files;
	freesec -= hd.slen;
	img[0x8e5] = freesec & 0xff;
	img[0x8e6] = ((freesec & 0xff00) >> 8);
	int diskType = img[0x8e3] & 0xff;
	char* ptr = img;
	while (*ptr)				// find 1st free descriptor
		ptr += 16;
	memcpy(ptr, (char*)&hd, 16);		// make new descriptor
	int secnum = ((hd.trk << 4) + hd.sec);	// free sector num
	// int fpos = (secnum << 8); 		// position in image
	secnum += hd.slen;
	img[0x8e1] = secnum & 0x0f;
	img[0x8e2] = ((secnum & 0xfff0) >> 4);
	trd_put_data(img, buf, hd.trk, hd.sec, hd.slen, diskType);
	// memcpy(img + fpos, buf, hd.slen << 8);	// copy file data
	savefile(ipath, img, 0xa0000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0000, %rsp          # imm = 0xB0000
movq %rsi, %rax
movq %rdi, %rbx
leaq -0x10020(%rbp), %rsi
movq %rax, %rdi
callq 0x401e02
movq %rax, %r14
testb %r14b, %r14b
je 0x402e18
movq %rdx, %r15
leaq -0xb0020(%rbp), %r12
movl $0xa0000, %edx          # imm = 0xA0000
movq %r12, %rdi
xorl %esi, %esi
callq 0x4010a0
movq %rbx, %rdi
movq %r12, %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x401848
testl %eax, %eax
js 0x402d60
movzwl -0xaf73b(%rbp), %eax
movq %r15, %rcx
shrq $0x28, %rcx
movzbl %cl, %r8d
subl %r8d, %eax
jae 0x402d76
leaq 0x9c7ee(%rip), %rdi     # 0x49f544
callq 0x414f20
jmp 0x402e18
leaq 0x9c45e(%rip), %rdi     # 0x49f1c5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x40dea0
jmp 0x402e18
movzbl -0xaf73f(%rbp), %ecx
movzbl -0xaf73e(%rbp), %edx
movq %rcx, %rsi
shlq $0x30, %rsi
movabsq $0xffffffffffff, %rdi   # imm = 0xFFFFFFFFFFFF
andq %rdi, %r15
incb -0xaf73c(%rbp)
orq %rsi, %r15
movb %al, -0xaf73b(%rbp)
movb %ah, -0xaf73a(%rbp)
movzbl -0xaf73d(%rbp), %r9d
cmpb $0x0, (%r12)
leaq 0x10(%r12), %r12
jne 0x402db5
movq %rdx, %rax
shlq $0x38, %rax
orq %rax, %r15
movq %r14, -0x10(%r12)
movq %r15, -0x8(%r12)
leal (%r8,%rcx), %eax
movl %eax, %esi
andb $0xf, %sil
leaq -0xb0020(%rbp), %r14
movb %sil, 0x8e1(%r14)
shrl $0x4, %eax
addb %dl, %al
movb %al, 0x8e2(%r14)
leaq -0x10020(%rbp), %rsi
movq %r14, %rdi
callq 0x402c3c
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x4018fc
addq $0xb0000, %rsp          # imm = 0xB0000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdSeekFile
int trdSeekFile(FILE* file, char* name, trdFile* hd) {
	int find = 0;
	int cnt = 0;
	rewind(file);
	while ((cnt < 128) && !find) {
		fread((char*)hd, 16, 1, file);
		if (hd->name[0] == 0x00) break;
		if (memcmp((char*)hd, name, 9) == 0) {
			find = 1;
		}
		cnt++;
	}
	return find ? (cnt - 1) << 4 : -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x418d50
xorl %r13d, %r13d
movl $0xfffffff0, %ebx       # imm = 0xFFFFFFF0
movl $0x10, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rcx
callq 0x414a00
cmpb $0x0, (%r14)
je 0x402e94
movq (%r14), %rcx
xorq (%r15), %rcx
movb 0x8(%r14), %al
xorb 0x8(%r15), %al
movzbl %al, %edx
xorl %eax, %eax
orq %rcx, %rdx
setne %al
addl $0x10, %ebx
cmpl $0x7e, %r13d
ja 0x402e90
incl %r13d
testl %eax, %eax
jne 0x402e4c
testl %eax, %eax
je 0x402e99
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trd_get_data
void trd_get_data(FILE* file, char* buf, int trk, int sec, int len, int dt) {
	if ((dt == 0x18) || (dt == 0x19)) {
		fseek(file, ((trk << 5) | (sec & 0x0f)) << 8, SEEK_SET);
		char* ptr = buf;
		while (len > 0) {
			fread(ptr, 0x100, 1, file);		// read 1 sec
			if ((ftell(file) & 0xfff) == 0) {	// if eot
				fseek(file, 0x1000, SEEK_CUR);	// skip 4Kb
			}
			ptr += 0x100;
			len--;
		}
	} else {
		fseek(file, ((trk << 4) | (sec & 0x0f)) << 8, SEEK_SET);
		fread(buf, len << 8, 1, file);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %r15d
movq %rsi, %r14
movq %rdi, %rbx
andl $-0x2, %r9d
andl $0xf, %ecx
shll $0x8, %ecx
cmpl $0x18, %r9d
jne 0x402f37
shll $0xd, %edx
orl %edx, %ecx
movslq %ecx, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
testl %r15d, %r15d
jle 0x402f2c
incl %r15d
movl $0x100, %esi            # imm = 0x100
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x414a00
movq %rbx, %rdi
callq 0x414b00
shlq $0x34, %rax
jne 0x402f1c
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
movl $0x1, %edx
callq 0x418b50
addq $0x100, %r14            # imm = 0x100
decl %r15d
cmpl $0x1, %r15d
jg 0x402ee7
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
shll $0xc, %edx
orl %edx, %ecx
movslq %ecx, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
shll $0x8, %r15d
movslq %r15d, %rsi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x414a00
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdPop
void trdPop(char* ipath, char* fname, char* oname) {
	FILE* file = fopen(ipath, "rb");
	if (!file) {
		printf("Can't open image '%s'\n",ipath);
		return;
	}
	char nbuf[9];
	char xbuf[256];
	char buf[0x10000];
	int num = 0;
	makeName(fname, nbuf);
	trdFile hd;
	fseek(file, 0x8e3, SEEK_SET);
	int diskType = fgetc(file) & 0xff;	// 0x16:80ds, 17:40ds, 18:80ss, 19:40ss
	if (fname == NULL) {
		do {
			fseek(file, num << 4, SEEK_SET);
			fread(&hd, 16, 1, file);
			if (hd.name[0] > 31) {
				trd_get_data(file, buf, hd.trk, hd.sec, hd.slen, diskType);
				sprintf(xbuf,"%.3i_%.8s.%c",num,hd.name,hd.ext);
				// printf("%s\n",xbuf);
				saveoutput(xbuf, buf, hd);
			}
			num++;
		} while ((num < 128) && (hd.name[0] != 0x00));
	} else if (trdSeekFile(file, nbuf, &hd) < 0) {
		printf("Can't find file '%s' in image\n",fname);
	} else {
		trd_get_data(file, buf, hd.trk, hd.sec, hd.slen, diskType);
		saveoutput(oname, buf, hd);
	}
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10128, %rsp          # imm = 0x10128
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x9c0c3(%rip), %rsi     # 0x49f051
callq 0x414900
testq %rax, %rax
je 0x403020
movq %rax, %rbx
leaq -0x45(%rbp), %rsi
movq %r15, %rdi
callq 0x401cb6
movl $0x8e3, %esi            # imm = 0x8E3
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
movq %rbx, %rdi
callq 0x418c30
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
testq %r15, %r15
je 0x403042
leaq -0x45(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x402e28
testl %eax, %eax
js 0x4030e6
movzbl -0x29(%rbp), %edx
movzbl -0x2a(%rbp), %ecx
movzbl -0x2b(%rbp), %r8d
leaq -0x10150(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl -0x3c(%rbp), %r9d
callq 0x402eaa
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x401edf
jmp 0x4030f7
leaq 0x9c0a8(%rip), %rdi     # 0x49f0cf
movq %r12, %rsi
xorl %eax, %eax
addq $0x10128, %rsp          # imm = 0x10128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x418b50
movl $0x10, %esi
movl $0x1, %edx
leaq -0x38(%rbp), %rdi
movq %rbx, %rcx
callq 0x414a00
movb -0x38(%rbp), %al
cmpb $0x20, %al
jl 0x4030cf
movzbl -0x29(%rbp), %edx
movzbl -0x2a(%rbp), %ecx
movzbl -0x2b(%rbp), %r8d
movq %rbx, %rdi
leaq -0x10150(%rbp), %r13
movq %r13, %rsi
movl -0x3c(%rbp), %r9d
callq 0x402eaa
movsbl -0x30(%rbp), %r8d
leaq -0x150(%rbp), %r15
movq %r15, %rdi
leaq 0x9c0ba(%rip), %rsi     # 0x49f165
movl %r12d, %edx
leaq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x40df70
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq %r15, %rdi
movq %r13, %rsi
callq 0x401edf
movb -0x38(%rbp), %al
cmpq $0x7e, %r12
ja 0x4030f7
incq %r12
addq $0x10, %r14
testb %al, %al
jne 0x403048
jmp 0x4030f7
leaq 0x9c0ef(%rip), %rdi     # 0x49f1dc
movq %r15, %rsi
xorl %eax, %eax
callq 0x40dea0
movq %rbx, %rdi
callq 0x4144c0
addq $0x10128, %rsp          # imm = 0x10128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: trdRename
void trdRename(char* ipath, char* oname, char* nname) {
	FILE* file = fopen(ipath, "r+");
	if (!file) {
		printf("Can't open image '%s'\n",ipath);
		return;
	}
	char nbuf[9];
	makeName(oname, nbuf);
	trdFile hd;
	int pos = trdSeekFile(file, nbuf, &hd);
	if (pos < 0) {
		printf("Can't find file '%s' in image\n",oname);
	} else {
		makeName(nname, nbuf);
		fseek(file, pos, SEEK_SET);
		fwrite(nbuf, 9, 1, file);
	}
	fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
leaq 0x9c060(%rip), %rsi     # 0x49f190
callq 0x414900
testq %rax, %rax
je 0x403195
movq %rax, %rbx
leaq -0x29(%rbp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x401cb6
leaq -0x39(%rbp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x402e28
testl %eax, %eax
js 0x4031b2
movl %eax, %r12d
leaq -0x29(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x401cb6
movl %r12d, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x418b50
movl $0x9, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x414c50
jmp 0x4031c3
leaq 0x9bf33(%rip), %rdi     # 0x49f0cf
movq %r12, %rsi
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x40dea0
leaq 0x9c023(%rip), %rdi     # 0x49f1dc
movq %r14, %rsi
xorl %eax, %eax
callq 0x40dea0
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4144c0
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: create
void create(char* path) {
	if (testExt(path, "tap")) {
		tapCreate(path);
	} else if (testExt(path, "scl")) {
		sclCreate(path);
	} else if (testExt(path, "trd")) {
		trdCreate(path);
	} else {
		printf("Unknown type, use TAP SCL TRD please\n");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x9bed0(%rip), %rsi     # 0x49f0ba
callq 0x401974
testl %eax, %eax
je 0x403205
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x4018fc
leaq 0x9beb2(%rip), %rsi     # 0x49f0be
movq %rbx, %rdi
callq 0x401974
testl %eax, %eax
je 0x40324b
movabsq $0x25500524941, %rax    # imm = 0x25500524941
leaq -0x18(%rbp), %rsi
movq %rax, 0x5(%rsi)
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
movq %rax, (%rsi)
movq %rbx, %rdi
movl $0xd, %edx
callq 0x4018fc
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x9be79(%rip), %rsi     # 0x49f0cb
movq %rbx, %rdi
callq 0x401974
testl %eax, %eax
je 0x40326c
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x402ad8
leaq 0x9c2e2(%rip), %rdi     # 0x49f555
addq $0x18, %rsp
popq %rbx
popq %rbp
jmp 0x414f20
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: list
void list(char* path) {
	int mode = getFileType(path);
	switch (mode) {
		case TYPE_TAP:
			tapList(path);
			break;
		case TYPE_SCL:
			sclList(path);
			break;
		case TYPE_TRD:
			trdList(path);
			break;
		default:
			printf("Unknown image type\n");
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4019fd
movl %eax, %eax
leaq 0x9bd6f(%rip), %rcx     # 0x49f004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x9c2d5(%rip), %rdi     # 0x49f57a
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x414f20
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x402b7a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x40206d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x402345
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: push
void push(char* ipath, char* fpath) {
	int type = getFileType(ipath);
	switch(type) {
		case TYPE_TAP:
			tapPush(ipath, fpath);
			break;
		case TYPE_SCL:
			sclPush(ipath, fpath);
			break;
		case TYPE_TRD:
			trdPush(ipath, fpath);
			break;
		default:
			printf("Unknown image type\n");
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4019fd
movl %eax, %eax
leaq 0x9bd1f(%rip), %rcx     # 0x49f014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x9c275(%rip), %rdi     # 0x49f57a
popq %rbx
popq %r14
popq %rbp
jmp 0x414f20
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x402cd8
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x4021d3
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x402416
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: pop
void pop(char* ipath, char* fname, char* oname) {
	if (!oname) {
		if (opt.asHobeta) {
			char fpath[1024];
			memset(fpath, 0, 1024);
			char* pDot = strrchr(fname,'.');
			if (pDot) {
				memcpy(fpath, fname, pDot - fname + 1);
				strcat(fpath,"$");
				strcat(fpath,pDot + 1);
				oname = fpath;
			} else {
				oname = fname;
			}
		} else {
			oname = fname;
		}
	}
	int type = getFileType(ipath);
	switch(type) {
		case TYPE_TAP:
			tapPop(ipath, fname, oname);
			break;
		case TYPE_SCL:
			sclPop(ipath, fname, oname);
			break;
		case TYPE_TRD:
			trdPop(ipath, fname, oname);
			break;
		default:
			printf("Unknown image type\n");
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
jne 0x4033ce
testb $0x4, 0xcf04c(%rip)     # 0x4d23b0
movq %rbx, %r12
je 0x4033ce
leaq -0x430(%rbp), %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x4010a0
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x401050
movq %rbx, %r12
testq %rax, %rax
je 0x4033ce
movq %rax, %r13
movq %rax, %rdx
subq %rbx, %rdx
incq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x401040
movq %r15, %rdi
callq 0x4010d8
movw $0x24, -0x430(%rbp,%rax)
incq %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x401058
movq %r15, %r12
movq %r14, %rdi
callq 0x4019fd
movl %eax, %eax
leaq 0x9bc45(%rip), %rcx     # 0x49f024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x9c18b(%rip), %rdi     # 0x49f57a
jmp 0x403408
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x402f6a
jmp 0x40341d
leaq 0x9c09e(%rip), %rdi     # 0x49f4a6
callq 0x414f20
jmp 0x40341d
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4026d4
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: renam
void renam(char* ipath, char* oname, char* nname) {
	int type = getFileType(ipath);
	switch(type) {
		case TYPE_TAP:
			tapRename(ipath, oname, nname);
			break;
		case TYPE_SCL:
			sclRename(ipath, oname, nname);
			break;
		case TYPE_TRD:
			trdRename(ipath, oname, nname);
			break;
		default:
			printf("Unknown image type\n");
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x4019fd
movl %eax, %eax
leaq 0x9bbe4(%rip), %rcx     # 0x49f034
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x9c11a(%rip), %rdi     # 0x49f57a
jmp 0x403481
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x403111
leaq 0x9c025(%rip), %rdi     # 0x49f4a6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x414f20
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4029a1
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_11/entab.c
// Function: is_tab_stop_arg_list_valid
int is_tab_stop_arg_list_valid(int argc, char *argv[])
{
  for (size_t i = 1; i < argc; ++i)
  {
    if (!is_str_uint(argv[i]) || (i > 1 && atoi(argv[i - 1]) > atoi(argv[i])))
    {
      return 0;
    }
  }
  return 1;
}

// Assembly:
movl $0x1, %eax
cmpl $0x2, %edi
jb 0x1345
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %r14
movq %r14, %rdi
callq 0x1346
testl %eax, %eax
je 0x1335
movslq %ebp, %r15
movl $0x2, %r13d
xorl %r12d, %r12d
leaq -0x1(%r13), %rax
cmpq $0x2, %rax
jb 0x1310
movq -0x10(%rbx,%r13,8), %rdi
callq 0x1070
movl %eax, %ebp
movq %r14, %rdi
callq 0x1070
cmpl %eax, %ebp
jg 0x132c
cmpq %r15, %r13
setae %r12b
je 0x132c
movq (%rbx,%r13,8), %r14
movq %r14, %rdi
callq 0x1346
incq %r13
testl %eax, %eax
jne 0x12ee
movzbl %r12b, %eax
andl $0x1, %eax
jmp 0x1337
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq