// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x330(%rsi)
je 0x13475
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movl $0x0, 0x2a8(%rsi)
movl %ecx, 0x2a4(%rsi)
movw $0x0, 0x2b4(%rsi)
movb $0x1, 0x2b6(%rsi)
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq 0x78(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7ab6(%rip), %rsi      # 0x1ae65
leaq 0x7ac9(%rip), %rdx      # 0x1ae7f
leaq 0x68(%rsp), %rdi
callq 0x3c42
movq 0x308(%r15), %rdi
movq 0x68(%rsp), %rdx
leaq 0x764c(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x133f1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x12baa
leaq 0x28(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2270
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1342b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x3bac
cmpb $0x1, 0x330(%r15)
jne 0x1349a
leaq 0x130(%r15), %rdi
leaq 0x48(%rsp), %rsi
callq 0x17610
cmpl $0x10b, %ebp            # imm = 0x10B
jne 0x13493
incl 0x124(%r15)
jmp 0x1349a
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x74da(%rip), %rdx      # 0x1a95d
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x3c42
jmp 0x135db
incl 0x120(%r15)
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x134b1
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
cmpl $0x10d, %ebp            # imm = 0x10D
jne 0x135c0
movq %r13, (%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x3bac
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x13656
movl %eax, %r12d
movl %eax, %ebp
negl %ebp
cmovsl %eax, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0x13549
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x13540
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x13546
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x13549
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x1350d
addl $-0x3, %r13d
jmp 0x13549
addl $-0x2, %r13d
jmp 0x13549
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x2240
movl %r12d, %edi
leaq 0x28(%rsp), %r12
addq (%r12), %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0xdf80
movq %r14, %rdi
movq %r12, %rsi
callq 0x2270
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x135a4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x135c0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r15), %rdi
movq (%rbx), %rdx
movq (%r14), %rcx
leaq 0x78ac(%rip), %rsi      # 0x1ae80
xorl %eax, %eax
callq 0x22a0
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13633
movq %r13, (%rsp)
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x13636
movq 0x58(%rsp), %rsi
jmp 0x13621
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x13636
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x13636
jmp 0x1362f
jmp 0x1362f
movq %r13, (%rsp)
movq %rax, %r14
movq (%rbx), %rdi
cmpq (%rsp), %rdi
je 0x1364e
movq (%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq %r14, %rdi
callq 0x2330