// File: /workspace/github_c_makefile_star2_O3/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: pack(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void pack(const string fextra, const string aname) {
	//
	bool hobeta=false;	//
	unsigned char hhob[17]; // ��������� HOBETA
	string fname,fext;
	unsigned short start=0;
	//
	size_t dotpos = fextra.rfind('.');		// get ZX filename+ext (8+1)
	// HOBETA ��� ���?
	if(fextra[dotpos+1]=='$'){
		hobeta = true;
	}
	//
	if (dotpos==string::npos) {fname = fextra.substr(0,8); fext = "C";}
	else {fname = fextra.substr(0,min((int)dotpos,8));
		if (dotpos>=fextra.size()-1) fext=" "; else fext=fextra.substr(dotpos+1,1);
	}
	// ��� �����
	fname.resize(8,0x20);
	unsigned char *inbuf;
	int iflen;
	if(hobeta){
		inbuf = new unsigned char[0xff11]; // +17 ����
		iflen = readfile(fextra,inbuf,0xff11);
	}
	else{
		inbuf = new unsigned char[0xff00];
		iflen = readfile(fextra,inbuf,0xff00);
	}
	if (iflen==-1) {cout<<"Can't read file"<<endl; return;}
	if (iflen==0) {cout<<"Input file is too long"<<endl; return;}
	// ��� HOBETA 
	if(hobeta){
		// ��������� ��������� ��������
		memcpy(hhob,inbuf,17);
		// � inbuf - ������ ������
		memmove(inbuf,inbuf+17,iflen-17);
		iflen=iflen-17;
		// ���
		memcpy( (void*)(fname.c_str()), hhob, 8);
		// ����������
		fext = hhob[8];
	}
	// ������ ��������
	unsigned char *obuf = new unsigned char[0xa0000];
	int olen=readfile(aname,obuf);
	if (olen<1) {cout<<"Can't read output file"<<endl; return;}
	//
	int mode=testsig(obuf,olen);
	unsigned char seclen;
	if(hobeta){
		cout << "HOBETA" << endl;
		seclen = hhob[13]; // ������ � �������� �� hobeta
		start = hhob[9] + (hhob[10]<<8);
	}
	else{
		cout << "NON HOBETA" << endl;
		seclen = ((iflen & 0xff00)>>8); if ((iflen & 0xff) != 0) seclen++;	// sectors len
	}
	
	cout<<"file len: "<<(int)iflen << " " << (int)seclen << endl;
	
	unsigned char lastsec,lasttrk,files;
	unsigned int freesec,fpos,secnum;
	unsigned char* ptr = (unsigned char*)obuf;
	FILE *ofile;
	switch (mode) {
		case 1:
			files=*(obuf+8); if (files>127) {cout<<"Too many files in image"<<endl; break;}
			(*(obuf+8))++;
			ofile = fopen(aname.c_str(),"wb");
			if (!ofile) {cout<<"Can't write to file"<<endl; break;}
			freesec=9+14*files;				// old catalog len
			fwrite(obuf,1,freesec,ofile);			// save old catalog
			ptr = new unsigned char[14];
			makedsc(ptr,fname,fext,iflen,seclen,start);		// make 14bytes-len descriptor
			fwrite(ptr,1,14,ofile);				// write it
			fwrite(obuf+freesec,1,olen-freesec,ofile);	// write old data
			fwrite(inbuf,1,iflen,ofile);			// write new data
			if ((iflen&0xff)!=0) fwrite(inbuf,1,0x100-(iflen&0xff),ofile);	// write to end of sector
			fclose(ofile);
			break;
		case 2:
			files = *(obuf+0x8e4);
			if (files > 127) {
				cout << "Too many files in image" << endl;
				break;
			}
			freesec = *(obuf+0x8e5) + (*(obuf+0x8e6) << 8);
			if (freesec < seclen) {
				cout << "No room for file" << endl;
				break;
			}
	cout << "freesec = " << (int)freesec << endl;
			lastsec = *(obuf+0x8e1);
			lasttrk = *(obuf+0x8e2);
			files++;
			*(obuf+0x8e4) = files;
			freesec -= seclen;
			*(obuf+0x8e5) = freesec & 0xff;
			*(obuf+0x8e6) = ((freesec & 0xff00) >> 8);
			while (*ptr != 0) ptr += 16;
			makedsc(ptr,fname,fext,iflen,seclen,start);
			*(ptr+14) = lastsec;
			*(ptr+15) = lasttrk;
			secnum = ((lasttrk << 4) + lastsec);	// free sector abs num
			fpos = (secnum << 8); 			// (lasttrk<<12)+(lastsec<<8);
			secnum += seclen;
			lastsec = secnum & 15;
			lasttrk = ((secnum & 0xfff0) >> 4);
//			lastsec += (seclen & 15);
//			lasttrk+=((seclen&0xf0)>>4);
//			if (lastsec>15) {lastsec-=16; lasttrk++;}
			*(obuf+0x8e1) = lastsec;
			*(obuf+0x8e2) = lasttrk;
			memcpy(obuf+fpos,inbuf,iflen);
//	throw(0);
			savefile(aname,obuf,0xa0000);
			break;
		default: cout<<"Unknown image format"<<endl; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, -0x48(%rbp)
movq %rdi, %rbx
leaq -0x68(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x88(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x4774a0
movq %rax, %r12
movq %rax, %r14
movq (%rbx), %rax
incq %r14
movb (%rax,%r14), %r15b
jne 0x4048f2
leaq -0xb8(%rbp), %rdi
movl $0x8, %ecx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4780e0
leaq -0x78(%rbp), %rdi
leaq -0xb8(%rbp), %r14
movq %r14, %rsi
callq 0x475850
movq (%r14), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x4048e6
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x406440
leaq 0x18b173(%rip), %rcx    # 0x58fa60
jmp 0x40499e
cmpl $0x8, %r12d
movl $0x8, %eax
cmovll %r12d, %eax
movslq %eax, %rcx
leaq -0xb8(%rbp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4780e0
leaq -0x78(%rbp), %rdi
leaq -0xb8(%rbp), %r13
movq %r13, %rsi
callq 0x475850
movq (%r13), %rdi
leaq -0xa8(%rbp), %r13
cmpq %r13, %rdi
je 0x404945
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x406440
movq 0x8(%rbx), %rax
decq %rax
cmpq %rax, %r12
jae 0x404997
leaq -0xb8(%rbp), %rdi
movl $0x1, %ecx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4780e0
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %r14
movq %r14, %rsi
callq 0x475850
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x4049b6
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x406440
jmp 0x4049b6
leaq 0x179a15(%rip), %rcx    # 0x57e3b3
leaq -0x98(%rbp), %rdi
movq 0x8(%rdi), %rdx
movl $0x1, %r8d
xorl %esi, %esi
callq 0x476450
leaq -0x78(%rbp), %rdi
movl $0x8, %esi
movl $0x20, %edx
callq 0x476400
cmpb $0x24, %r15b
jne 0x404a12
movl $0xff11, %edi           # imm = 0xFF11
callq 0x407180
movq %rax, %r14
leaq -0x1a8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x4062fa
leaq -0x1b8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff11, %edx           # imm = 0xFF11
jmp 0x404a53
movl $0xff00, %edi           # imm = 0xFF00
callq 0x407180
movq %rax, %r14
leaq -0x188(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %rdi
callq 0x4062fa
leaq -0x198(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x4045d8
movl %eax, -0x2c(%rbp)
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x404a6f
movq (%r12), %rsi
incq %rsi
callq 0x406440
movl -0x2c(%rbp), %eax
cmpl $-0x1, %eax
je 0x404a8d
testl %eax, %eax
jne 0x404b20
movl $0x16, %edx
leaq 0x1795af(%rip), %rsi    # 0x57e03a
jmp 0x404a99
movl $0xf, %edx
leaq 0x179591(%rip), %rsi    # 0x57e02a
movq $0x5ec460, %rbx         # imm = 0x5EC460
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x404af5
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x406440
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x404b0e
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x406440
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x24, %r15b
jne 0x404b7b
movq (%r14), %r12
movsbl 0x8(%r14), %ebx
movb 0x9(%r14), %cl
movb %cl, -0x30(%rbp)
movb 0xa(%r14), %cl
movb %cl, -0x50(%rbp)
movb 0xd(%r14), %cl
movl %ecx, -0x34(%rbp)
leaq 0x11(%r14), %rsi
addl $-0x11, %eax
movl %eax, -0x2c(%rbp)
movslq %eax, %rdx
movq %r14, %rdi
callq 0x401068
movq -0x78(%rbp), %rax
movq %r12, (%rax)
leaq -0x98(%rbp), %rdi
movq 0x8(%rdi), %rdx
movl $0x1, %ecx
xorl %esi, %esi
movl %ebx, %r8d
callq 0x476140
jmp 0x404b7e
movl %eax, -0x34(%rbp)
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x407180
movq %rax, -0x40(%rbp)
leaq -0x168(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x178(%rbp), %rdi
callq 0x4062fa
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
movq -0x40(%rbp), %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x4045d8
movl %eax, %r12d
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x404be3
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x406440
testl %r12d, %r12d
jle 0x404c18
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
movq -0x40(%rbp), %rcx
cmpq %rax, (%rcx)
je 0x404c63
cmpl $0xa0000, %r12d         # imm = 0xA0000
sete %al
cmpb $0x10, 0x8e7(%rcx)
sete %r13b
andb %al, %r13b
addb %r13b, %r13b
jmp 0x404c66
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x17942b(%rip), %rsi    # 0x57e051
movl $0x16, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
jmp 0x404ad3
movb $0x1, %r13b
cmpb $0x24, %r15b
jne 0x404cc4
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x1793f2(%rip), %rsi    # 0x57e06c
movl $0x6, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movzbl -0x30(%rbp), %eax
movzbl -0x50(%rbp), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x404d21
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x179396(%rip), %rsi    # 0x57e068
movl $0xa, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movl -0x2c(%rbp), %eax
movl %eax, %ecx
shrl $0x8, %ecx
cmpb $0x1, %al
sbbb $-0x1, %cl
movl %ecx, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x179344(%rip), %rsi    # 0x57e073
movl $0xa, %edx
callq 0x46ef00
movq $0x5ec460, %rdi         # imm = 0x5EC460
movl -0x2c(%rbp), %esi
callq 0x46f7d0
movq %rax, %rbx
leaq 0x179661(%rip), %rsi    # 0x57e3b3
movl $0x1, %edx
movq %rax, %rdi
callq 0x46ef00
movzbl -0x34(%rbp), %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x46f7d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
cmpb $0x2, %r13b
je 0x404f5f
movzbl %r13b, %eax
cmpl $0x1, %eax
jne 0x404f8e
movq -0x40(%rbp), %rbx
movzbl 0x8(%rbx), %r13d
testb %r13b, %r13b
js 0x404f9c
leal 0x1(%r13), %eax
movb %al, 0x8(%rbx)
movq -0x48(%rbp), %rax
movq (%rax), %rdi
leaq 0x179230(%rip), %rsi    # 0x57e007
callq 0x4d4630
testq %rax, %rax
je 0x4051de
movq %rax, %r15
leaq (,%r13,2), %rax
shll $0x4, %r13d
subq %rax, %r13
addq $0x9, %r13
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x4d4ab0
movl $0xe, %edi
callq 0x407180
movq %rax, -0x48(%rbp)
leaq -0xe8(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x4062fa
movq %r15, -0x50(%rbp)
leaq -0x128(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %rdi
callq 0x4062fa
movq -0xf8(%rbp), %r15
movl $0x8, %edx
movq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4010c8
movq -0x138(%rbp), %rdi
movb (%rdi), %al
movb %al, 0x8(%rbx)
movl -0x30(%rbp), %eax
movb %al, 0x9(%rbx)
movb %ah, 0xa(%rbx)
movl -0x2c(%rbp), %eax
movb %al, 0xb(%rbx)
movb %ah, 0xc(%rbx)
movl -0x34(%rbp), %eax
movb %al, 0xd(%rbx)
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x404ecb
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x406440
movq -0xf8(%rbp), %r15
leaq -0xe8(%rbp), %rax
cmpq %rax, %r15
je 0x404ee9
movq -0xe8(%rbp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x406440
movl $0x1, %esi
movl $0xe, %edx
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %r15
movq %r15, %rcx
callq 0x4d4ab0
movq -0x40(%rbp), %rdi
addq %r13, %rdi
subl %r13d, %r12d
movl $0x1, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x4d4ab0
movl -0x2c(%rbp), %ebx
movslq %ebx, %rdx
movl $0x1, %esi
movq %r14, %rdi
movq %r15, %rcx
callq 0x4d4ab0
andl $0xff, %ebx
je 0x404f52
movl $0x100, %edx            # imm = 0x100
subl %ebx, %edx
movl $0x1, %esi
movq %r14, %rdi
movq %r15, %rcx
callq 0x4d4ab0
movq %r15, %rdi
callq 0x4d3f00
jmp 0x404ad3
movq -0x40(%rbp), %rax
movb 0x8e4(%rax), %r12b
testb %r12b, %r12b
js 0x404f9c
movzwl 0x8e5(%rax), %ebx
movl %ebx, %eax
subl %r15d, %eax
movl %eax, -0x50(%rbp)
jae 0x404fe7
movl $0x10, %edx
leaq 0x17911e(%rip), %rsi    # 0x57e0aa
jmp 0x404fa8
movl $0x14, %edx
leaq 0x17912c(%rip), %rsi    # 0x57e0c6
jmp 0x404fa8
movl $0x17, %edx
leaq 0x1790d6(%rip), %rsi    # 0x57e07e
movq $0x5ec460, %rbx         # imm = 0x5EC460
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
jmp 0x404ad3
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x1790c6(%rip), %rsi    # 0x57e0bb
movl $0xa, %edx
callq 0x46ef00
movq $0x5ec460, %rdi         # imm = 0x5EC460
movl %ebx, %esi
callq 0x46f7d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq -0x40(%rbp), %rdx
movb 0x8e1(%rdx), %al
movb 0x8e2(%rdx), %cl
movzbl %al, %eax
movl %eax, -0x54(%rbp)
movzbl %cl, %r13d
incb %r12b
movb %r12b, 0x8e4(%rdx)
movl -0x50(%rbp), %eax
movb %al, 0x8e5(%rdx)
movb %ah, 0x8e6(%rdx)
leaq -0x10(%rdx), %rbx
cmpb $0x0, 0x10(%rbx)
leaq 0x10(%rbx), %rbx
jne 0x40506e
leaq -0xc8(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x4062fa
leaq -0x108(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x4062fa
movq -0xd8(%rbp), %r12
movl $0x8, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4010c8
movq -0x118(%rbp), %rdi
movb (%rdi), %al
movb %al, 0x8(%rbx)
movl -0x30(%rbp), %eax
movb %al, 0x9(%rbx)
movb %ah, 0xa(%rbx)
movl -0x2c(%rbp), %eax
movb %al, 0xb(%rbx)
movb %ah, 0xc(%rbx)
movl -0x34(%rbp), %eax
movb %al, 0xd(%rbx)
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x40511f
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x406440
movq -0xd8(%rbp), %r12
leaq -0xc8(%rbp), %rax
cmpq %rax, %r12
je 0x40513d
movq -0xc8(%rbp), %rsi
incq %rsi
movq %r12, %rdi
callq 0x406440
movl -0x54(%rbp), %eax
movb %al, 0xe(%rbx)
movb %r13b, 0xf(%rbx)
shll $0x4, %r13d
addl %eax, %r13d
movl %r13d, %eax
shll $0x8, %eax
addl %r15d, %r13d
movl %r13d, %ecx
andb $0xf, %cl
shrl $0x4, %r13d
movq -0x40(%rbp), %rdi
movb %cl, 0x8e1(%rdi)
movb %r13b, 0x8e2(%rdi)
addq %rax, %rdi
movslq -0x2c(%rbp), %rdx
movq %r14, %rsi
callq 0x401110
leaq -0x148(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x4062fa
leaq -0x158(%rbp), %rbx
movq %rbx, %rdi
movq -0x40(%rbp), %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x40466d
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x404ad3
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x406440
jmp 0x404ad3
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x178eaa(%rip), %rsi    # 0x57e096
movl $0x13, %edx
callq 0x46ef00
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46ed10
jmp 0x404ad3
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x405260
movq -0xc8(%rbp), %rsi
jmp 0x405243
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x405260
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x406440
jmp 0x405260
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
jmp 0x40525d
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x405282
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x406440
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x40529b
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x406440
movq %rbx, %rdi
callq 0x4a6e70