// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/msclStringFuncs.cpp
// Function: getUniqueString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::function<bool (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)>, bool)
string getUniqueString(string hint, std::function<bool (string)> checker, bool alwaysAppendRandom)
{
	string out=hint;
	
	int attempts=0;
	bool invalid=out.empty() || !checker(out) || alwaysAppendRandom;
	
	while (invalid)
	{
		if (alwaysAppendRandom || attempts>=10)
		{
			out=hint+"_";
			
			if (attempts>20)
			{
				throw PhplusError("could not find unique random name", INTERNAL_ERROR);
			}
			
			for (int i=0; i<3; i++)
				out+=getRandChar();
		}
		else
		{
			string suffix=to_string(attempts);
			
			out=hint+"_"+suffix;
		}
		attempts++;
		invalid=!checker(out);
	}
	
	return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0xa3b0
cmpq $0x0, 0x8(%rbx)
je 0x43eb0
leaq 0xa8(%rsp), %rdi
movq %rbx, %rsi
callq 0xa3b0
leaq 0xa8(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x442c6
movl %eax, %r13d
xorb $0x1, %r13b
orb 0xc(%rsp), %r13b
xorl %r12d, %r12d
jmp 0x43ecd
movb $0x1, %r13b
xorl %r12d, %r12d
jmp 0x43ed5
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
jmp 0x44098
jmp 0x4409f
movq %rbp, %rdi
callq 0xa558
testb $0x1, %r13b
je 0x43fd1
cmpl $0xa, %r12d
setae %al
orb 0xc(%rsp), %al
cmpb $0x1, %al
jne 0x43f3e
leaq 0x152d9(%rip), %rdx     # 0x591ce
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x11fb8
leaq 0x10(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa350
movq %r13, %rdi
callq 0xa558
cmpl $0x14, %r12d
ja 0x43fe6
pushq $0x3
popq %rbp
subl $0x1, %ebp
jb 0x43fa5
callq 0x43e1b
movsbl %al, %esi
movq %rbx, %rdi
callq 0xa270
jmp 0x43f27
leaq 0x10(%rsp), %rdi
movl %r12d, %esi
callq 0x1837a
leaq 0x1527c(%rip), %rdx     # 0x591ce
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x11fb8
leaq 0xc8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x184b5
leaq 0xc8(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa350
movq %r13, %rdi
callq 0xa558
leaq 0x48(%rsp), %rdi
callq 0xa558
leaq 0x10(%rsp), %rdi
callq 0xa558
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0xa3b0
leaq 0x68(%rsp), %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x442c6
movl %eax, %r13d
incl %r12d
xorb $0x1, %r13b
jmp 0x43ecd
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x38
popq %rdi
callq 0xa1b0
movq %rax, %r15
leaq 0x1529f(%rip), %rsi     # 0x59297
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xa150
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rcx
movaps %xmm0, (%rcx)
movb $0x1, %bpl
leaq 0x88(%rsp), %rsi
pushq $0x3
popq %rdx
movq %r15, %rdi
callq 0x19f06
xorl %ebp, %ebp
leaq 0x33564(%rip), %rsi     # 0x77598
leaq -0x329a9(%rip), %rdx    # 0x11692
movq %r15, %rdi
callq 0xa4e0
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0xc984
leaq 0x88(%rsp), %rdi
callq 0xa558
testb %bpl, %bpl
jne 0x44067
jmp 0x440a2
movq %rax, %r14
movq %r15, %rdi
callq 0xa230
jmp 0x440a2
jmp 0x4409f
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0xa558
jmp 0x44087
jmp 0x4409f
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x44098
jmp 0x4409f
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xa558
jmp 0x440a2
movq %rax, %r14
movq %rbx, %rdi
callq 0xa558
movq %r14, %rdi
callq 0xa500