// File: /workspace/github_cpp_makefile_star2_O1/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 0x1355b
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 0x79d0(%rip), %rsi      # 0x1ae65
leaq 0x79e3(%rip), %rdx      # 0x1ae7f
leaq 0x68(%rsp), %rdi
callq 0x3c34
movq 0x308(%r15), %rdi
movq 0x68(%rsp), %rdx
leaq 0x7566(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x134d7
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x12c8c
leaq 0x28(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2270
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x13511
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 0x3ba4
cmpb $0x1, 0x330(%r15)
jne 0x13580
leaq 0x130(%r15), %rdi
leaq 0x48(%rsp), %rsi
callq 0x176d0
cmpl $0x10b, %ebp            # imm = 0x10B
jne 0x13579
incl 0x124(%r15)
jmp 0x13580
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x73f4(%rip), %rdx      # 0x1a95d
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x3c34
jmp 0x136c1
incl 0x120(%r15)
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x13597
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
cmpl $0x10d, %ebp            # imm = 0x10D
jne 0x136a6
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 0x3ba4
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x1373c
movl %eax, %r12d
movl %eax, %ebp
negl %ebp
cmovsl %eax, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0x1362f
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x13626
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x1362c
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x1362f
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x135f3
addl $-0x3, %r13d
jmp 0x1362f
addl $-0x2, %r13d
jmp 0x1362f
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 0xe072
movq %r14, %rdi
movq %r12, %rsi
callq 0x2270
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1368a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x136a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r15), %rdi
movq (%rbx), %rdx
movq (%r14), %rcx
leaq 0x77c6(%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 0x13719
movq %r13, (%rsp)
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x1371c
movq 0x58(%rsp), %rsi
jmp 0x13707
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1371c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x1371c
jmp 0x13715
jmp 0x13715
movq %r13, (%rsp)
movq %rax, %r14
movq (%rbx), %rdi
cmpq (%rsp), %rdi
je 0x13734
movq (%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq %r14, %rdi
callq 0x2330