// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: nlist(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void nlist(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;
			for(;i<*(buf+8);i++) {
				printf("%.8s.%.1s\n",ptr,ptr+8);
				ptr+=14;
			}
			break;
		case 2:
			while (*ptr!=0 && i<128) {
				if (*ptr!=1) printf("%.8s.%.1s\n",ptr,ptr+8);
				ptr+=16; i++;
			}
			break;
		default: cout<<"Unknown image format"<<endl; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %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 0x405fe6
leaq -0x38(%rbp), %rdi
callq 0x476560
movl -0x58(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x40603c
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179021(%rip), %rsi    # 0x57f02a
callq 0x470190
movq %rax, %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x406150
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x476560
jmp 0x406156
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 0x406074
jmp 0x406067
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0x4060c5
jmp 0x40612e
movq -0x50(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x50(%rbp)
movzbl -0x51(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x4060c0
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x8, %rdx
leaq 0x179161(%rip), %rdi    # 0x57f204
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 0x406080
jmp 0x406150
jmp 0x4060c7
movq -0x50(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x6d(%rbp)
je 0x4060e7
movzbl -0x51(%rbp), %eax
cmpl $0x80, %eax
setl %al
movb %al, -0x6d(%rbp)
movb -0x6d(%rbp), %al
testb $0x1, %al
jne 0x4060f0
jmp 0x40612c
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x406116
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x8, %rdx
leaq 0x1790f5(%rip), %rdi    # 0x57f204
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 0x4060c7
jmp 0x406150
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x178f8a(%rip), %rsi    # 0x57f0c6
callq 0x470190
movq %rax, %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
addq $0x70, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4a85a0
nop