// File: magmastonealex[P]fbkeyboard/src/fbkeyboard.cpp
// Function: main
int main(int argc, char** argv) {

	opterr = 0;
	int c;
	
	int width = 0;
	int height = 0;
	int dpi = 0;
	char* tsdev = "";
	char* fbdev = "";
	char* prompt = "";
	bool password = false;

	while ((c = getopt (argc, argv, "w:h:d:t:f:pP:")) != -1)
	switch (c)
	{
		case 'p':
			password = true;
			break;
		case 'P':
			prompt = optarg;
			break;
		case 'f':
			fbdev = optarg;
			break;
		case 't':
			tsdev = optarg;
			break;
		case 'd':
			dpi = std::stoi(std::string(optarg));
			break;
		case 'h':
			height = std::stoi(std::string(optarg));
			break;
		case 'w':
			width = std::stoi(std::string(optarg));
			break;
		case '?':
			std::cerr << "Unknown Arguments" << std::endl;
			return 1;
		default:
			return 3;
	}

	if(width == 0 || height == 0 || dpi == 0 || strlen(tsdev) == 0 || strlen(fbdev) == 0) {
		std::cerr << "Invalid Arguments" << std::endl;
		return 4;
	}

	std::cout << width << height << dpi << tsdev << fbdev << std::endl;

	return run(width, height, dpi, std::string(fbdev), std::string(tsdev), std::string(prompt), password);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x3400(%rip), %rax      # 0x6fd0
movl $0x0, (%rax)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
leaq 0x14ab(%rip), %rax      # 0x509d
movq %rax, -0x28(%rbp)
leaq 0x14a0(%rip), %rax      # 0x509d
movq %rax, -0x30(%rbp)
leaq 0x1495(%rip), %rax      # 0x509d
movq %rax, -0x38(%rbp)
movb $0x0, -0x39(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x1632(%rip), %rdx      # 0x5250
callq 0x2080
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x3ef5
movl -0x14(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x148(%rbp)
subl $0x38, %eax
ja 0x3ee4
movq -0x148(%rbp), %rax
leaq 0x1517(%rip), %rcx      # 0x516c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, -0x39(%rbp)
jmp 0x3ef0
movq 0x3342(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x3ef0
movq 0x332f(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3ef0
movq 0x331c(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3ef0
movq 0x3309(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x158(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x2340
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x4850
jmp 0x3cda
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
movl $0xa, %edx
callq 0x4810
movl %eax, -0x15c(%rbp)
jmp 0x3cf4
movl -0x15c(%rbp), %eax
movl %eax, -0x20(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2120
leaq -0x61(%rbp), %rdi
callq 0x2200
jmp 0x3ef0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3d37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2120
leaq -0x61(%rbp), %rdi
callq 0x2200
jmp 0x418a
movq 0x3264(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x170(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x2340
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0x4850
jmp 0x3d85
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
movl $0xa, %edx
callq 0x4810
movl %eax, -0x174(%rbp)
jmp 0x3da2
movl -0x174(%rbp), %eax
movl %eax, -0x1c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x2120
leaq -0x99(%rbp), %rdi
callq 0x2200
jmp 0x3ef0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3dee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x2120
leaq -0x99(%rbp), %rdi
callq 0x2200
jmp 0x418a
movq 0x31aa(%rip), %rax      # 0x6fb0
movq (%rax), %rax
movq %rax, -0x188(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x2340
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x4850
jmp 0x3e3f
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
movl $0xa, %edx
callq 0x4810
movl %eax, -0x18c(%rbp)
jmp 0x3e5c
movl -0x18c(%rbp), %eax
movl %eax, -0x18(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2120
leaq -0xc1(%rbp), %rdi
callq 0x2200
jmp 0x3ef0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3ea5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2120
leaq -0xc1(%rbp), %rdi
callq 0x2200
jmp 0x418a
movq 0x3133(%rip), %rdi      # 0x6ff0
leaq 0x139a(%rip), %rsi      # 0x525e
callq 0x21b0
movq %rax, %rdi
movq 0x30d5(%rip), %rsi      # 0x6fa8
callq 0x21e0
movl $0x1, -0x4(%rbp)
jmp 0x417e
movl $0x3, -0x4(%rbp)
jmp 0x417e
jmp 0x3c10
cmpl $0x0, -0x18(%rbp)
je 0x3f25
cmpl $0x0, -0x1c(%rbp)
je 0x3f25
cmpl $0x0, -0x20(%rbp)
je 0x3f25
movq -0x28(%rbp), %rdi
callq 0x20e0
cmpq $0x0, %rax
je 0x3f25
movq -0x30(%rbp), %rdi
callq 0x20e0
cmpq $0x0, %rax
jne 0x3f53
movq 0x30c4(%rip), %rdi      # 0x6ff0
leaq 0x133d(%rip), %rsi      # 0x5270
callq 0x21b0
movq %rax, %rdi
movq 0x3066(%rip), %rsi      # 0x6fa8
callq 0x21e0
movl $0x4, -0x4(%rbp)
jmp 0x417e
movl -0x18(%rbp), %esi
movq 0x3063(%rip), %rdi      # 0x6fc0
callq 0x2320
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x2320
movq %rax, %rdi
movl -0x20(%rbp), %esi
callq 0x2320
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
movq 0x300e(%rip), %rsi      # 0x6fa8
callq 0x21e0
movl -0x18(%rbp), %eax
movl %eax, -0x1ac(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x1a8(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x1a4(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x2340
movq -0x1a0(%rbp), %rsi
movq -0x198(%rbp), %rdx
leaq -0xe8(%rbp), %rdi
callq 0x4850
jmp 0x3ff4
movq -0x28(%rbp), %rax
movq %rax, -0x1c0(%rbp)
leaq -0x111(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x2340
movq -0x1c0(%rbp), %rsi
movq -0x1b8(%rbp), %rdx
leaq -0x110(%rbp), %rdi
callq 0x4850
jmp 0x402e
movq -0x38(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x139(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x2340
movq -0x1d0(%rbp), %rsi
movq -0x1c8(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x4850
jmp 0x4068
movl -0x1a4(%rbp), %edx
movl -0x1a8(%rbp), %esi
movl -0x1ac(%rbp), %edi
movzbl -0x39(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, (%rax)
leaq -0xe8(%rbp), %rcx
leaq -0x110(%rbp), %r8
leaq -0x138(%rbp), %r9
callq 0x41a0
movl %eax, -0x1d4(%rbp)
jmp 0x40a8
movl -0x1d4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x2120
leaq -0x139(%rbp), %rdi
callq 0x2200
leaq -0x110(%rbp), %rdi
callq 0x2120
leaq -0x111(%rbp), %rdi
callq 0x2200
leaq -0xe8(%rbp), %rdi
callq 0x2120
leaq -0xe9(%rbp), %rdi
callq 0x2200
jmp 0x417e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4158
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4140
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x2120
leaq -0x139(%rbp), %rdi
callq 0x2200
leaq -0x110(%rbp), %rdi
callq 0x2120
leaq -0x111(%rbp), %rdi
callq 0x2200
leaq -0xe8(%rbp), %rdi
callq 0x2120
leaq -0xe9(%rbp), %rdi
callq 0x2200
jmp 0x418a
movl -0x4(%rbp), %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)