// File: /workspace/github_c_makefile_star2_O0/cglindkamp[P]dfm/src/application.c
// Function: handle_stdin
static void handle_stdin(struct application *app)
{
	wint_t key;
	int ret;

	ret = wget_wch(app->status, &key);
	if(ret == ERR)
		return;

	if(app->mode == MODE_COMMAND) {
		if(ret != KEY_CODE_YES && key == L'\n') {
			app->mode = MODE_NORMAL;
			curs_set(0);
			refresh_statusbar(app);

			const wchar_t *wcommand = commandline_getcommand(&app->commandline);
			char command[wcstombs(NULL, wcommand, 0) + 1];
			wcstombs(command, wcommand, sizeof(command));
			commandexecutor_execute(&app->commandexecutor, command);
			commandline_history_add(&app->commandline, wcommand);
		} else if(ret != KEY_CODE_YES && key == L'\t') {
		} else if(ret != KEY_CODE_YES && key == 27) {
			ret = wget_wch(app->status, &key);
			if(ret == ERR) {
				app->mode = MODE_NORMAL;
				curs_set(0);
				werase(app->status);
				wrefresh(app->status);
				return;
			}
			if(ret != KEY_CODE_YES && key == L'\n')
				insert_current_file_into_commandline(app);
		} else
			commandline_handlekey(&app->commandline, key, ret == KEY_CODE_YES ? true : false);

	} else
		keymap_handlekey(&app->keymap, key, ret == KEY_CODE_YES ? true : false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
leaq -0xc(%rbp), %rsi
callq 0x3720
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x48fe
jmp 0x4ad0
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1bc(%rax)
jne 0x4a9e
cmpl $0x100, -0x10(%rbp)     # imm = 0x100
je 0x49d2
cmpl $0xa, -0xc(%rbp)
jne 0x49d2
movq -0x8(%rbp), %rax
movl $0x0, 0x1bc(%rax)
xorl %edi, %edi
movl %edi, -0x34(%rbp)
callq 0x3140
movq -0x8(%rbp), %rdi
callq 0x5560
movq -0x8(%rbp), %rdi
addq $0xf8, %rdi
callq 0x71c0
movq %rax, %rcx
movl -0x34(%rbp), %eax
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movl %eax, %edx
movq %rdx, %rdi
callq 0x3660
movq %rax, %rdx
incq %rdx
movq %rsp, %rcx
movq %rcx, -0x20(%rbp)
addq $0x10, %rax
andq $-0x10, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, -0x30(%rbp)
movq %rdi, %rsp
movq %rdx, -0x28(%rbp)
movq -0x18(%rbp), %rsi
callq 0x3660
movq -0x30(%rbp), %rsi
movq -0x8(%rbp), %rdi
addq $0x178, %rdi            # imm = 0x178
callq 0x6410
movq -0x8(%rbp), %rdi
addq $0xf8, %rdi
movq -0x18(%rbp), %rsi
callq 0x7240
movq -0x20(%rbp), %rax
movq %rax, %rsp
jmp 0x4a9c
cmpl $0x100, -0x10(%rbp)     # imm = 0x100
je 0x49e6
cmpl $0x9, -0xc(%rbp)
jne 0x49e6
jmp 0x4a9a
cmpl $0x100, -0x10(%rbp)     # imm = 0x100
je 0x4a66
cmpl $0x1b, -0xc(%rbp)
jne 0x4a66
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
leaq -0xc(%rbp), %rsi
callq 0x3720
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x4a4c
movq -0x8(%rbp), %rax
movl $0x0, 0x1bc(%rax)
xorl %edi, %edi
callq 0x3140
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x30e0
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x3390
jmp 0x4ad0
cmpl $0x100, -0x10(%rbp)     # imm = 0x100
je 0x4a64
cmpl $0xa, -0xc(%rbp)
jne 0x4a64
movq -0x8(%rbp), %rdi
callq 0x5ba0
jmp 0x4a98
movq -0x8(%rbp), %rdi
addq $0xf8, %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x100, %edx            # imm = 0x100
cmovel %ecx, %eax
cmpl $0x0, %eax
setne %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x69e0
jmp 0x4a9a
jmp 0x4a9c
jmp 0x4ad0
movq -0x8(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x100, %edx            # imm = 0x100
cmovel %ecx, %eax
cmpl $0x0, %eax
setne %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x8ae0
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)