// File: /workspace/github_cpp_makefile_star2_O3/tjohnman[P]sfxr-sdl2/build/../src/sdlkit.cpp
// Function: new_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string new_file(const std::string& forced_extension)
{
	using namespace std;
	
	string result;
	
	bool done = false;
	SDL_Event e;
	while (!done)
	{
		while(SDL_PollEvent(&e))
		{
			switch (e.type)
			{
				case SDL_QUIT:
					exit(0);
		
				case SDL_KEYDOWN:
					if(e.key.keysym.sym == SDLK_ESCAPE)
					{
						return "";
					}
					if(e.key.keysym.sym == SDLK_RETURN)
					{
						done = true;
						break;
					}
					
					{
						SDL_Keycode c = e.key.keysym.sym;
						if(0x21 <= c && c <= 0x7E)
							result += e.key.keysym.sym;
					}
		
				default: break;
			}
		}
		sdlupdate();
		
		ClearScreen(0xC0B090);
		
		DrawText(font, 90, 150, 0x000000, "TYPE NEW FILE NAME:");
		DrawText(font, 100, 200, 0x000000, "%s", stoupper(result).c_str());

		SDL_Delay(5);
	
		SDL_UpdateWindowSurface(window);
	}
	
	//if(result.size() == 0)
	//	throw runtime_error("New file name is empty string.");
	
	if(result.size() < 6 || result.substr(result.size()-1 - 4, string::npos) != forced_extension)
		result += forced_extension;
	
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x48(%rsp)
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x50(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x5547(%rip), %r13      # 0xd2c8
movl %ebp, %r14d
movq %r15, %rdi
callq 0x2170
testl %eax, %eax
setne %bpl
je 0x7dd2
movl 0x50(%rsp), %eax
cmpl $0x300, %eax            # imm = 0x300
je 0x7dab
cmpl $0x100, %eax            # imm = 0x100
jne 0x7d84
jmp 0x7f7d
movl 0x64(%rsp), %eax
cmpl $0xd, %eax
je 0x7d81
cmpl $0x1b, %eax
je 0x7ebf
leal -0x21(%rax), %ecx
cmpl $0x5d, %ecx
ja 0x7d84
movsbl %al, %esi
movq %r12, %rdi
callq 0x21f0
jmp 0x7d84
callq 0x7879
movl $0xc0b090, %edi         # imm = 0xC0B090
callq 0x8f82
movq %r13, %rdi
movl $0x5a, %esi
movl $0x96, %edx
xorl %ecx, %ecx
leaq 0x26f7(%rip), %r8       # 0xa4ee
xorl %eax, %eax
callq 0x92ea
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x7c94
movq 0x28(%rsp), %r9
movq %r13, %rdi
movl $0x64, %esi
movl $0xc8, %edx
xorl %ecx, %ecx
leaq 0x26dc(%rip), %r8       # 0xa502
xorl %eax, %eax
callq 0x92ea
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7e49
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x22a0
movl $0x5, %edi
callq 0x21a0
movq 0x6846(%rip), %rdi      # 0xe6a0
callq 0x22f0
testb $0x1, %r14b
je 0x7d81
movq 0x10(%rsp), %rdx
cmpq $0x6, %rdx
movq 0x48(%rsp), %r15
jb 0x7f34
addq $-0x5, %rdx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq $-0x1, %rcx
callq 0x22c0
movq 0x30(%rsp), %rdx
cmpq 0x8(%r15), %rdx
jne 0x7f09
movq 0x28(%rsp), %r14
testq %rdx, %rdx
je 0x7f13
movq (%r15), %rsi
movq %r14, %rdi
callq 0x22b0
testl %eax, %eax
setne %bpl
jmp 0x7f15
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x257e(%rip), %rdx      # 0xa44b
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x7778
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7ef4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x22a0
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
movq 0x28(%rsp), %r14
jmp 0x7f15
xorl %ebp, %ebp
leaq 0x38(%rsp), %rax
cmpq %rax, %r14
je 0x7f2f
movq 0x38(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x22a0
testb %bpl, %bpl
je 0x7f45
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0x8(%rsp), %rdi
callq 0x20f0
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x8(%rsp), %rcx
leaq 0x18(%rsp), %rdx
cmpq %rdx, %rcx
je 0x7f69
movq %rcx, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x7f6f
movups (%rdx), %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
jmp 0x7ef4
xorl %edi, %edi
callq 0x2330
jmp 0x7fb1
jmp 0x7fb1
jmp 0x7fb1
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7fb4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x22a0
jmp 0x7fb4
jmp 0x7fb1
jmp 0x7fb1
jmp 0x7fb1
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7fd0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x22a0
movq %rbx, %rdi
callq 0x24a0