// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: list(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void list(const string fname) {
	unsigned char *buf = new unsigned char[0xa0000];
	int len=readfile(fname,buf);
	if (len<1) {cout<<"Can't read file"<<endl; return;}
	int mode=testsig(buf,len);
	unsigned char* ptr = buf;
	unsigned char i=0;
	switch (mode) {
		case 1:
			ptr+=9;
			printf("Name\t\tExt\tStart\tSize\tSLen\n---------------------------\n");
			for(;i<*(buf+8);i++) {
				printf("%.8s\t%.1s\t%i\t%i\t%i\n",ptr,ptr+8,*(ptr+9)+(*(ptr+10)<<8),*(ptr+11)+(*(ptr+12)<<8),*(ptr+13));
				ptr+=14;
			}
			break;
		case 2:
			printf("Name\t\tExt\tStart\tSize\tSLen\tTrk\tSec\n---------------------------\n");
			while (*ptr!=0 && i<128) {
				if (*ptr!=1) printf("%.8s\t%.1s\t%i\t%i\t%i\t%i\t%i\n",ptr,ptr+8,*(ptr+9)+(*(ptr+10)<<8),*(ptr+11)+(*(ptr+12)<<8),*(ptr+13),*(ptr+14),*(ptr+15));
				ptr+=16; i++;
			}
			break;
		default: cout<<"Unknown image format"<<endl; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x407e80
movq -0x68(%rbp), %rsi
movq %rax, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x478cf0
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x404740
movl %eax, -0x58(%rbp)
jmp 0x405d79
leaq -0x38(%rbp), %rdi
callq 0x476560
movl -0x58(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x405dcf
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17928e(%rip), %rsi    # 0x57f02a
callq 0x470190
movq %rax, %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405f8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x476560
jmp 0x405f93
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x404860
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movb $0x0, -0x51(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x6c(%rbp)
subl $0x1, %eax
je 0x405e0b
jmp 0x405dfa
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0x405e9f
jmp 0x405f68
movq -0x50(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x50(%rbp)
leaq 0x179342(%rip), %rdi    # 0x57f160
movb $0x0, %al
callq 0x4cf0e0
movzbl -0x51(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x405e9a
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x8, %rdx
movq -0x50(%rbp), %rax
movzbl 0x9(%rax), %ecx
movq -0x50(%rbp), %rax
movzbl 0xa(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x50(%rbp), %rax
movzbl 0xb(%rax), %r8d
movq -0x50(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x8, %eax
addl %eax, %r8d
movq -0x50(%rbp), %rax
movzbl 0xd(%rax), %r9d
leaq 0x17931a(%rip), %rdi    # 0x57f197
movb $0x0, %al
callq 0x4cf0e0
movq -0x50(%rbp), %rax
addq $0xe, %rax
movq %rax, -0x50(%rbp)
movb -0x51(%rbp), %al
addb $0x1, %al
movb %al, -0x51(%rbp)
jmp 0x405e25
jmp 0x405f8a
leaq 0x179305(%rip), %rdi    # 0x57f1ab
movb $0x0, %al
callq 0x4cf0e0
movq -0x50(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x6d(%rbp)
je 0x405ecd
movzbl -0x51(%rbp), %eax
cmpl $0x80, %eax
setl %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x405ed9
jmp 0x405f66
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x405f4d
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x8, %rdx
movq -0x50(%rbp), %rax
movzbl 0x9(%rax), %ecx
movq -0x50(%rbp), %rax
movzbl 0xa(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x50(%rbp), %rax
movzbl 0xb(%rax), %r8d
movq -0x50(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x8, %eax
addl %eax, %r8d
movq -0x50(%rbp), %rax
movzbl 0xd(%rax), %r9d
movq -0x50(%rbp), %rax
movzbl 0xe(%rax), %r10d
movq -0x50(%rbp), %rax
movzbl 0xf(%rax), %eax
leaq 0x1792ac(%rip), %rdi    # 0x57f1ea
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x4cf0e0
movq -0x50(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
movb -0x51(%rbp), %al
addb $0x1, %al
movb %al, -0x51(%rbp)
jmp 0x405ead
jmp 0x405f8a
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179150(%rip), %rsi    # 0x57f0c6
callq 0x470190
movq %rax, %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
addq $0x80, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4a85a0
nopl (%rax)