// File: kebwi[P]Trifid/src/ImageInterface.cpp
// Function: ImageInterface::stripString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void ImageInterface::stripString(string &str)
{
	if (str.length() >= 4)	//Strip extension (presumably ".pgm" or ".ppm")
	{
		if (str[str.length() - 4] == '.'
			&& (isalpha(str[str.length() - 3]) || isalpha(str[str.length() - 2]) || isalpha(str[str.length() - 1])))
			str = str.substr(0, str.length() - 4);
	}
	
	for (int i = 0; i < 2; i++)	//Do this twice, once for "_out" and once for "_ori"
	{
		if (str.length() >= 4)	//Strip "_out" and "_ori" suffixes
		{
			if (str.substr(str.length() - 4, 4) == "_out" ||
				str.substr(str.length() - 4, 4) == "_ori")
				str = str.substr(0, str.length() - 4);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
cmpq $0x4, %rax
jb 0x152d8
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
subq $0x4, %rsi
callq 0x46b0
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x152d6
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
subq $0x3, %rsi
callq 0x46b0
movsbl (%rax), %edi
callq 0x45a0
cmpl $0x0, %eax
jne 0x15291
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
subq $0x2, %rsi
callq 0x46b0
movsbl (%rax), %edi
callq 0x45a0
cmpl $0x0, %eax
jne 0x15291
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
callq 0x46b0
movsbl (%rax), %edi
callq 0x45a0
cmpl $0x0, %eax
je 0x152d6
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0xd0(%rbp), %rsi
movq %rax, %rcx
subq $0x4, %rcx
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x43c0
movq -0x8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4480
leaq -0x28(%rbp), %rdi
callq 0x46c8
jmp 0x152d8
movl $0x0, -0x2c(%rbp)
cmpl $0x2, -0x2c(%rbp)
jge 0x15496
movq -0x8(%rbp), %rdi
callq 0x4550
cmpq $0x4, %rax
jb 0x15486
movq -0x8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x4550
movq -0xe8(%rbp), %rsi
movq %rax, %rdx
addq $-0x4, %rdx
leaq -0x50(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
movl $0x4, %ecx
callq 0x43c0
movq -0xe0(%rbp), %rdi
movb $0x0, -0x81(%rbp)
leaq 0x34d47(%rip), %rsi     # 0x4a08b
callq 0xe570
movb %al, -0xd1(%rbp)
jmp 0x15351
movb -0xd1(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xe9(%rbp)
jne 0x153c1
jmp 0x15366
movq -0x8(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x4550
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
addq $-0x4, %rdx
leaq -0x80(%rbp), %rdi
movl $0x4, %ecx
callq 0x43c0
jmp 0x15394
movb $0x1, -0x81(%rbp)
leaq 0x34cee(%rip), %rsi     # 0x4a090
leaq -0x80(%rbp), %rdi
callq 0xe570
movb %al, -0xf9(%rbp)
jmp 0x153b3
movb -0xf9(%rbp), %al
movb %al, -0xe9(%rbp)
jmp 0x153c1
movb -0xe9(%rbp), %al
movb %al, -0xfa(%rbp)
testb $0x1, -0x81(%rbp)
jne 0x153d8
jmp 0x153e1
leaq -0x80(%rbp), %rdi
callq 0x46c8
leaq -0x50(%rbp), %rdi
callq 0x46c8
movb -0xfa(%rbp), %al
testb $0x1, %al
jne 0x153f9
jmp 0x15484
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4550
movq -0x108(%rbp), %rsi
movq %rax, %rcx
subq $0x4, %rcx
leaq -0xa8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x43c0
movq -0x8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4480
leaq -0xa8(%rbp), %rdi
callq 0x46c8
jmp 0x15484
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x15479
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
testb $0x1, -0x81(%rbp)
jne 0x1546e
jmp 0x15477
leaq -0x80(%rbp), %rdi
callq 0x46c8
jmp 0x15479
leaq -0x50(%rbp), %rdi
callq 0x46c8
jmp 0x1549f
jmp 0x15486
jmp 0x15488
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x152df
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4620
nopl (%rax,%rax)