// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movl %ecx, 0x4(%rsp)
movq %rdx, %r14
movq %rsi, %rcx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x50(%rsp)
movq %rax, (%rdi)
movq (%rsi), %rsi
movq %rcx, 0x28(%rsp)
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
callq 0xdde2
movq 0x8(%rbx), %r12
testq %r12, %r12
je 0x5dccb
leaq 0xb0(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
leaq (%rsi,%r12), %rdx
leaq 0xa0(%rsp), %rdi
callq 0xdde2
cmpq $0x0, 0x10(%r14)
je 0x5dfc7
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq *0x18(%r14)
movl %eax, %ebp
xorb $0x1, %bpl
orb 0x4(%rsp), %bpl
jmp 0x5dcce
movb $0x1, %bpl
testq %r12, %r12
je 0x5dce9
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5dce9
callq 0xa2b0
testb %bpl, %bpl
je 0x5df3a
leaq 0x18(%rsp), %r13
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movl $0x84210843, %ebp       # imm = 0x84210843
movq %r14, 0x58(%rsp)
cmpl $0xa, %r12d
setae %al
orb 0x4(%rsp), %al
cmpb $0x1, %al
jne 0x5ddcc
movq %r13, 0x8(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0xdde2
movq %r15, %rdi
leaq 0x1d4e4(%rip), %rsi     # 0x7b226
callq 0xa560
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa370
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x5dd61
callq 0xa2b0
cmpl $0x14, %r12d
ja 0x5df54
movl $0x3, %r13d
imull $0x41c64e6d, 0x3b575(%rip), %ecx # imm = 0x41C64E6D
addl $0x3039, %ecx           # imm = 0x3039
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, 0x3b563(%rip)     # 0x992f0
movq %rcx, %rax
imulq %rbp, %rax
shrq $0x25, %rax
movl %eax, %edx
shll $0x6, %edx
addl %eax, %eax
subl %edx, %eax
addl %ecx, %eax
cmpl $0x19, %eax
ja 0x5ddac
addb $0x61, %al
jmp 0x5ddb7
cmpl $0x33, %eax
ja 0x5ddb5
addb $0x27, %al
jmp 0x5ddb7
addb $-0x4, %al
movsbl %al, %esi
movq %rbx, %rdi
callq 0xa290
decl %r13d
jne 0x5dd71
jmp 0x5dedc
movq %r13, 0x8(%rsp)
movl $0x1, %esi
movq %r15, %rdi
movl $0x2d, %edx
callq 0xa330
movq 0x8(%rsp), %rdi
movl $0x1, %esi
movl %r12d, %edx
callq 0x4ff49
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0xdde2
movq %r15, %rdi
leaq 0x1d401(%rip), %rsi     # 0x7b226
callq 0xa560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0xa110
leaq 0x90(%rsp), %r15
movq %r15, 0x80(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5de70
movq %rdx, 0x80(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
jmp 0x5de77
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x88(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
callq 0xa370
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x5deb4
callq 0xa2b0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5dec8
callq 0xa2b0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
movq 0x58(%rsp), %r14
je 0x5dedc
callq 0xa2b0
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xdde2
cmpq $0x0, 0x10(%r14)
je 0x5df4f
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
callq *0x18(%r14)
movl %eax, %r13d
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5df24
callq 0xa2b0
incl %r12d
testb %r13b, %r13b
leaq 0x18(%rsp), %r13
leaq 0x8(%rsp), %r15
je 0x5dd09
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa140
movl $0x38, %edi
callq 0xa1b0
movq %rax, %r15
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d37a(%rip), %rsi     # 0x7b2ef
leaq 0x1d394(%rip), %rdx     # 0x7b310
leaq 0xd8(%rsp), %rdi
callq 0xdf6a
xorps %xmm0, %xmm0
leaq 0xc0(%rsp), %rcx
movaps %xmm0, (%rcx)
movb $0x1, %bpl
leaq 0xd8(%rsp), %rsi
movq %r15, %rdi
movl $0x3, %edx
callq 0x200e4
xorl %ebp, %ebp
leaq 0x38680(%rip), %rsi     # 0x96638
leaq -0x496c7(%rip), %rdx    # 0x148f8
movq %r15, %rdi
callq 0xa4f0
callq 0xa140
jmp 0x5e076
movq %rax, %r14
movq 0xa0(%rsp), %rdi
jmp 0x5e052
movq %rax, %r14
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x5dff3
callq 0xdcba
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0x5e00d
callq 0xa2b0
jmp 0x5e00d
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x5e079
movq %r15, %rdi
callq 0xa240
jmp 0x5e079
jmp 0x5e076
jmp 0x5e027
jmp 0x5e076
movq %rax, %r14
jmp 0x5e03e
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5e03e
callq 0xa2b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
jmp 0x5e06a
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x5e06f
jmp 0x5e079
jmp 0x5e076
jmp 0x5e05d
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5e079
callq 0xa2b0
jmp 0x5e079
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x50(%rsp), %rdi
je 0x5e088
callq 0xa2b0
movq %r14, %rdi
callq 0xa510