// File: menhits[P]phplus/src/CppProgram.cpp
// Function: CppProgram::declareGlobal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::shared_ptr<TypeBase>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void CppProgram::declareGlobal(const string& nameIn, Type typeIn, string initialValue)
{
	if (globalNames->hasPp(nameIn))
		return;
	
	string code;
	code+=getTypeCode(typeIn);
	code+=" ";
	globalNames->addPp(nameIn);
	code+=globalNames->getCpp(nameIn);
	if (!initialValue.empty())
	{
		code+=" = ";
		code+=initialValue;
	}
	code+=";\n";
	
	globalVarCode+=code;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdx, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq %rdx, 0xf0(%rsp)
movq %rcx, 0xe8(%rsp)
movq 0x100(%rsp), %rdi
movq %rdi, 0x38(%rsp)
addq $0xf8, %rdi
callq 0x2d6b0
movq %rax, %rdi
movq 0xf8(%rsp), %rsi
callq 0x23c50
testb $0x1, %al
jne 0x2a570
jmp 0x2a575
jmp 0x2a7f1
leaq 0xc8(%rsp), %rdi
callq 0xb4e0
movq 0x28(%rsp), %rsi
leaq 0x98(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1a920
movq 0x38(%rsp), %rsi
movq 0x20(%rsp), %rdx
leaq 0xa8(%rsp), %rdi
callq 0x285b0
jmp 0x2a5b2
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xb470
jmp 0x2a5c9
leaq 0xa8(%rsp), %rdi
callq 0xb6e8
leaq 0x98(%rsp), %rdi
callq 0x1a950
leaq 0xa7482(%rip), %rsi     # 0xd1a6c
leaq 0xc8(%rsp), %rdi
callq 0xb360
jmp 0x2a5f9
movq 0x38(%rsp), %rdi
addq $0xf8, %rdi
callq 0x2d6b0
movq %rax, 0x8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xb690
movq 0x18(%rsp), %rdx
leaq 0xa72de(%rip), %rsi     # 0xd1915
leaq 0x68(%rsp), %rdi
callq 0xb4c0
jmp 0x2a643
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x232f0
jmp 0x2a659
leaq 0x68(%rsp), %rdi
callq 0xb6e8
leaq 0x67(%rsp), %rdi
callq 0xb3f0
movq 0x38(%rsp), %rdi
addq $0xf8, %rdi
callq 0x2d6b0
movq %rax, %rsi
movq 0xf8(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0x23eb0
jmp 0x2a695
leaq 0xc8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xb470
jmp 0x2a6a9
leaq 0x40(%rsp), %rdi
callq 0xb6e8
movq 0x30(%rsp), %rdi
callq 0xb610
testb $0x1, %al
jne 0x2a7b6
leaq 0xaab9b(%rip), %rsi     # 0xd5267
leaq 0xc8(%rsp), %rdi
callq 0xb360
jmp 0x2a6db
movq 0x30(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xb470
jmp 0x2a6ef
jmp 0x2a7b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0x2a72b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xb6e8
leaq 0x98(%rsp), %rdi
callq 0x1a950
jmp 0x2a7f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0x2a7f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0x2a78a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xb6e8
leaq 0x67(%rsp), %rdi
callq 0xb3f0
jmp 0x2a7f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb6e8
jmp 0x2a7f9
leaq 0xaa82b(%rip), %rsi     # 0xd4fe8
leaq 0xc8(%rsp), %rdi
callq 0xb360
jmp 0x2a7cc
movq 0x38(%rsp), %rdi
addq $0x60, %rdi
leaq 0xc8(%rsp), %rsi
callq 0xb470
jmp 0x2a7e4
leaq 0xc8(%rsp), %rdi
callq 0xb6e8
addq $0x108, %rsp            # imm = 0x108
retq
leaq 0xc8(%rsp), %rdi
callq 0xb6e8
movq 0x90(%rsp), %rdi
callq 0xb680
nopw %cs:(%rax,%rax)