// File: /workspace/github_cpp_makefile_star2_O1/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 0x5539(%rip), %r12      # 0xd2c8
leaq 0x8(%rsp), %r14
leaq 0x2757(%rip), %r13      # 0xa4f2
testb $0x1, %bpl
jne 0x7ecc
movq %r15, %rdi
callq 0x2170
testl %eax, %eax
je 0x7df4
movl 0x50(%rsp), %eax
cmpl $0x300, %eax            # imm = 0x300
je 0x7dc8
cmpl $0x100, %eax            # imm = 0x100
jne 0x7da5
jmp 0x7fb2
movl 0x64(%rsp), %eax
cmpl $0xd, %eax
je 0x7def
cmpl $0x1b, %eax
je 0x7e82
leal -0x21(%rax), %ecx
cmpl $0x5d, %ecx
ja 0x7da5
movsbl %al, %esi
movq %r14, %rdi
callq 0x21f0
jmp 0x7da5
movb $0x1, %bpl
jmp 0x7da5
callq 0x788d
movl $0xc0b090, %edi         # imm = 0xC0B090
callq 0x8fce
movq %r12, %rdi
movl $0x5a, %esi
movl $0x96, %edx
xorl %ecx, %ecx
leaq 0x26c5(%rip), %r8       # 0xa4de
xorl %eax, %eax
callq 0x926a
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x7ca8
movq 0x28(%rsp), %r9
movq %r12, %rdi
movl $0x64, %esi
movl $0xc8, %edx
xorl %ecx, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x926a
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7e67
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x22a0
movl $0x5, %edi
callq 0x21a0
movq 0x6818(%rip), %rdi      # 0xe690
callq 0x22f0
jmp 0x7d9b
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x25ab(%rip), %rdx      # 0xa43b
movq %rbx, %rdi
movq %rdx, %rsi
leaq 0x18(%rsp), %r14
callq 0x7794
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x7eb7
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
movq 0x10(%rsp), %r14
movb $0x1, %bpl
cmpq $0x6, %r14
jb 0x7f22
leaq -0x5(%r14), %rdx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq $-0x1, %rcx
callq 0x22c0
movq 0x48(%rsp), %r15
movq 0x30(%rsp), %rdx
cmpq 0x8(%r15), %rdx
jne 0x7f27
testq %rdx, %rdx
je 0x7fab
movq (%r15), %rsi
movq 0x28(%rsp), %rdi
callq 0x22b0
testl %eax, %eax
setne %bpl
jmp 0x7f27
movq 0x48(%rsp), %r15
cmpq $0x6, %r14
jb 0x7f49
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7f49
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x22a0
testb %bpl, %bpl
je 0x7f5f
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), %r14
cmpq %r14, %rcx
je 0x7f83
movq %rcx, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x7f8a
movups (%r14), %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r14, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
jmp 0x7ea0
xorl %ebp, %ebp
jmp 0x7f27
xorl %edi, %edi
callq 0x2330
jmp 0x7fe6
jmp 0x7fe6
jmp 0x7fe6
jmp 0x7fe6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7fe9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x22a0
jmp 0x7fe9
jmp 0x7fe6
jmp 0x7fe6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8005
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x22a0
movq %rbx, %rdi
callq 0x24a0