// File: /workspace/github_c_makefile_star2_O0/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
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x250(%rbp)
movq %rsi, -0x258(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x476450
leaq -0x70(%rbp), %rdi
callq 0x476450
movq -0x250(%rbp), %rdi
movw $0x0, -0x72(%rbp)
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x478200
movq -0x250(%rbp), %rdi
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rsi
addq $0x1, %rsi
callq 0x476a90
movsbl (%rax), %eax
cmpl $0x24, %eax
jne 0x404b29
movb $0x1, -0x11(%rbp)
cmpq $-0x1, -0x80(%rbp)
jne 0x404b9f
movq -0x250(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0xa0(%rbp), %rdi
movl $0x8, %ecx
callq 0x478f10
jmp 0x404b4e
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movq %rsi, -0x260(%rbp)
callq 0x4765b0
movq -0x260(%rbp), %rdi
callq 0x476560
leaq 0x18bee8(%rip), %rsi    # 0x590a60
leaq -0x70(%rbp), %rdi
callq 0x4775b0
jmp 0x404b83
jmp 0x404c8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x4057aa
movl -0x80(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl $0x8, -0xd8(%rbp)
leaq -0xd4(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x406bf0
movq %rax, -0x268(%rbp)
jmp 0x404bce
movq -0x250(%rbp), %rsi
movq -0x268(%rbp), %rax
movslq (%rax), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0xd0(%rbp), %rdi
callq 0x478f10
jmp 0x404bf1
leaq -0x50(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x4765b0
leaq -0xd0(%rbp), %rdi
callq 0x476560
movq -0x250(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x270(%rbp)
callq 0x476780
movq %rax, %rcx
movq -0x270(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jb 0x404c4b
leaq 0x17a775(%rip), %rsi    # 0x57f3b3
leaq -0x70(%rbp), %rdi
callq 0x4775b0
jmp 0x404c49
jmp 0x404c88
movq -0x250(%rbp), %rsi
movq -0x80(%rbp), %rdx
incq %rdx
leaq -0xf8(%rbp), %rdi
movl $0x1, %ecx
callq 0x478f10
jmp 0x404c6c
leaq -0x70(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x4765b0
leaq -0xf8(%rbp), %rdi
callq 0x476560
jmp 0x404c8a
leaq -0x50(%rbp), %rdi
movl $0x8, %esi
movl $0x20, %edx
callq 0x477160
jmp 0x404c9f
testb $0x1, -0x11(%rbp)
je 0x404d3f
movl $0xff11, %edi           # imm = 0xFF11
callq 0x407e80
movq %rax, -0x278(%rbp)
jmp 0x404cbc
movq -0x250(%rbp), %rsi
movq -0x278(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x478cf0
jmp 0x404cdf
movq -0x100(%rbp), %rsi
leaq -0x128(%rbp), %rdi
movl $0xff11, %edx           # imm = 0xFF11
callq 0x404740
movl %eax, -0x27c(%rbp)
jmp 0x404cff
movl -0x27c(%rbp), %eax
movl %eax, -0x104(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x476560
jmp 0x404dd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
movl $0xff00, %edi           # imm = 0xFF00
callq 0x407e80
movq %rax, -0x288(%rbp)
jmp 0x404d52
movq -0x250(%rbp), %rsi
movq -0x288(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x478cf0
jmp 0x404d75
movq -0x100(%rbp), %rsi
leaq -0x148(%rbp), %rdi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x404740
movl %eax, -0x28c(%rbp)
jmp 0x404d95
movl -0x28c(%rbp), %eax
movl %eax, -0x104(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x476560
jmp 0x404dd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
cmpl $-0x1, -0x104(%rbp)
jne 0x404e1b
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17a241(%rip), %rsi    # 0x57f02a
callq 0x470190
movq %rax, -0x298(%rbp)
jmp 0x404df7
movq -0x298(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x404e0c
movl $0x1, -0x14c(%rbp)
jmp 0x40578f
cmpl $0x0, -0x104(%rbp)
jne 0x404e64
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17a208(%rip), %rsi    # 0x57f03a
callq 0x470190
movq %rax, -0x2a0(%rbp)
jmp 0x404e40
movq -0x2a0(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x404e55
movl $0x1, -0x14c(%rbp)
jmp 0x40578f
testb $0x1, -0x11(%rbp)
je 0x404ecd
movq -0x100(%rbp), %rax
movb 0x10(%rax), %cl
movb %cl, -0x20(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x30(%rbp)
movq -0x100(%rbp), %rdi
movq %rdi, %rsi
addq $0x11, %rsi
movl -0x104(%rbp), %eax
addl $-0x11, %eax
movslq %eax, %rdx
callq 0x401068
movl -0x104(%rbp), %eax
addl $-0x11, %eax
movl %eax, -0x104(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x477fa0
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movsbl -0x28(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0x4770f0
jmp 0x404ecb
jmp 0x404ecd
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x407e80
movq %rax, -0x2a8(%rbp)
jmp 0x404ee0
movq -0x258(%rbp), %rsi
movq -0x2a8(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x478cf0
jmp 0x404f03
movq -0x158(%rbp), %rsi
leaq -0x180(%rbp), %rdi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x404740
movl %eax, -0x2ac(%rbp)
jmp 0x404f23
leaq -0x180(%rbp), %rdi
callq 0x476560
movl -0x2ac(%rbp), %eax
movl %eax, -0x15c(%rbp)
cmpl $0x1, -0x15c(%rbp)
jge 0x404fa7
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17a0ff(%rip), %rsi    # 0x57f051
callq 0x470190
movq %rax, -0x2b8(%rbp)
jmp 0x404f60
movq -0x2b8(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x404f75
movl $0x1, -0x14c(%rbp)
jmp 0x40578f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
movq -0x158(%rbp), %rdi
movl -0x15c(%rbp), %esi
callq 0x404860
movzbl %al, %eax
movl %eax, -0x184(%rbp)
testb $0x1, -0x11(%rbp)
je 0x405015
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17a096(%rip), %rsi    # 0x57f06c
callq 0x470190
movq %rax, -0x2c0(%rbp)
jmp 0x404fe4
movq -0x2c0(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x404ff9
movb -0x23(%rbp), %al
movb %al, -0x185(%rbp)
movzbl -0x27(%rbp), %eax
movzbl -0x26(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movw %ax, -0x72(%rbp)
jmp 0x40507a
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x17a045(%rip), %rsi    # 0x57f068
callq 0x470190
movq %rax, -0x2c8(%rbp)
jmp 0x405031
movq -0x2c8(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405046
movl -0x104(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
movb %al, -0x185(%rbp)
movl -0x104(%rbp), %eax
andl $0xff, %eax
cmpl $0x0, %eax
je 0x405078
movb -0x185(%rbp), %al
addb $0x1, %al
movb %al, -0x185(%rbp)
jmp 0x40507a
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179feb(%rip), %rsi    # 0x57f073
callq 0x470190
movq %rax, -0x2d0(%rbp)
jmp 0x405096
movq -0x2d0(%rbp), %rdi
movl -0x104(%rbp), %esi
callq 0x470530
movq %rax, -0x2d8(%rbp)
jmp 0x4050b1
movq -0x2d8(%rbp), %rdi
leaq 0x17a2f4(%rip), %rsi    # 0x57f3b3
callq 0x470190
movq %rax, -0x2e0(%rbp)
jmp 0x4050cd
movq -0x2e0(%rbp), %rdi
movzbl -0x185(%rbp), %esi
callq 0x470530
movq %rax, -0x2e8(%rbp)
jmp 0x4050e9
movq -0x2e8(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x4050fe
movq -0x158(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movl -0x184(%rbp), %eax
movl %eax, -0x2ec(%rbp)
subl $0x1, %eax
je 0x405133
jmp 0x40511f
movl -0x2ec(%rbp), %eax
subl $0x2, %eax
je 0x4053c8
jmp 0x405752
movq -0x158(%rbp), %rax
movb 0x8(%rax), %al
movb %al, -0x188(%rbp)
movzbl -0x188(%rbp), %eax
cmpl $0x7f, %eax
jle 0x405185
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179f21(%rip), %rsi    # 0x57f07e
callq 0x470190
movq %rax, -0x2f8(%rbp)
jmp 0x40516b
movq -0x2f8(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405180
jmp 0x405785
movq -0x258(%rbp), %rdi
movq -0x158(%rbp), %rax
movb 0x8(%rax), %cl
incb %cl
movb %cl, 0x8(%rax)
callq 0x477fa0
movq %rax, %rdi
leaq 0x179e5d(%rip), %rsi    # 0x57f007
callq 0x4d5d60
movq %rax, -0x300(%rbp)
jmp 0x4051b8
movq -0x300(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, -0x1a8(%rbp)
jne 0x405206
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179eb8(%rip), %rsi    # 0x57f096
callq 0x470190
movq %rax, -0x308(%rbp)
jmp 0x4051ec
movq -0x308(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405201
jmp 0x405785
movzbl -0x188(%rbp), %eax
movl %eax, %ecx
addl %ecx, %ecx
shll $0x4, %eax
subl %ecx, %eax
addl $0x9, %eax
movl %eax, -0x18c(%rbp)
movq -0x158(%rbp), %rdi
movl -0x18c(%rbp), %eax
movl %eax, %edx
movq -0x1a8(%rbp), %rcx
movl $0x1, %esi
callq 0x4d61e0
jmp 0x405241
movl $0xe, %edi
callq 0x407e80
movq %rax, -0x310(%rbp)
jmp 0x405254
movq -0x310(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
movq %rax, -0x318(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x478cf0
jmp 0x405282
leaq -0x1e8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x478cf0
jmp 0x405294
movq -0x318(%rbp), %rdi
movl -0x104(%rbp), %ecx
movzbl -0x185(%rbp), %r8d
movzwl -0x72(%rbp), %r9d
leaq -0x1c8(%rbp), %rsi
movq %rsi, -0x320(%rbp)
leaq -0x1e8(%rbp), %rdx
movq %rdx, -0x328(%rbp)
callq 0x4049d0
movq -0x328(%rbp), %rdi
callq 0x476560
movq -0x320(%rbp), %rdi
callq 0x476560
movq -0x1a0(%rbp), %rdi
movq -0x1a8(%rbp), %rcx
movl $0x1, %esi
movl $0xe, %edx
callq 0x4d61e0
jmp 0x405306
movq -0x158(%rbp), %rdi
movl -0x18c(%rbp), %eax
movl %eax, %ecx
addq %rax, %rdi
movl -0x15c(%rbp), %eax
subl %ecx, %eax
movl %eax, %edx
movq -0x1a8(%rbp), %rcx
movl $0x1, %esi
callq 0x4d61e0
jmp 0x405335
movq -0x100(%rbp), %rdi
movslq -0x104(%rbp), %rdx
movq -0x1a8(%rbp), %rcx
movl $0x1, %esi
callq 0x4d61e0
jmp 0x405356
movl -0x104(%rbp), %eax
andl $0xff, %eax
cmpl $0x0, %eax
je 0x4053b5
movq -0x100(%rbp), %rdi
movzbl -0x104(%rbp), %ecx
movl $0x100, %eax            # imm = 0x100
subl %ecx, %eax
movl %eax, %edx
movq -0x1a8(%rbp), %rcx
movl $0x1, %esi
callq 0x4d61e0
jmp 0x405390
jmp 0x4053b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
movq -0x1a8(%rbp), %rdi
callq 0x4d5630
jmp 0x4053c3
jmp 0x405785
movq -0x158(%rbp), %rax
movb 0x8e4(%rax), %al
movb %al, -0x188(%rbp)
movzbl -0x188(%rbp), %eax
cmpl $0x7f, %eax
jle 0x40541d
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179c89(%rip), %rsi    # 0x57f07e
callq 0x470190
movq %rax, -0x330(%rbp)
jmp 0x405403
movq -0x330(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405418
jmp 0x405785
movq -0x158(%rbp), %rax
movzbl 0x8e5(%rax), %eax
movq -0x158(%rbp), %rcx
movzbl 0x8e6(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movl %eax, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
movzbl -0x185(%rbp), %ecx
cmpl %ecx, %eax
jae 0x40548b
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179c47(%rip), %rsi    # 0x57f0aa
callq 0x470190
movq %rax, -0x338(%rbp)
jmp 0x405471
movq -0x338(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405486
jmp 0x405785
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179c22(%rip), %rsi    # 0x57f0bb
callq 0x470190
movq %rax, -0x340(%rbp)
jmp 0x4054a7
movq -0x340(%rbp), %rdi
movl -0x18c(%rbp), %esi
callq 0x470530
movq %rax, -0x348(%rbp)
jmp 0x4054c2
movq -0x348(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x4054d7
movq -0x158(%rbp), %rax
movb 0x8e1(%rax), %al
movb %al, -0x186(%rbp)
movq -0x158(%rbp), %rax
movb 0x8e2(%rax), %al
movb %al, -0x187(%rbp)
movb -0x188(%rbp), %al
addb $0x1, %al
movb %al, -0x188(%rbp)
movb -0x188(%rbp), %cl
movq -0x158(%rbp), %rax
movb %cl, 0x8e4(%rax)
movzbl -0x185(%rbp), %ecx
movl -0x18c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, 0x8e5(%rax)
movl -0x18c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x8, %eax
movb %al, %cl
movq -0x158(%rbp), %rax
movb %cl, 0x8e6(%rax)
movq -0x1a0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x40558d
movq -0x1a0(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x1a0(%rbp)
jmp 0x40556a
movq -0x1a0(%rbp), %rax
movq %rax, -0x350(%rbp)
leaq -0x208(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x478cf0
jmp 0x4055ad
leaq -0x228(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x478cf0
jmp 0x4055bf
movq -0x350(%rbp), %rdi
movl -0x104(%rbp), %ecx
movzbl -0x185(%rbp), %r8d
movzwl -0x72(%rbp), %r9d
leaq -0x208(%rbp), %rsi
movq %rsi, -0x358(%rbp)
leaq -0x228(%rbp), %rdx
movq %rdx, -0x360(%rbp)
callq 0x4049d0
movq -0x360(%rbp), %rdi
callq 0x476560
movq -0x358(%rbp), %rdi
callq 0x476560
movb -0x186(%rbp), %cl
movq -0x1a0(%rbp), %rax
movb %cl, 0xe(%rax)
movb -0x187(%rbp), %cl
movq -0x1a0(%rbp), %rax
movb %cl, 0xf(%rax)
movzbl -0x187(%rbp), %eax
shll $0x4, %eax
movzbl -0x186(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x194(%rbp)
movl -0x194(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x190(%rbp)
movzbl -0x185(%rbp), %ecx
movl -0x194(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x194(%rbp)
movb -0x194(%rbp), %al
andb $0xf, %al
movb %al, -0x186(%rbp)
movl -0x194(%rbp), %eax
shrl $0x4, %eax
movb %al, -0x187(%rbp)
movb -0x186(%rbp), %cl
movq -0x158(%rbp), %rax
movb %cl, 0x8e1(%rax)
movb -0x187(%rbp), %cl
movq -0x158(%rbp), %rax
movb %cl, 0x8e2(%rax)
movq -0x158(%rbp), %rdi
movl -0x190(%rbp), %eax
addq %rax, %rdi
movq -0x100(%rbp), %rsi
movslq -0x104(%rbp), %rdx
callq 0x401110
movq -0x258(%rbp), %rsi
leaq -0x248(%rbp), %rdi
callq 0x478cf0
jmp 0x4056ea
movq -0x158(%rbp), %rsi
leaq -0x248(%rbp), %rdi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x4047f0
jmp 0x405704
leaq -0x248(%rbp), %rdi
callq 0x476560
jmp 0x405785
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x476560
jmp 0x4057aa
movq $0x5ed460, %rdi         # imm = 0x5ED460
leaq 0x179966(%rip), %rsi    # 0x57f0c6
callq 0x470190
movq %rax, -0x368(%rbp)
jmp 0x40576e
movq -0x368(%rbp), %rdi
movq $0x46fa70, %rsi         # imm = 0x46FA70
callq 0x46ec80
jmp 0x405783
jmp 0x405785
movl $0x0, -0x14c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x476560
leaq -0x50(%rbp), %rdi
callq 0x476560
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x476560
leaq -0x50(%rbp), %rdi
callq 0x476560
movq -0xa8(%rbp), %rdi
callq 0x4a85a0
nopl (%rax,%rax)