// File: /workspace/github_cpp_makefile_star2_O2/menhits[P]phplus/src/utils/stringUtils.cpp
// Function: str::tabsToSpaces(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
string tabsToSpaces(const string& in, int tabWidth)
{
	int widthSinceNewline=0;
	string out;
	int bytePos=0;
	int start=0;
	
	while (bytePos<(int)in.size())
	{
		if (subMatches(in, bytePos, "\t"))
		{
			out+=in.substr(start, bytePos-start);
			string spacer;
			int spaces=tabWidth-(widthSinceNewline%tabWidth);
			for (int i=0; i<spaces; i++)
				spacer+=" ";
			out+=spacer;
			widthSinceNewline+=spaces;
			nextGlyph(bytePos, in);
			start=bytePos;
		}
		else
		{
			widthSinceNewline++;
			if (subMatches(in, bytePos, "\n"))
			{
				widthSinceNewline=0;
			}
			nextGlyph(bytePos, in);
		}
	}
	
	out+=in.substr(start, bytePos-start);
	
	return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0x24(%rsp)
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
leaq 0x10(%rsp), %rax
andl $0x0, (%rax)
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
movb $0x0, 0x10(%rdi)
leaq 0x28(%rsp), %r13
leaq 0xfa4(%rip), %r15       # 0x54a6c
xorl %ebp, %ebp
xorl %r12d, %r12d
movl $0x0, 0x14(%rsp)
movl %r12d, %ebx
movslq %r12d, %r12
cmpl 0x8(%r14), %ebp
jge 0x53c13
movq %r13, %rdi
leaq 0xf2f(%rip), %rsi       # 0x54a1e
leaq 0xf(%rsp), %rdx
callq 0xa150
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x3d9ca
movl %eax, %ebp
movq %r13, %rdi
callq 0xa558
testb %bpl, %bpl
je 0x53b83
movslq 0x10(%rsp), %rcx
subq %r12, %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xa2d0
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xa540
movl 0x14(%rsp), %ebx
movq %r13, %rdi
callq 0xa558
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movl %ebx, %eax
cltd
movl 0x24(%rsp), %ebp
idivl %ebp
subl %edx, %ebp
testl %ebp, %ebp
movl $0x0, %r12d
cmovgl %ebp, %r12d
subl $0x1, %r12d
jb 0x53bdd
movq %r13, %rdi
movq %r15, %rsi
callq 0xa520
jmp 0x53b70
movl 0x10(%rsp), %ebp
movq %r13, %rdi
leaq 0x1367(%rip), %rsi      # 0x54ef8
leaq 0xf(%rsp), %rdx
callq 0xa150
movl 0x14(%rsp), %r12d
incl %r12d
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x3d9ca
movl %eax, %ebp
movq %r13, %rdi
callq 0xa558
testb %bpl, %bpl
movl $0x0, %eax
cmovnel %eax, %r12d
movl %r12d, 0x14(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4fb83
movl %ebx, %r12d
jmp 0x53c0a
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xa540
addl %ebp, %ebx
movl %ebx, 0x14(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4fb83
movl 0x10(%rsp), %r12d
movq %r13, %rdi
callq 0xa558
movl 0x10(%rsp), %ebp
jmp 0x53ad5
subl %r12d, %ebp
movslq %ebp, %rcx
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xa2d0
leaq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xa540
leaq 0x28(%rsp), %rdi
callq 0xa558
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x53c68
jmp 0x53c63
jmp 0x53c68
jmp 0x53c63
jmp 0x53c68
jmp 0x53c63
movq %rax, %rbx
jmp 0x53c75
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa558
movq 0x18(%rsp), %rdi
callq 0xa558
movq %rbx, %rdi
callq 0xa500