// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/msclStringFuncs.cpp
// Function: padString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string padString(const string& in, int size, int alignment,  string pad, string leftCap, string rightCap)
{
	int capSize=leftCap.size()+rightCap.size();
	int padSize=size-int(in.size()+capSize);
	
	if (padSize<0) // need to chop
	{
		if (size-capSize>=1)
		{
			return leftCap+in.substr(0, size-capSize-1)+"…"+rightCap;
		}
		else if (size-capSize>=0)
		{
			return leftCap+string("…").substr(0, size-capSize)+rightCap;
		}
		else
		{
			return (leftCap+rightCap).substr(0, size);
		}
	}
	else if (padSize==0) // input size was exactly right
	{
		return leftCap+in+rightCap;
	}
	else // need to pad
	{
		if (alignment==0) // center alignment
		{
			string leftPad, rightPad;
			
			for (int i=0; i<floor(padSize/2.0); i++)
				leftPad+=pad;
			
			for (int i=0; i<ceil(padSize/2.0); i++)
				rightPad+=pad;
			
			return leftPad+leftCap+in+rightCap+rightPad;
		}
		// left or right alignment
		else
		{
			string padStr;
			
			for (int i=0; i<padSize; i++)
				padStr+=pad;
			
			if (alignment>0) // right align
				return leftCap+in+rightCap+padStr;
			else // left align
				return padStr+leftCap+in+rightCap;
		}

	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %ecx, %ebp
movq %rsi, %r12
movq %rdi, %r15
movq 0xf0(%rsp), %rax
movq 0x8(%rax), %rax
movq %r9, (%rsp)
addq 0x8(%r9), %rax
movl 0x8(%rsi), %ecx
addl %eax, %ecx
movl %edx, %r14d
subl %ecx, %r14d
js 0x41f0a
jne 0x41f6b
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
callq 0x441eb
movq %r15, %rdi
movq %r14, %rsi
movq 0xf0(%rsp), %rdx
callq 0x184b5
jmp 0x421bb
movl %edx, %ebx
movl %edx, %ecx
subl %eax, %ecx
jle 0x41fe6
decl %ecx
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xa2d0
leaq 0x28(%rsp), %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x441c7
leaq 0x17286(%rip), %rdx     # 0x591c8
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xc882
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq 0xf0(%rsp), %rdx
callq 0x184b5
jmp 0x4203d
movq %r8, %r13
leaq 0x18(%rsp), %rax
testl %ebp, %ebp
je 0x4205b
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8(%rsp), %rbx
subl $0x1, %r14d
jb 0x41f9f
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa540
jmp 0x41f8c
testl %ebp, %ebp
jle 0x4216d
leaq 0x48(%rsp), %rdi
movq (%rsp), %rsi
movq %r12, %rdx
callq 0x441eb
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq 0xf0(%rsp), %rdx
callq 0x184b5
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x184b5
jmp 0x421a7
js 0x421da
leaq 0x171d5(%rip), %rsi     # 0x591c8
leaq 0x48(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0xa150
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xa2d0
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq (%rsp), %rsi
callq 0x441c7
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq 0xf0(%rsp), %rdx
callq 0x184b5
leaq 0x8(%rsp), %rdi
callq 0xa558
leaq 0x28(%rsp), %rdi
callq 0xa558
leaq 0x48(%rsp), %rdi
jmp 0x421c0
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ebx, %ebx
movb %bl, (%rax)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %bl, (%rax)
cvtsi2sd %r14d, %xmm0
mulsd 0x1712b(%rip), %xmm0    # 0x591b0
movsd %xmm0, 0x70(%rsp)
callq 0xa4c0
movsd %xmm0, 0x68(%rsp)
leaq 0x8(%rsp), %r14
cvtsi2sd %ebx, %xmm0
movsd 0x68(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x420ba
movq %r14, %rdi
movq %r13, %rsi
callq 0xa540
incl %ebx
jmp 0x4209b
movsd 0x70(%rsp), %xmm0
callq 0xa070
movsd %xmm0, 0x68(%rsp)
xorl %ebx, %ebx
leaq 0x28(%rsp), %r14
cvtsi2sd %ebx, %xmm0
movsd 0x68(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x420f1
movq %r14, %rdi
movq %r13, %rsi
callq 0xa540
incl %ebx
jmp 0x420d2
leaq 0x98(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdx
callq 0x441eb
leaq 0x78(%rsp), %rdi
leaq 0x98(%rsp), %rsi
movq %r12, %rdx
callq 0x184b5
leaq 0x48(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq 0xf0(%rsp), %rdx
callq 0x184b5
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r15, %rdi
callq 0x184b5
leaq 0x48(%rsp), %rdi
callq 0xa558
leaq 0x78(%rsp), %rdi
callq 0xa558
leaq 0x98(%rsp), %rdi
callq 0xa558
leaq 0x28(%rsp), %rdi
jmp 0x421b6
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdx
callq 0x441eb
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r12, %rdx
callq 0x184b5
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
movq 0xf0(%rsp), %rdx
callq 0x184b5
leaq 0x28(%rsp), %rdi
callq 0xa558
leaq 0x48(%rsp), %rdi
callq 0xa558
leaq 0x8(%rsp), %rdi
callq 0xa558
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq (%rsp), %rsi
movq 0xf0(%rsp), %rdx
callq 0x441eb
movslq %ebx, %rcx
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xa2d0
jmp 0x421bb
jmp 0x422a9
jmp 0x42253
jmp 0x42262
jmp 0x422a9
jmp 0x4226e
jmp 0x4227d
jmp 0x4228c
movq %rax, %rbx
jmp 0x422b6
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa558
jmp 0x42233
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xa558
jmp 0x42242
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xa558
jmp 0x4229d
jmp 0x4229a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
jmp 0x42265
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x422a2
jmp 0x422a9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa558
jmp 0x42280
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
jmp 0x4228f
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x422b1
jmp 0x422a9
jmp 0x4229a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
jmp 0x422ac
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0xa500