// File: menhits[P]phplus/src/CppProgram.cpp
// Function: getValidCppId(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string getValidCppId(string in)
{
	string cpp;
	
	if (in.empty())
		in="no_name";
	
	int start=0;
	
	// all this should work with unicode (although it may inject random (but valid) characters into the C++ names)
	do
	{
		int i=start;
		
		for (; i<int(in.size()) && (
				(in[i]>='a' && in[i]<='z') ||
				(in[i]>='A' && in[i]<='Z') ||
				(in[i]>='0' && in[i]<='9') ||
				in[i]=='_'
			); i++) {}
		
		if (i!=start)
		{
			if (in[start]>='0' && in[start]<='9')
				cpp+="_";
			cpp+=in.substr(start, i-start);
		}
		
		start=i+1;
		
	} while (start<int(in.size()));
	
	return cpp;
}

// Assembly:
subq $0xc8, %rsp
movq %rsi, 0x70(%rsp)
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movb $0x0, 0xb7(%rsp)
callq 0xb4e0
movq 0x70(%rsp), %rdi
callq 0xb610
testb $0x1, %al
jne 0x22e06
jmp 0x22e34
movq 0x70(%rsp), %rdi
leaq 0xaeafb(%rip), %rsi     # 0xd190d
callq 0xb4b0
jmp 0x22e19
jmp 0x22e34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0x230fc
movl $0x0, 0xa0(%rsp)
movl 0xa0(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0x70(%rsp), %rdi
movl 0x9c(%rsp), %eax
movl %eax, 0x58(%rsp)
callq 0xb2a0
movl 0x58(%rsp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, 0x5f(%rsp)
jge 0x22fa3
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x50(%rsp)
jmp 0x22e8f
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jl 0x22ecc
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x48(%rsp)
jmp 0x22eb5
movq 0x48(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x7a, %ecx
movb %al, 0x47(%rsp)
jle 0x22f9b
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x38(%rsp)
jmp 0x22ee5
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x22f1e
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x30(%rsp)
jmp 0x22f0b
movq 0x30(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x5a, %ecx
movb %al, 0x47(%rsp)
jle 0x22f9b
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x28(%rsp)
jmp 0x22f37
movq 0x28(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x22f70
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x20(%rsp)
jmp 0x22f5d
movq 0x20(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x39, %ecx
movb %al, 0x47(%rsp)
jle 0x22f9b
movq 0x70(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x18(%rsp)
jmp 0x22f89
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
sete %al
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
movb %al, 0x5f(%rsp)
movb 0x5f(%rsp), %al
testb $0x1, %al
jne 0x22fad
jmp 0x22fc5
jmp 0x22faf
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x22e4d
movl 0x9c(%rsp), %eax
cmpl 0xa0(%rsp), %eax
je 0x2309e
movq 0x70(%rsp), %rdi
movslq 0xa0(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x10(%rsp)
jmp 0x22ff2
movq 0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x2303a
movq 0x70(%rsp), %rdi
movslq 0xa0(%rsp), %rsi
callq 0xb6d0
movq %rax, 0x8(%rsp)
jmp 0x23018
movq 0x8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x2303a
movq 0x60(%rsp), %rdi
leaq 0xb39e5(%rip), %rsi     # 0xd6a16
callq 0xb360
jmp 0x23038
jmp 0x2303a
movq 0x70(%rsp), %rsi
movslq 0xa0(%rsp), %rdx
movl %edx, %ecx
movl 0x9c(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x78(%rsp), %rdi
callq 0xb3a0
jmp 0x23061
movq 0x60(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xb470
jmp 0x23072
leaq 0x78(%rsp), %rdi
callq 0xb6e8
jmp 0x2309e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0x78(%rsp), %rdi
callq 0xb6e8
jmp 0x230fc
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x70(%rsp), %rdi
movl 0xa0(%rsp), %eax
movl %eax, 0x4(%rsp)
callq 0xb2a0
movq %rax, %rcx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jl 0x22e3f
movb $0x1, 0xb7(%rsp)
testb $0x1, 0xb7(%rsp)
jne 0x230ef
movq 0x60(%rsp), %rdi
callq 0xb6e8
movq 0x68(%rsp), %rax
addq $0xc8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0xb6e8
movq 0xa8(%rsp), %rdi
callq 0xb680
nopw %cs:(%rax,%rax)