// File: stacksmith[P]picoasm/cassembler.cpp
// Function: CAssembler::buildSymbolTable()
bool CAssembler::buildSymbolTable()
{
	list<CSourceLine*>::iterator it ;
	unsigned int address = 0 ;
	
	for ( it = m_source.begin() ; it != m_source.end() ; it++ ) {
		string name = toUpper( (*it)->getColumn( 0 ) ) ; 				// case insensitive
		
		if ( name == "NAMEREG" ) {
			if ( !(*it)->isColumn( 3 ) ) {
				error( (*it)->m_lineNr , "'NAMEREG register_name, new_name' expected" ) ;
				return FALSE ;
			}
			
			if ( (*it)->getColumn( 2 ) != "," ) {
				error( (*it)->m_lineNr , "Comma expected" ) ;
				return FALSE ;
			}
			
			// Check that the NAMEREG is unique

			list<CNamereg*>::iterator it1 ;
			for ( it1 = m_registerTable.begin(); it1 != m_registerTable.end() ; it1++) {
			  if( (*it1)->reg == (*it)->getColumn(1)) {
			    error ( (*it)->m_lineNr , string("NAMEREG  reg ("+ (*it)->getColumn(1)+") already aliased.").c_str());
			    return FALSE;
			  }
			  if( (*it1)->name == (*it)->getColumn(3)) {
			    error ( (*it)->m_lineNr , string ("NAMEREG alias ("+(*it)->getColumn(3)+") already used.").c_str());
			    return FALSE;
			  }
			}

			CNamereg *nr = new CNamereg ;
			nr->reg = (*it)->getColumn( 1 ) ;
			nr->name = (*it)->getColumn( 3 ) ;
			m_registerTable.push_back( nr ) ;
			(*it)->m_type = CSourceLine::stNamereg ;
			
		} else if ( name == "CONSTANT" ) {
			if ( !(*it)->isColumn( 3 ) ) {
				error( (*it)->m_lineNr , "'CONSTANT name, valued' expected" ) ;
				return FALSE ;
			}
			

		 	if ( (*it)->getColumn( 2 ) != "," ) {
				error( (*it)->m_lineNr , "Comma expected" ) ;
				return FALSE ;
			}
						
			// GES: Could enforce the 's' constant rule here.
			//  Cannot have a constant which is a register name.

			string ckname = (*it)->getColumn(1);
			if( (ckname[0] == 's' || ckname[0] == 'S') && ckname.length() == 2) {
			  if( (ckname[1] >= '0' && ckname[1] <= '9') || (ckname[1] >= 'a' && ckname[1] <= 'f')
			      || (ckname[1] >= 'A' && ckname[1] <= 'F')) {
			    error( (*it)->m_lineNr, "ILLEGAL CONSTANT: constant cannot be a register name s[0-f]");
			    return FALSE;
			  }
			}

			// Check that this constant isn't already defined
			list<CConstant*>::iterator ita;
			for ( ita = m_constantTable.begin(); ita != m_constantTable.end(); ita++) {
			  if( (*ita)->name == (*it)->getColumn( 1 )) {
			    error( (*it)->m_lineNr , string("CONSTANT ("+(*it)->getColumn(1)+") already defined.").c_str());
			    return FALSE ;
			  }
			}
			  
			CConstant *nr = new CConstant ;
			nr->value = (*it)->getColumn( 3 ) ;
			nr->name = (*it)->getColumn( 1 ) ; ;
			m_constantTable.push_back( nr ) ;
			(*it)->m_type = CSourceLine::stConstant ;
		} else if ( name == "ADDRESS" ) {
			if ( !(*it)->isColumn( 1 ) ) {
				error( (*it)->m_lineNr , "Value expected" ) ;
				return FALSE ;
			} 
			
			if ( sscanf( (*it)->getColumn( 1 ).c_str(), "%X", &address ) != 1 ) {
				error( (*it)->m_lineNr , "Invalid address" ) ;
				return FALSE ;
			}
			(*it)->m_type = CSourceLine::stAddress ;
			(*it)->m_address = address ;
			
		} else if ( getInstruction( (*it)->getColumn( 0 ) ) < 0 ) {

		  // Check for unique label..
		  list<CLabel*>::iterator it2 ;
		  for ( it2 = m_labelTable.begin() ; it2 != m_labelTable.end() ; it2++ ) {
		    if( (*it2)->name == (*it)->getColumn(0)) {
		      error( (*it)->m_lineNr , string ("Duplicate Lable ("+ (*it)->getColumn(0) +":).").c_str());
			return FALSE;
		    }
		  }
			CLabel *label = new CLabel ;
			label->name = (*it)->getColumn( 0 ) ;
			char buf[ 32 ] ;
			sprintf( buf, "%d", address ) ;
			label->value = buf ;
			m_labelTable.push_back( label ) ;
			
			(*it)->m_type = CSourceLine::stLabel ;
			(*it)->m_address = address ;
			if ( (*it)->isColumn( 1 ) && (*it)->getColumn( 1 ) == ":" ) {
				if ( (*it)->isColumn( 2 ) ) {
					if ( getInstruction( (*it)->getColumn( 2 ) ) < 0 ) {
						error( (*it)->m_lineNr , "Instruction expected" ) ;
						return FALSE ;
					} else {
						address = address + 1 ;
					}
				}
			} else {
				error( (*it)->m_lineNr , "Label or Instruction expected" ) ;
				return FALSE ;
			}
		} else {
			(*it)->m_address = address ;
			address = address + 1 ;
		}
	}	

#ifdef PRINT_DEBUG_TABLE
	// RDC 02/02/2007 - don't print symbol table data
 	cout << "Constants :" << endl ;
 	list<CConstant*>::iterator it0 ;
 	for ( it0 = m_constantTable.begin() ; it0 != m_constantTable.end() ; it0++ ) {
 		cout << (*it0)->name << " = " << (*it0)->value << endl ;
 	}
	
 	cout << "Namereg :" << endl ;
 	list<CNamereg*>::iterator it1 ;
 	for ( it1 = m_registerTable.begin() ; it1 != m_registerTable.end() ; it1++ ) {
 		cout << (*it1)->reg << " = " << (*it1)->name << endl ;
 	}
	
 	cout << "labels :" << endl ;
 	list<CLabel*>::iterator it2 ;
 	for ( it2 = m_labelTable.begin() ; it2 != m_labelTable.end() ; it2++ ) {
 		cout << (*it2)->name << " = " << (*it2)->value << endl ;
 	}
#endif
	return TRUE ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5f0, %rsp            # imm = 0x5F0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x4b8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a3f0
movq -0x4b8(%rbp), %rdi
movl $0x0, -0x1c(%rbp)
callq 0x40a410
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x4b8(%rbp), %rdi
callq 0x40a470
movq %rax, -0x30(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x40a440
testb $0x1, %al
jne 0x4060c8
jmp 0x407466
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
xorl %edx, %edx
callq 0x40a4c0
movq -0x4c0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x405c20
jmp 0x4060f8
leaq -0x70(%rbp), %rdi
callq 0x485ad0
leaq 0x185575(%rip), %rsi    # 0x58b67d
leaq -0x50(%rbp), %rdi
callq 0x40a3c0
movb %al, -0x4c1(%rbp)
jmp 0x406119
movb -0x4c1(%rbp), %al
testb $0x1, %al
jne 0x406128
jmp 0x4066f2
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rdi
movl $0x3, %esi
callq 0x40a570
movb %al, -0x4c2(%rbp)
jmp 0x406146
movb -0x4c2(%rbp), %al
testb $0x1, %al
jne 0x4061b0
jmp 0x406152
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x185517(%rip), %rdx    # 0x58b685
callq 0x405dc0
jmp 0x406175
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x485ad0
jmp 0x407478
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x40745b
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
movl $0x2, %edx
callq 0x40a4c0
jmp 0x4061cf
leaq 0x1854da(%rip), %rsi    # 0x58b6b0
leaq -0xa0(%rbp), %rdi
callq 0x40a5a0
movb %al, -0x4c3(%rbp)
jmp 0x4061ea
leaq -0xa0(%rbp), %rdi
callq 0x485ad0
movb -0x4c3(%rbp), %al
testb $0x1, %al
jne 0x406202
jmp 0x406252
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x185494(%rip), %rdx    # 0x58b6b2
callq 0x405dc0
jmp 0x406225
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
leaq -0xa8(%rbp), %rdi
callq 0x40a5d0
movq -0x4b8(%rbp), %rdi
addq $0x18, %rdi
callq 0x40a5f0
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x4b8(%rbp), %rdi
addq $0x18, %rdi
callq 0x40a650
movq %rax, -0xb8(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x40a620
testb $0x1, %al
jne 0x4062b6
jmp 0x4065e2
leaq -0xa8(%rbp), %rdi
callq 0x40a710
movq (%rax), %rax
movq %rax, -0x4d0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0xd8(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x4062eb
movq -0x4d0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x40a680
movb %al, -0x4d1(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x485ad0
movb -0x4d1(%rbp), %al
testb $0x1, %al
jne 0x40631f
jmp 0x40643c
leaq -0x18(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x40a4a0
movq -0x4e0(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x4d8(%rbp)
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x138(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x40635c
leaq 0x18535e(%rip), %rsi    # 0x58b6c1
leaq -0x118(%rbp), %rdi
leaq -0x138(%rbp), %rdx
callq 0x40a780
jmp 0x406378
leaq 0x185351(%rip), %rdx    # 0x58b6d0
leaq -0xf8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x40a730
jmp 0x406394
leaq -0xf8(%rbp), %rdi
callq 0x487510
movq -0x4b8(%rbp), %rdi
movl -0x4d8(%rbp), %esi
movq %rax, %rdx
callq 0x405dc0
jmp 0x4063b7
leaq -0xf8(%rbp), %rdi
callq 0x485ad0
leaq -0x118(%rbp), %rdi
callq 0x485ad0
leaq -0x138(%rbp), %rdi
callq 0x485ad0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x40642b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x40641f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x485ad0
leaq -0x118(%rbp), %rdi
callq 0x485ad0
leaq -0x138(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
leaq -0xa8(%rbp), %rdi
callq 0x40a710
movq (%rax), %rax
addq $0x20, %rax
movq %rax, -0x4e8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x158(%rbp), %rdi
movl $0x3, %edx
callq 0x40a4c0
jmp 0x406475
movq -0x4e8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x40a680
movb %al, -0x4e9(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x485ad0
movb -0x4e9(%rbp), %al
testb $0x1, %al
jne 0x4064a9
jmp 0x4065c6
leaq -0x18(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x40a4a0
movq -0x4f8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x4f0(%rbp)
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x1b8(%rbp), %rdi
movl $0x3, %edx
callq 0x40a4c0
jmp 0x4064e6
leaq 0x1851f6(%rip), %rsi    # 0x58b6e3
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rdx
callq 0x40a780
jmp 0x406502
leaq 0x1851ea(%rip), %rdx    # 0x58b6f3
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x40a730
jmp 0x40651e
leaq -0x178(%rbp), %rdi
callq 0x487510
movq -0x4b8(%rbp), %rdi
movl -0x4f0(%rbp), %esi
movq %rax, %rdx
callq 0x405dc0
jmp 0x406541
leaq -0x178(%rbp), %rdi
callq 0x485ad0
leaq -0x198(%rbp), %rdi
callq 0x485ad0
leaq -0x1b8(%rbp), %rdi
callq 0x485ad0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4065b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4065a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x485ad0
leaq -0x198(%rbp), %rdi
callq 0x485ad0
leaq -0x1b8(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
jmp 0x4065c8
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0x40a7d0
movq %rax, -0x1c0(%rbp)
jmp 0x406283
movl $0x40, %edi
callq 0x416f20
movq %rax, -0x500(%rbp)
jmp 0x4065f5
movq -0x500(%rbp), %rdi
callq 0x40a800
jmp 0x406603
movq -0x500(%rbp), %rax
movq %rax, -0x1c8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x1e8(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406630
movq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
movq %rsi, -0x508(%rbp)
callq 0x485b20
movq -0x508(%rbp), %rdi
callq 0x485ad0
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x208(%rbp), %rdi
movl $0x3, %edx
callq 0x40a4c0
jmp 0x406675
movq -0x1c8(%rbp), %rdi
addq $0x20, %rdi
leaq -0x208(%rbp), %rsi
movq %rsi, -0x510(%rbp)
callq 0x485b20
movq -0x510(%rbp), %rdi
callq 0x485ad0
movq -0x4b8(%rbp), %rdi
addq $0x18, %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x40a830
jmp 0x4066b8
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rax
movl $0x2, 0x24(%rax)
jmp 0x407427
movq -0x500(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x40, %esi
callq 0x416080
jmp 0x40745b
leaq 0x18500a(%rip), %rsi    # 0x58b703
leaq -0x50(%rbp), %rdi
callq 0x40a3c0
movb %al, -0x511(%rbp)
jmp 0x40670a
movb -0x511(%rbp), %al
testb $0x1, %al
jne 0x406719
jmp 0x406d27
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rdi
movl $0x3, %esi
callq 0x40a570
movb %al, -0x512(%rbp)
jmp 0x406737
movb -0x512(%rbp), %al
testb $0x1, %al
jne 0x406776
jmp 0x406743
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x184fad(%rip), %rdx    # 0x58b70c
callq 0x405dc0
jmp 0x406766
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x228(%rbp), %rdi
movl $0x2, %edx
callq 0x40a4c0
jmp 0x406795
leaq 0x184f14(%rip), %rsi    # 0x58b6b0
leaq -0x228(%rbp), %rdi
callq 0x40a5a0
movb %al, -0x513(%rbp)
jmp 0x4067b0
leaq -0x228(%rbp), %rdi
callq 0x485ad0
movb -0x513(%rbp), %al
testb $0x1, %al
jne 0x4067c8
jmp 0x406818
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x184ece(%rip), %rdx    # 0x58b6b2
callq 0x405dc0
jmp 0x4067eb
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x248(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406837
xorl %eax, %eax
movl %eax, %esi
leaq -0x248(%rbp), %rdi
callq 0x486010
movq %rax, -0x520(%rbp)
jmp 0x406850
movq -0x520(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x73, %eax
je 0x40688b
xorl %eax, %eax
movl %eax, %esi
leaq -0x248(%rbp), %rdi
callq 0x486010
movq %rax, -0x528(%rbp)
jmp 0x406878
movq -0x528(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x53, %eax
jne 0x4069e1
leaq -0x248(%rbp), %rdi
callq 0x485d00
cmpq $0x2, %rax
jne 0x4069e1
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x530(%rbp)
jmp 0x4068bb
movq -0x530(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x4068f7
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x538(%rbp)
jmp 0x4068e4
movq -0x538(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x40699b
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x540(%rbp)
jmp 0x406911
movq -0x540(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jl 0x406949
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x548(%rbp)
jmp 0x40693a
movq -0x548(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
jle 0x40699b
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x550(%rbp)
jmp 0x406963
movq -0x550(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x4069df
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x486010
movq %rax, -0x558(%rbp)
jmp 0x40698c
movq -0x558(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x46, %eax
jg 0x4069df
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x184d76(%rip), %rdx    # 0x58b72d
callq 0x405dc0
jmp 0x4069be
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x406cdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x406d16
jmp 0x4069e1
leaq -0x250(%rbp), %rdi
callq 0x40a870
movq -0x4b8(%rbp), %rdi
addq $0x30, %rdi
callq 0x40a890
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x4b8(%rbp), %rdi
addq $0x30, %rdi
callq 0x40a8f0
movq %rax, -0x260(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x40a8c0
testb $0x1, %al
jne 0x406a45
jmp 0x406beb
leaq -0x250(%rbp), %rdi
callq 0x40a920
movq (%rax), %rax
addq $0x20, %rax
movq %rax, -0x560(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x280(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406a7e
movq -0x560(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x40a680
movb %al, -0x561(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x485ad0
movb -0x561(%rbp), %al
testb $0x1, %al
jne 0x406ab2
jmp 0x406bcf
leaq -0x18(%rbp), %rdi
movq %rdi, -0x570(%rbp)
callq 0x40a4a0
movq -0x570(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x568(%rbp)
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x2e0(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406aef
leaq 0x184c73(%rip), %rsi    # 0x58b769
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rdx
callq 0x40a780
jmp 0x406b0b
leaq 0x184c62(%rip), %rdx    # 0x58b774
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x40a730
jmp 0x406b27
leaq -0x2a0(%rbp), %rdi
callq 0x487510
movq -0x4b8(%rbp), %rdi
movl -0x568(%rbp), %esi
movq %rax, %rdx
callq 0x405dc0
jmp 0x406b4a
leaq -0x2a0(%rbp), %rdi
callq 0x485ad0
leaq -0x2c0(%rbp), %rdi
callq 0x485ad0
leaq -0x2e0(%rbp), %rdi
callq 0x485ad0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x406cdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x406bbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x406bb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x485ad0
leaq -0x2c0(%rbp), %rdi
callq 0x485ad0
leaq -0x2e0(%rbp), %rdi
callq 0x485ad0
jmp 0x406d16
jmp 0x406bd1
leaq -0x250(%rbp), %rdi
xorl %esi, %esi
callq 0x40a940
movq %rax, -0x2e8(%rbp)
jmp 0x406a12
movl $0x40, %edi
callq 0x416f20
movq %rax, -0x578(%rbp)
jmp 0x406bfe
movq -0x578(%rbp), %rdi
callq 0x40a970
jmp 0x406c0c
movq -0x578(%rbp), %rax
movq %rax, -0x2f0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x310(%rbp), %rdi
movl $0x3, %edx
callq 0x40a4c0
jmp 0x406c39
movq -0x2f0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
movq %rsi, -0x580(%rbp)
callq 0x485b20
movq -0x580(%rbp), %rdi
callq 0x485ad0
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x330(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406c7e
movq -0x2f0(%rbp), %rdi
addq $0x20, %rdi
leaq -0x330(%rbp), %rsi
movq %rsi, -0x588(%rbp)
callq 0x485b20
movq -0x588(%rbp), %rdi
callq 0x485ad0
movq -0x4b8(%rbp), %rdi
addq $0x30, %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x40a9a0
jmp 0x406cc1
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rax
movl $0x3, 0x24(%rax)
movl $0x0, -0x80(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x485ad0
movl -0x80(%rbp), %eax
testl %eax, %eax
jne 0x40742e
jmp 0x406cf4
jmp 0x407425
movq -0x578(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x40, %esi
callq 0x416080
leaq -0x248(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
leaq 0x189498(%rip), %rsi    # 0x5901c6
leaq -0x50(%rbp), %rdi
callq 0x40a3c0
movb %al, -0x589(%rbp)
jmp 0x406d3f
movb -0x589(%rbp), %al
testb $0x1, %al
jne 0x406d4e
jmp 0x406e71
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rdi
movl $0x1, %esi
callq 0x40a570
movb %al, -0x58a(%rbp)
jmp 0x406d6c
movb -0x58a(%rbp), %al
testb $0x1, %al
jne 0x406dab
jmp 0x406d78
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x1849f3(%rip), %rdx    # 0x58b787
callq 0x405dc0
jmp 0x406d9b
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x350(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x406dca
leaq -0x350(%rbp), %rdi
callq 0x487510
movq %rax, %rdi
leaq 0x18489a(%rip), %rsi    # 0x58b67a
leaq -0x1c(%rbp), %rdx
movb $0x0, %al
callq 0x4de5c0
movl %eax, -0x590(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x485ad0
movl -0x590(%rbp), %eax
cmpl $0x1, %eax
je 0x406e3b
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x185031(%rip), %rdx    # 0x58be55
callq 0x405dc0
jmp 0x406e2b
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rax
movl $0x4, 0x24(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x594(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movl -0x594(%rbp), %ecx
movq (%rax), %rax
movl %ecx, 0x20(%rax)
jmp 0x407423
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x370(%rbp), %rdi
xorl %edx, %edx
callq 0x40a4c0
jmp 0x406e8d
movq -0x4b8(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x405f70
movl %eax, -0x598(%rbp)
jmp 0x406ea8
leaq -0x370(%rbp), %rdi
callq 0x485ad0
movl -0x598(%rbp), %eax
cmpl $0x0, %eax
jge 0x4073fa
leaq -0x378(%rbp), %rdi
callq 0x40a9e0
movq -0x4b8(%rbp), %rdi
addq $0x48, %rdi
callq 0x40aa00
movq %rax, -0x380(%rbp)
movq -0x380(%rbp), %rax
movq %rax, -0x378(%rbp)
movq -0x4b8(%rbp), %rdi
addq $0x48, %rdi
callq 0x40aa60
movq %rax, -0x388(%rbp)
leaq -0x378(%rbp), %rdi
leaq -0x388(%rbp), %rsi
callq 0x40aa30
testb $0x1, %al
jne 0x406f27
jmp 0x4070e4
leaq -0x378(%rbp), %rdi
callq 0x40aa90
movq (%rax), %rax
addq $0x20, %rax
movq %rax, -0x5a0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x3a8(%rbp), %rdi
xorl %edx, %edx
callq 0x40a4c0
jmp 0x406f5d
movq -0x5a0(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x40a680
movb %al, -0x5a1(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x485ad0
movb -0x5a1(%rbp), %al
testb $0x1, %al
jne 0x406f91
jmp 0x4070c8
leaq -0x18(%rbp), %rdi
movq %rdi, -0x5b0(%rbp)
callq 0x40a4a0
movq -0x5b0(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x5a8(%rbp)
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x408(%rbp), %rdi
xorl %edx, %edx
callq 0x40a4c0
jmp 0x406fcb
leaq 0x1847c4(%rip), %rsi    # 0x58b796
leaq -0x3e8(%rbp), %rdi
leaq -0x408(%rbp), %rdx
callq 0x40a780
jmp 0x406fe7
leaq 0x1847ba(%rip), %rdx    # 0x58b7a8
leaq -0x3c8(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x40a730
jmp 0x407003
leaq -0x3c8(%rbp), %rdi
callq 0x487510
movq -0x4b8(%rbp), %rdi
movl -0x5a8(%rbp), %esi
movq %rax, %rdx
callq 0x405dc0
jmp 0x407026
leaq -0x3c8(%rbp), %rdi
callq 0x485ad0
leaq -0x3e8(%rbp), %rdi
callq 0x485ad0
leaq -0x408(%rbp), %rdi
callq 0x485ad0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4070b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4070ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x485ad0
leaq -0x3e8(%rbp), %rdi
callq 0x485ad0
leaq -0x408(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
jmp 0x4070ca
leaq -0x378(%rbp), %rdi
xorl %esi, %esi
callq 0x40aab0
movq %rax, -0x410(%rbp)
jmp 0x406ef4
movl $0x40, %edi
callq 0x416f20
movq %rax, -0x5b8(%rbp)
jmp 0x4070f7
movq -0x5b8(%rbp), %rdi
callq 0x40aae0
jmp 0x407105
movq -0x5b8(%rbp), %rax
movq %rax, -0x418(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x438(%rbp), %rdi
xorl %edx, %edx
callq 0x40a4c0
jmp 0x40712f
movq -0x418(%rbp), %rdi
addq $0x20, %rdi
leaq -0x438(%rbp), %rsi
movq %rsi, -0x5c8(%rbp)
callq 0x485b20
movq -0x5c8(%rbp), %rdi
callq 0x485ad0
movl -0x1c(%rbp), %edx
leaq 0x194e51(%rip), %rsi    # 0x59bfb4
xorl %eax, %eax
leaq -0x460(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
callq 0x4de430
movq -0x5c0(%rbp), %rsi
movq -0x418(%rbp), %rdi
callq 0x486b20
jmp 0x40718d
movq -0x4b8(%rbp), %rdi
addq $0x48, %rdi
leaq -0x418(%rbp), %rsi
callq 0x40ab10
jmp 0x4071a6
leaq -0x18(%rbp), %rdi
movq %rdi, -0x5d8(%rbp)
callq 0x40a4a0
movq -0x5d8(%rbp), %rdi
movq (%rax), %rax
movl $0x1, 0x24(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x5dc(%rbp)
callq 0x40a4a0
movl -0x5dc(%rbp), %ecx
movq -0x5d8(%rbp), %rdi
movq (%rax), %rax
movl %ecx, 0x20(%rax)
callq 0x40a4a0
movq (%rax), %rdi
movb $0x0, -0x481(%rbp)
movl $0x1, %esi
callq 0x40a570
movb %al, -0x5c9(%rbp)
jmp 0x407209
movb -0x5c9(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x5dd(%rbp)
jne 0x40721e
jmp 0x40726d
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x480(%rbp), %rdi
movl $0x1, %edx
callq 0x40a4c0
jmp 0x40723d
movb $0x1, -0x481(%rbp)
leaq 0x188602(%rip), %rsi    # 0x58f84d
leaq -0x480(%rbp), %rdi
callq 0x40a3c0
movb %al, -0x5de(%rbp)
jmp 0x40725f
movb -0x5de(%rbp), %al
movb %al, -0x5dd(%rbp)
jmp 0x40726d
movb -0x5dd(%rbp), %al
movb %al, -0x5df(%rbp)
testb $0x1, -0x481(%rbp)
jne 0x407284
jmp 0x407290
leaq -0x480(%rbp), %rdi
callq 0x485ad0
movb -0x5df(%rbp), %al
testb $0x1, %al
jne 0x40729f
jmp 0x4073c8
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rdi
movl $0x2, %esi
callq 0x40a570
movb %al, -0x5e0(%rbp)
jmp 0x4072bd
movb -0x5e0(%rbp), %al
testb $0x1, %al
jne 0x4072cc
jmp 0x4073c6
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq (%rax), %rsi
leaq -0x4a8(%rbp), %rdi
movl $0x2, %edx
callq 0x40a4c0
jmp 0x4072eb
movq -0x4b8(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x405f70
movl %eax, -0x5e4(%rbp)
jmp 0x407306
leaq -0x4a8(%rbp), %rdi
callq 0x485ad0
movl -0x5e4(%rbp), %eax
cmpl $0x0, %eax
jge 0x4073bb
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x184478(%rip), %rdx    # 0x58b7b5
callq 0x405dc0
jmp 0x407344
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
movq -0x5b8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x40, %esi
callq 0x416080
jmp 0x40745b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
testb $0x1, -0x481(%rbp)
jne 0x40738d
jmp 0x407399
leaq -0x480(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x485ad0
jmp 0x40745b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4073c6
jmp 0x4073f8
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movq -0x4b8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %esi
leaq 0x1843c8(%rip), %rdx    # 0x58b7ac
callq 0x405dc0
jmp 0x4073eb
movb $0x0, -0x1(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x40742e
jmp 0x407421
movl -0x1c(%rbp), %eax
movl %eax, -0x5e8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x40a4a0
movl -0x5e8(%rbp), %ecx
movq (%rax), %rax
movl %ecx, 0x20(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x407423
jmp 0x407425
jmp 0x407427
movl $0x0, -0x80(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x485ad0
movl -0x80(%rbp), %eax
testl %eax, %eax
je 0x407442
jmp 0x407440
jmp 0x40746a
jmp 0x407444
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x40ab50
movq %rax, -0x4b0(%rbp)
jmp 0x4060a2
leaq -0x50(%rbp), %rdi
callq 0x485ad0
jmp 0x407478
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x5f0, %rsp            # imm = 0x5F0
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x4b74e0
nopw %cs:(%rax,%rax)