// File: menhits[P]phplus/src/msclStringFuncs.cpp
// Function: tabsToSpaces(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
string tabsToSpaces(const string& in, int spaceNum)
{
	int xPos=0;
	string out;
	int sectionStart=0;
	
	for (unsigned i=0; i<in.size(); i++)
	{
		if (substringMatches(in, i, "\t"))
		{
			string tabStr;
			
			for (int j=0; j<spaceNum-(xPos%spaceNum); j++)
			{
				tabStr+=" ";
			}
			
			out+=in.substr(sectionStart, i-sectionStart)+tabStr;
			
			sectionStart=i+1;
		}
		
		xPos++;
		
		if (substringMatches(in, i, "\n"))
		{
			xPos=0;
		}
	}
	
	out+=in.substr(sectionStart, in.size());
	
	return out;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x58(%rsp)
movq %rdi, %rax
movq %rax, 0x60(%rsp)
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
movl %edx, 0x164(%rsp)
movl $0x0, 0x160(%rsp)
movb $0x0, 0x15f(%rsp)
callq 0xb4e0
movl $0x0, 0x158(%rsp)
movl $0x0, 0x154(%rsp)
movl 0x154(%rsp), %eax
movq %rax, 0x50(%rsp)
movq 0x168(%rsp), %rdi
callq 0xb2a0
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0xa8a73
movq 0x168(%rsp), %rax
movq %rax, 0x38(%rsp)
movl 0x154(%rsp), %eax
movl %eax, 0x44(%rsp)
leaq 0x12f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xb690
movq 0x48(%rsp), %rdx
leaq 0x29275(%rip), %rsi     # 0xd1a1e
leaq 0x130(%rsp), %rdi
callq 0xb4c0
jmp 0xa87b8
movl 0x44(%rsp), %esi
movq 0x38(%rsp), %rdi
leaq 0x130(%rsp), %rdx
callq 0xa8010
movb %al, 0x37(%rsp)
leaq 0x130(%rsp), %rdi
callq 0xb6e8
leaq 0x12f(%rsp), %rdi
callq 0xb3f0
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0xa87f9
jmp 0xa8995
leaq 0xf8(%rsp), %rdi
callq 0xb4e0
movl $0x0, 0xf4(%rsp)
movl 0xf4(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x164(%rsp), %ecx
movl 0x160(%rsp), %eax
cltd
idivl 0x164(%rsp)
movl 0x30(%rsp), %eax
subl %edx, %ecx
cmpl %ecx, %eax
jge 0xa88a6
leaq 0x29229(%rip), %rsi     # 0xd1a6c
leaq 0xf8(%rsp), %rdi
callq 0xb360
jmp 0xa8852
jmp 0xa8854
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf4(%rsp)
jmp 0xa8811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x12f(%rsp), %rdi
callq 0xb3f0
jmp 0xa8b25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa8983
movq 0x168(%rsp), %rsi
movslq 0x158(%rsp), %rdx
movl %edx, %ecx
movl 0x154(%rsp), %eax
subl %ecx, %eax
movl %eax, %ecx
leaq 0xb0(%rsp), %rdi
callq 0xb3a0
jmp 0xa88d2
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x2e070
jmp 0xa88f1
movq 0x58(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xb470
jmp 0xa8905
leaq 0xd0(%rsp), %rdi
callq 0xb6e8
leaq 0xb0(%rsp), %rdi
callq 0xb6e8
movl 0x154(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x158(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xb6e8
jmp 0xa8995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa8976
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xb6e8
leaq 0xb0(%rsp), %rdi
callq 0xb6e8
leaq 0xf8(%rsp), %rdi
callq 0xb6e8
jmp 0xa8b25
movl 0x160(%rsp), %eax
incl %eax
movl %eax, 0x160(%rsp)
movq 0x168(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0x154(%rsp), %eax
movl %eax, 0x24(%rsp)
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xb690
movq 0x28(%rsp), %rdx
leaq 0x2951d(%rip), %rsi     # 0xd1ef8
leaq 0x90(%rsp), %rdi
callq 0xb4c0
jmp 0xa89ea
movl 0x24(%rsp), %esi
movq 0x18(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xa8010
movb %al, 0x17(%rsp)
leaq 0x90(%rsp), %rdi
callq 0xb6e8
leaq 0x8f(%rsp), %rdi
callq 0xb3f0
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xa8a28
jmp 0xa8a5b
movl $0x0, 0x160(%rsp)
jmp 0xa8a5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x8f(%rsp), %rdi
callq 0xb3f0
jmp 0xa8b25
jmp 0xa8a5d
movl 0x154(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x154(%rsp)
jmp 0xa8749
movq 0x168(%rsp), %rdi
movq %rdi, (%rsp)
movslq 0x158(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0xb2a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rcx
leaq 0x68(%rsp), %rdi
callq 0xb3a0
jmp 0xa8aa9
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xb470
jmp 0xa8aba
leaq 0x68(%rsp), %rdi
callq 0xb6e8
movb $0x1, 0x15f(%rsp)
testb $0x1, 0x15f(%rsp)
jne 0xa8b18
jmp 0xa8b0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0xa8b25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xb6e8
jmp 0xa8b25
movq 0x58(%rsp), %rdi
callq 0xb6e8
movq 0x60(%rsp), %rax
addq $0x178, %rsp            # imm = 0x178
retq
movq 0x58(%rsp), %rdi
callq 0xb6e8
movq 0x120(%rsp), %rdi
callq 0xb680
nopl (%rax)