// File: /workspace/github_cpp_makefile_star2_O3/stacksmith[P]picoasm/cassembler.cpp
// Function: CAssembler::exportVHDL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
bool CAssembler::exportVHDL( string templateFile, string outputDir, string entityName, bool bVHDL)
{
	int addr, i, j, k, l, n ;
	unsigned char INIT[ 32 ][ 64 ] ;		/* 32 * 64 = 2048 bytes */
	unsigned char INITP[ 32 ][ 8 ] ;		/* 32 * 8 =   256 bytes */
	unsigned int d ;                        /*			 2304 Bytes Total = (18b * 1024 ) / 8 (1 instr = 18 bits )*/
	
	CInstruction *instr ;
	
	// ajg112 - Open Mem file
	string memFileName = outputDir + "/" + entityName + ".mem";
	FILE * memFile = fopen( memFileName.c_str(), "w" ) ;		
	if (memFile == NULL) {
		error(NO_LINE_NR, string( "Unable to open mem file '" + memFileName + "'" ).c_str());
		return FALSE ;
	}

	// ajg112 - Specify start address
	fprintf(memFile, "@0\n");

	for ( i = 0 ; i < 32 ; i++ )
		for( j = 0 ; j < 32 ; j++ )
			INIT[ i ][ j ] = 0 ;
			
	for ( i = 0 ; i < 32 ; i++ )
		for ( j = 0 ; j < 8 ; j++ )
			INITP[ i ][ j ] = 0 ;
	
	for ( addr = i = j = k = l = 0, n = 0 ; addr < 1024 ; addr++ ) {			
		instr = m_code->getInstruction( addr ) ;
		
		if ( instr == NULL ) d = 0 ;
		else d = instr->getHexCode() ;

		//cout << d <<"\n";

		// ajg112 - Output memory value
		fprintf(memFile, "%05X\n", d);
						
		INIT[ i++ ][ j ] =  d ;		// instruction( 15 downto 0 )
		INIT[ i++ ][ j ] =  d >> 8;
		
		INITP[ k ][ l ] |= ( ( d >> 16 ) & 0x3 ) << n ;	// instruction( 17 downto 16 ) ;
		n += 2 ;
				
		if ( n >= 8 ) {
			n = 0 ;
			k++ ;
			if ( k >= 32 ) {
				l++ ;
				k = 0 ;
			}
		}
		
		if ( i >= 32 ) {
			i = 0 ;
			j++ ;
		}
	}

	// ajg112 - Close Mem File
	fclose(memFile);
	
	FILE * infile = fopen( templateFile.c_str(), "r" ) ;
	if ( infile == NULL ) {
		error( NO_LINE_NR, string( "Unable to open template file '" + templateFile + "'" ).c_str() ) ;
		return FALSE ;
	}

	// RDC 02/02/2007 set VHDL or verilog file extension
	string exportExt;
	if (bVHDL){
	  exportExt = ".vhd"; 
	} else {
	  exportExt = ".v"; 
	}

	// RDC 02/02/2007 set VHDL or verilog file extension
	// string exportFile = outputDir + "/" + entityName + ".vhd" ;
	string exportFile = outputDir + "/" + entityName + exportExt;

	FILE * outfile = fopen( exportFile.c_str(), "w" ) ;		
	if ( outfile == NULL ) {
	  // RDC 02/02/2007 set VHDL or verilog file extension
	  // error( NO_LINE_NR , string( "Unable to open output file '" + exportFile + ".vhd'").c_str() ) ;
	  error( NO_LINE_NR , string( "Unable to open output file '" + exportFile + exportExt + "'").c_str() ) ;
	  return FALSE ;
	}
		
	bool store = false, copy = false;
	char varname[ 64 ] ;
	int p = 0 ;
	int line, c ;
	while ( ( c = fgetc( infile ) ) != EOF ) {
		if ( store && p < 64 )
			varname[ p++ ] = c ;
		
		if ( c == '{' ) {
			store = true ;		
			p = 0 ;
		}
		
		if ( !store && copy )
			fputc( c, outfile ) ;
		
		if ( c == '}' ) {
			store = false ;
			if ( p > 0 )
				varname[ p - 1 ] = '\0' ;
			else
				varname[ 0 ] = '\0' ;
			if ( strncmp( "INIT_", varname, 5 ) == 0 ) {
				sscanf( varname, "INIT_%02X", &line ) ;
				if ( line >= 0 && line < 64 ) {
					for( j = 31 ; j >= 0 ; j-- ) 
						fprintf( outfile, "%02X", INIT[ j ][ line ] ) ;
				}
			} else if ( strncmp( "INITP_", varname, 6 ) == 0 ) {
				sscanf( varname, "INITP_%02X", &line ) ;
				if ( line >= 0 && line < 8 ) 
					for( j = 31 ; j >= 0 ; j-- )
		 				fprintf( outfile, "%02X", INITP[ j ][ line ] ) ;
			} else if ( strcmp( "name", varname ) == 0 ) {
				fprintf( outfile, entityName.c_str() ) ;				
			} else if ( strcmp( "begin template", varname ) == 0 ) {
				copy = true ;
			}
		}
	}
		
	fclose( infile ) ;
	fclose( outfile ) ;
	
	return TRUE ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa28, %rsp            # imm = 0xA28
movl %r8d, %r12d
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, -0x128(%rbp)
movq %rdi, -0x130(%rbp)
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x40546e
leaq 0x18041e(%rip), %rsi    # 0x58819c
movq %rbx, %rdi
callq 0x47e1c0
movl %r12d, -0xcc(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq -0x50(%rbp), %rdi
callq 0x47e080
leaq -0x90(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x407dcb
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0x407dd3
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0xa0(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x179950(%rip), %rsi    # 0x581748
callq 0x47e1c0
leaq -0xe0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x407e2a
movq %rdx, -0xf0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe0(%rbp)
jmp 0x407e30
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, -0xe8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x407e65
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x407e7a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0xf0(%rbp), %rdi
leaq 0x17dc81(%rip), %rsi    # 0x585b09
callq 0x4e3500
testq %rax, %rax
je 0x4080df
movq %r13, -0x120(%rbp)
movq %r14, -0xf8(%rbp)
leaq 0x1798bc(%rip), %rdi    # 0x581767
movl $0x3, %esi
movl $0x1, %edx
movq %rax, -0xa8(%rbp)
movq %rax, %rcx
callq 0x4e3830
xorl %eax, %eax
xorps %xmm0, %xmm0
movaps %xmm0, -0xa40(%rbp,%rax)
movaps %xmm0, -0xa50(%rbp,%rax)
addq $0x40, %rax
cmpq $0x800, %rax            # imm = 0x800
jne 0x407ec9
leaq -0x250(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x401090
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq $0x0, -0x58(%rbp)
xorl %r14d, %r14d
movl $0x0, -0x2c(%rbp)
movq -0x130(%rbp), %rax
movq 0x80(%rax), %rdi
movzwl %r15w, %esi
callq 0x40c5bc
testq %rax, %rax
je 0x407f34
movl 0x1c(%rax), %ebx
jmp 0x407f36
xorl %ebx, %ebx
movq -0xa8(%rbp), %rdi
leaq 0x179827(%rip), %rsi    # 0x58176b
movl %ebx, %edx
xorl %eax, %eax
callq 0x4d4680
movslq %r12d, %rax
movl %r13d, %ecx
shlq $0x6, %rax
addq %rbp, %rax
addq $-0xa50, %rax           # imm = 0xF5B0
movb %bl, (%rcx,%rax)
movb %bh, 0x40(%rcx,%rax)
shrl $0x10, %ebx
andl $0x3, %ebx
movl %r14d, %ecx
shll %cl, %ebx
movslq -0x58(%rbp), %rax
movslq -0x2c(%rbp), %rcx
leaq -0x250(,%rax,8), %rax
addq %rbp, %rax
orb %bl, (%rcx,%rax)
cmpl $0x6, %r14d
jge 0x407f94
addl $0x2, %r14d
jmp 0x407fb3
xorl %r14d, %r14d
xorl %eax, %eax
movq -0x58(%rbp), %rcx
cmpl $0x1f, %ecx
leal 0x1(%rcx), %ecx
setge %al
cmovgel %r14d, %ecx
addl %eax, -0x2c(%rbp)
movl %ecx, %eax
movq %rax, -0x58(%rbp)
xorl %eax, %eax
cmpl $0x1e, %r12d
leal 0x2(%r12), %ecx
setge %al
movl $0x0, %edx
cmovgel %edx, %ecx
addl %eax, %r13d
incl %r15d
movl %ecx, %r12d
cmpl $0x400, %r15d           # imm = 0x400
jne 0x407f13
movq -0xa8(%rbp), %rdi
callq 0x4e2c70
movq -0x128(%rbp), %rbx
movq (%rbx), %rdi
leaq 0x17e563(%rip), %rsi    # 0x58655f
callq 0x4e3500
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x40813a
leaq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x17912b(%rip), %rax    # 0x581157
leaq 0x1790bb(%rip), %rcx    # 0x5810ee
movl -0xcc(%rbp), %edx
testb %dl, %dl
cmovneq %rax, %rcx
movzbl %dl, %eax
leaq 0x2(,%rax,2), %r8
xorl %esi, %esi
xorl %edx, %edx
callq 0x47d660
leaq -0x90(%rbp), %r14
leaq -0xb8(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x40546e
movq -0xf8(%rbp), %rbx
leaq 0x18010c(%rip), %rsi    # 0x58819c
leaq -0xc8(%rbp), %rdi
callq 0x47e1c0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x47e080
movq %r14, -0xa0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40819f
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0x4081a6
leaq 0x179667(%rip), %rsi    # 0x58174d
leaq -0x50(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x408f00
leaq 0x1790e2(%rip), %rsi    # 0x5811df
leaq -0x50(%rbp), %rdi
callq 0x47e1c0
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40851c
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rsi
movq %rsi, -0x90(%rbp)
jmp 0x408526
leaq 0x179630(%rip), %rsi    # 0x581771
leaq -0x50(%rbp), %rdi
movq %rbx, %rdx
leaq -0xe0(%rbp), %rbx
callq 0x408f00
leaq -0x40(%rbp), %r14
leaq -0x90(%rbp), %r15
leaq 0x179079(%rip), %rsi    # 0x5811df
leaq -0x50(%rbp), %rdi
callq 0x47e1c0
movq %r15, -0xa0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x408582
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rsi
movq %rsi, -0x90(%rbp)
jmp 0x40858c
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0xa0(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x47e080
leaq -0x108(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4081fe
movq %rdx, -0x118(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x108(%rbp)
jmp 0x408204
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x110(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x408239
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x408254
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x118(%rbp), %rdi
leaq 0x17d8a7(%rip), %rsi    # 0x585b09
callq 0x4e3500
testq %rax, %rax
setne %bl
movl %ebx, -0xa8(%rbp)
je 0x4084ac
movq %rax, %r12
movq -0x58(%rbp), %rdi
callq 0x4e7d60
cmpl $-0x1, %eax
je 0x40848b
movl %eax, %ebx
xorl %r15d, %r15d
movl $0x0, -0x2c(%rbp)
xorl %r14d, %r14d
cmpl $0x40, %r15d
setl %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x4082b8
movslq %r15d, %rax
incl %r15d
movb %bl, -0xa0(%rbp,%rax)
movl %r15d, %r13d
cmpl $0x7b, %ebx
movzbl %r14b, %r14d
movl $0x1, %eax
cmovel %eax, %r14d
movl $0x0, %eax
cmovel %eax, %r15d
testb $0x1, %r14b
jne 0x4082ed
movl -0x2c(%rbp), %eax
xorb $0x1, %al
testb $0x1, %al
jne 0x4082ed
movl %ebx, %edi
movq %r12, %rsi
callq 0x4e7c20
cmpl $0x7d, %ebx
jne 0x408477
testl %r13d, %r13d
jle 0x408309
decl %r13d
movb $0x0, -0xa0(%rbp,%r13)
jmp 0x408310
movb $0x0, -0xa0(%rbp)
movl $0x54494e49, %edx       # imm = 0x54494E49
movl -0xa0(%rbp), %eax
xorl %edx, %eax
movzbl -0x9c(%rbp), %ecx
xorl $0x5f, %ecx
orl %eax, %ecx
leaq 0x17949a(%rip), %r13    # 0x5817ca
je 0x4083a9
movl -0xa0(%rbp), %eax
xorl %edx, %eax
movzwl -0x9c(%rbp), %ecx
xorl $0x5f50, %ecx           # imm = 0x5F50
orl %eax, %ecx
je 0x408407
movl -0xa0(%rbp), %eax
movl $0x656d616e, %ecx       # imm = 0x656D616E
xorl %ecx, %eax
movzbl -0x9c(%rbp), %ecx
orl %eax, %ecx
je 0x408460
movq -0xa0(%rbp), %rax
movabsq $0x6574206e69676562, %rcx # imm = 0x6574206E69676562
xorq %rcx, %rax
movq -0x99(%rbp), %rcx
movabsq $0x6574616c706d65, %rdx # imm = 0x6574616C706D65
xorq %rdx, %rcx
orq %rax, %rcx
sete %al
movl -0x2c(%rbp), %ecx
orb %al, %cl
movl %ecx, -0x2c(%rbp)
xorl %r14d, %r14d
jmp 0x408477
xorl %r14d, %r14d
leaq -0xa0(%rbp), %rdi
leaq 0x1793f9(%rip), %rsi    # 0x5817b3
leaq -0xc8(%rbp), %rdx
xorl %eax, %eax
callq 0x4d49a0
cmpl $0x3f, -0xc8(%rbp)
ja 0x408477
movl $0x800, %ebx            # imm = 0x800
movslq -0xc8(%rbp), %rax
addq %rbp, %rax
addq $-0xa50, %rax           # imm = 0xF5B0
movzbl -0x40(%rbx,%rax), %edx
xorl %r14d, %r14d
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4d4680
addq $-0x40, %rbx
jne 0x4083da
jmp 0x408477
xorl %r14d, %r14d
leaq -0xa0(%rbp), %rdi
leaq 0x1793ac(%rip), %rsi    # 0x5817c4
leaq -0xc8(%rbp), %rdx
xorl %eax, %eax
callq 0x4d49a0
cmpl $0x7, -0xc8(%rbp)
ja 0x408477
movl $0x1f, %ebx
movslq -0xc8(%rbp), %rax
addq %rbp, %rax
addq $-0x250, %rax           # imm = 0xFDB0
movzbl (%rax,%rbx,8), %edx
xorl %r14d, %r14d
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4d4680
addq $-0x1, %rbx
jb 0x408434
jmp 0x408477
movq -0xf8(%rbp), %rax
movq (%rax), %rsi
xorl %r14d, %r14d
movq %r12, %rdi
xorl %eax, %eax
callq 0x4d4680
movq -0x58(%rbp), %rdi
callq 0x4e7d60
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x40829d
movq -0x58(%rbp), %rdi
callq 0x4e2c70
movq %r12, %rdi
callq 0x4e2c70
leaq -0xe0(%rbp), %rbx
leaq -0x40(%rbp), %r14
jmp 0x4086b8
leaq 0x1792dd(%rip), %rsi    # 0x581790
leaq -0x150(%rbp), %rdi
leaq -0x118(%rbp), %rdx
callq 0x408f00
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x150(%rbp), %rdi
leaq -0xe0(%rbp), %rbx
callq 0x47e080
leaq -0x90(%rbp), %r15
movq %r13, -0xc8(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x40(%rbp), %r14
je 0x4085d6
movq %rdx, -0xc8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xb8(%rbp)
jmp 0x4085de
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq %r14, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x98(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x40574a
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x408565
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x40857a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x40d020
xorl %r14d, %r14d
jmp 0x4086f6
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %r15, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x98(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x40574a
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4085cb
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
jne 0x40856e
jmp 0x40857a
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0xc8(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x178bdc(%rip), %rsi    # 0x5811df
callq 0x47e1c0
movq %r15, -0xa0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x408631
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0x408638
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x98(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa0(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x40574a
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x40867e
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x408699
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x40d020
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4086b8
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x4086da
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x40d020
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x4086ef
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x40d020
movl -0xa8(%rbp), %r14d
movq -0xf0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x408711
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x40d020
movl %r14d, %eax
addq $0xa28, %rsp            # imm = 0xA28
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x408749
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x408749
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x408769
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x408769
movq %rax, %rbx
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40878d
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x40878d
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x40882b
movq -0x108(%rbp), %rsi
jmp 0x40881c
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
jne 0x4087d4
jmp 0x40882b
jmp 0x408828
jmp 0x40888a
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x40882b
movq -0x90(%rbp), %rsi
jmp 0x40881c
jmp 0x408828
jmp 0x40888a
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x408809
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x408809
jmp 0x408806
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r13, %rdi
je 0x40882b
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x40882b
jmp 0x408828
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x40888d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x40888d
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x408869
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x40d020
jmp 0x408869
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
jne 0x408884
jmp 0x4088af
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x4088af
movq -0x40(%rbp), %rsi
jmp 0x4088a7
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x4088af
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x40d020
movq %rbx, %rdi
callq 0x4ad8c0
nop