// File: AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::val2reg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
string codeGenerator::val2reg( string val, int type ){
	if( !ShouldGenerate() ) return "";
	savedArgument.size = 0;
	savedArgument.type = type;
	savedArgument.indirect = false;
	savedArgument.set = true;
	savedArgument.isGlobal = false;
	
	string reg;
	comment("Constant Value to Register");
	reg = newRegister( type );

	pushStack( reg, 'E', type );

	if(type == TYPE_STRING){
		val = to_string( AddStringHeap( val ) );
	}
	fprintf( oFile, "   %s = %s;\n", reg.c_str(), val.c_str() );
	return reg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdx, -0xf8(%rbp)
movq %rdi, -0xf0(%rbp)
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x19590
testb $0x1, %al
jne 0x1c1da
leaq -0x1d(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3430
movq -0xf0(%rbp), %rdi
movq -0x100(%rbp), %rdx
leaq 0xaad6(%rip), %rsi      # 0x26c81
callq 0x62d0
jmp 0x1c1b2
leaq -0x1d(%rbp), %rdi
callq 0x32e0
jmp 0x1c43f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1d(%rbp), %rdi
callq 0x32e0
jmp 0x1c44f
movq -0xf0(%rbp), %rdi
movq -0xe0(%rbp), %rax
movl $0x0, 0x2a8(%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x2a4(%rax)
movb $0x0, 0x2b4(%rax)
movb $0x1, 0x2b6(%rax)
movb $0x0, 0x2b5(%rax)
movb $0x0, -0x2d(%rbp)
callq 0x3370
leaq -0x51(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x3430
movq -0x108(%rbp), %rdx
leaq 0xaf36(%rip), %rsi      # 0x2716d
leaq -0x50(%rbp), %rdi
callq 0x62d0
jmp 0x1c242
movq -0xe0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq %rsi, -0x110(%rbp)
xorl %edx, %edx
callq 0x19bb0
movq -0x110(%rbp), %rdi
callq 0x31a0
leaq -0x51(%rbp), %rdi
callq 0x32e0
movq -0xe0(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x1baf0
jmp 0x1c285
movq -0xf0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %rsi, -0x118(%rbp)
callq 0x3340
movq -0x118(%rbp), %rdi
callq 0x31a0
movq -0xf0(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x3130
jmp 0x1c2bd
movq -0xe0(%rbp), %rdi
movl -0x1c(%rbp), %ecx
leaq -0x98(%rbp), %rsi
movl $0x45, %edx
callq 0x1a6b0
jmp 0x1c2da
leaq -0x98(%rbp), %rdi
callq 0x31a0
cmpl $0x10d, -0x1c(%rbp)     # imm = 0x10D
jne 0x1c3c6
movq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x3130
jmp 0x1c308
movq -0xe0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x1c460
movl %eax, -0x11c(%rbp)
jmp 0x1c323
movl -0x11c(%rbp), %esi
leaq -0xb8(%rbp), %rdi
callq 0x123d0
jmp 0x1c337
movq -0xf8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3340
leaq -0xb8(%rbp), %rdi
callq 0x31a0
leaq -0xd8(%rbp), %rdi
callq 0x31a0
jmp 0x1c3c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x32e0
jmp 0x1c431
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1c431
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x31a0
jmp 0x1c431
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x31a0
jmp 0x1c431
movq -0xf0(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq 0x308(%rax), %rax
movq %rax, -0x130(%rbp)
callq 0x3120
movq -0xf8(%rbp), %rdi
movq %rax, -0x128(%rbp)
callq 0x3120
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rdx
movq %rax, %rcx
leaq 0xad76(%rip), %rsi      # 0x27188
movb $0x0, %al
callq 0x3380
movb $0x1, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
jne 0x1c42f
movq -0xf0(%rbp), %rdi
callq 0x31a0
jmp 0x1c43f
movq -0xf0(%rbp), %rdi
callq 0x31a0
jmp 0x1c44f
movq -0xe8(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3420
nopl (%rax,%rax)