// File: /workspace/github_cpp_makefile_star2_O2/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, 0x28(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, 0x20(%rsp)
movb $0x0, (%rax)
xorl %ebx, %ebx
leaq 0x50(%rsp), %r15
movq %rsp, %r12
leaq 0x5e12(%rip), %r13      # 0xd2e8
leaq 0x30(%rsp), %rbp
movl %ebx, %r14d
movq %r15, %rdi
callq 0x3190
testl %eax, %eax
setne %bl
je 0x752b
movl 0x50(%rsp), %eax
cmpl $0x300, %eax            # imm = 0x300
je 0x7504
cmpl $0x100, %eax            # imm = 0x100
jne 0x74de
jmp 0x7672
movl 0x64(%rsp), %eax
cmpl $0xd, %eax
je 0x74db
cmpl $0x1b, %eax
je 0x761c
leal -0x21(%rax), %ecx
cmpl $0x5d, %ecx
ja 0x74de
movsbl %al, %esi
movq %r12, %rdi
callq 0x3220
jmp 0x74de
callq 0x7123
movl $0xc0b090, %edi         # imm = 0xC0B090
callq 0x86c4
movq %r13, %rdi
pushq $0x5a
popq %rsi
movl $0x96, %edx
xorl %ecx, %ecx
leaq 0x1f90(%rip), %r8       # 0x94de
xorl %eax, %eax
callq 0x88c6
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7415
movq 0x30(%rsp), %r9
movq %r13, %rdi
pushq $0x64
popq %rsi
movl $0xc8, %edx
xorl %ecx, %ecx
leaq 0x1f79(%rip), %r8       # 0x94f2
xorl %eax, %eax
callq 0x88c6
movq %rbp, %rdi
callq 0x3140
pushq $0x5
popq %rdi
callq 0x31c0
movq 0x7129(%rip), %rdi      # 0xe6c0
callq 0x3310
testb $0x1, %r14b
je 0x74db
movq 0x8(%rsp), %rdx
cmpq $0x6, %rdx
movq 0x28(%rsp), %rbx
jb 0x75e9
addq $-0x5, %rdx
leaq 0x30(%rsp), %rdi
movq %rsp, %rsi
pushq $-0x1
popq %rcx
callq 0x32e0
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7e1d
movl %eax, %ebp
movq %r14, %rdi
callq 0x3140
testb %bpl, %bpl
je 0x75f4
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x3520
movq 0x20(%rsp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsp), %rcx
leaq 0x10(%rsp), %rdx
cmpq %rdx, %rcx
je 0x7652
movq %rcx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x7658
leaq 0x1e18(%rip), %rsi      # 0x943b
leaq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x6fea
movq %rsp, %rdi
callq 0x3140
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movups (%rdx), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %rdx, (%rsp)
andq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
jmp 0x7635
xorl %edi, %edi
callq 0x3350
jmp 0x7694
jmp 0x7694
jmp 0x7694
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3140
jmp 0x7697
jmp 0x7694
jmp 0x7694
jmp 0x7694
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x34d0