// File: /workspace/github_c_makefile_star2_O0/ethinethin[P]Secret/input.c
// Function: parse_input
static void parse_input(char *line)
{
	int i;
	char allwords[100];
	char *words[8];

	/* copy the line and convert to lowercase */
	for (i = 0; i < 99 && line[i] != '\0'; i++) {
		allwords[i] = line[i];
		if (allwords[i] >= 'A' && allwords[i] <= 'Z')
			allwords[i] = allwords[i] + 'a' - 'A';
	}
	allwords[i] = '\0';

	/* split the line into separate words */
	*words = strtok(allwords, " \n");
	for(i = 1; i < 8; i++)
		*(words+i) = strtok(NULL, " \n");

	/* parse input */
	if (*words == NULL) {
		return;
	}
	
	/* user quit */
	else if (strcmp(*words,"quit") == 0 || strcmp(*words,"exit") == 0 || strcmp(*words,"q") == 0) {
		if (is_okay_quit()) GAME_STATUS = -1;
	}

	/* user help */
	else if (strcmp(*words, "help") == 0 || strcmp(*words, "h") == 0) {
		display_help();
	}

	/* look at room */
	else if (strcmp(*words, "look") == 0 && *(words+1) == NULL) {
		look_room();
	}

	/* move */
	else if (strcmp(*words, "go") == 0 || strcmp(*words, "walk") == 0 || strcmp(*words, "move") == 0) {
		move(*(words+1));
	} else if (strcmp(*words, "north") == 0 || strcmp(*words, "east") == 0 || strcmp(*words, "south") == 0 ||
		strcmp(*words, "west") == 0) {
		move(*words);
	} else if (strcmp(*words, "n") == 0) {
		move("north");
	} else if (strcmp(*words, "e") == 0) {
		move("east");
	} else if (strcmp(*words, "s") == 0) {
		move("south");
	} else if (strcmp(*words, "w") == 0) {
		move("west");
	}

	/* item functions */
	else if (strcmp(*words,"take") == 0 || strcmp(*words,"get") == 0) {
		if (*(words+1) != NULL && strcmp(*(words+1),"the") == 0) {
			take_item(room_id(), *(words+2), *(words+3));
		} else {
			take_item(room_id(), *(words+1), *(words+2));
		}
	} else if (strcmp(*words,"drop") == 0) {
		if (*(words+1) != NULL && strcmp(*(words+1),"the") == 0) {
			drop_item(room_id(), *(words+2), *(words+3));
		} else {
			drop_item(room_id(), *(words+1), *(words+2));
		}
	} else if (strcmp(*words,"search") == 0 || strcmp(*words,"find") == 0) {
		search(room_id());
	} else if (strcmp(*words,"i") == 0 || strcmp(*words,"inventory") == 0 || strcmp(*words,"inv") == 0) {
		list_inv();
	} else if (strcmp(*words,"look") == 0) {
		if (strcmp(*(words+1),"at") == 0) {
			if (*(words+2) != NULL && strcmp(*(words+2),"the") == 0) {
				look_item(room_id(), *(words+3), *(words+4));
			} else {
				look_item(room_id(), *(words+2), *(words+3));
			}
		} else {
			look_item(room_id(), *(words+1), *(words+2));
		}
	}

	/* interactions */
	else if (strcmp(*words,"use") == 0) {
		use(words);
	}

	/* unknown command given */
	else {
		printf("\nUnknown command '%s",*words);
		for (i = 1; i < 4; i++) {
			if (*(words+i) != NULL) printf(" %s",*(words+i));
		}
		printf("'.\n");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x63, -0xc(%rbp)
movb %al, -0xb1(%rbp)
jge 0x378c
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x3798
jmp 0x37f0
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0xc(%rbp), %rax
movb %cl, -0x70(%rbp,%rax)
movslq -0xc(%rbp), %rax
movsbl -0x70(%rbp,%rax), %eax
cmpl $0x41, %eax
jl 0x37e0
movslq -0xc(%rbp), %rax
movsbl -0x70(%rbp,%rax), %eax
cmpl $0x5a, %eax
jg 0x37e0
movslq -0xc(%rbp), %rax
movsbl -0x70(%rbp,%rax), %eax
addl $0x61, %eax
subl $0x41, %eax
movb %al, %cl
movslq -0xc(%rbp), %rax
movb %cl, -0x70(%rbp,%rax)
jmp 0x37e2
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3766
movslq -0xc(%rbp), %rax
movb $0x0, -0x70(%rbp,%rax)
leaq -0x70(%rbp), %rdi
leaq 0x4997(%rip), %rsi      # 0x819b
callq 0x3240
movq %rax, -0xb0(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0x8, -0xc(%rbp)
jge 0x3847
xorl %eax, %eax
movl %eax, %edi
leaq 0x4973(%rip), %rsi      # 0x819b
callq 0x3240
movq %rax, %rcx
movslq -0xc(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3817
cmpq $0x0, -0xb0(%rbp)
jne 0x3856
jmp 0x3d77
movq -0xb0(%rbp), %rdi
leaq 0x493a(%rip), %rsi      # 0x819e
callq 0x3150
cmpl $0x0, %eax
je 0x389e
movq -0xb0(%rbp), %rdi
leaq 0x4927(%rip), %rsi      # 0x81a3
callq 0x3150
cmpl $0x0, %eax
je 0x389e
movq -0xb0(%rbp), %rdi
leaq 0x4914(%rip), %rsi      # 0x81a8
callq 0x3150
cmpl $0x0, %eax
jne 0x38b7
callq 0x3ef0
cmpl $0x0, %eax
je 0x38b2
movl $0xffffffff, 0xd312(%rip) # imm = 0xFFFFFFFF
jmp 0x3d75
movq -0xb0(%rbp), %rdi
leaq 0x48e5(%rip), %rsi      # 0x81aa
callq 0x3150
cmpl $0x0, %eax
je 0x38e7
movq -0xb0(%rbp), %rdi
leaq 0x490d(%rip), %rsi      # 0x81ea
callq 0x3150
cmpl $0x0, %eax
jne 0x38f1
callq 0x3f80
jmp 0x3d73
movq -0xb0(%rbp), %rdi
leaq 0x48b0(%rip), %rsi      # 0x81af
callq 0x3150
cmpl $0x0, %eax
jne 0x391d
cmpq $0x0, -0xa8(%rbp)
jne 0x391d
callq 0x6460
jmp 0x3d71
movq -0xb0(%rbp), %rdi
leaq 0x4889(%rip), %rsi      # 0x81b4
callq 0x3150
cmpl $0x0, %eax
je 0x3965
movq -0xb0(%rbp), %rdi
leaq 0x4874(%rip), %rsi      # 0x81b7
callq 0x3150
cmpl $0x0, %eax
je 0x3965
movq -0xb0(%rbp), %rdi
leaq 0x4861(%rip), %rsi      # 0x81bc
callq 0x3150
cmpl $0x0, %eax
jne 0x3976
movq -0xa8(%rbp), %rdi
callq 0x6570
jmp 0x3d6f
movq -0xb0(%rbp), %rdi
leaq 0x483d(%rip), %rsi      # 0x81c1
callq 0x3150
cmpl $0x0, %eax
je 0x39d6
movq -0xb0(%rbp), %rdi
leaq 0x482b(%rip), %rsi      # 0x81c7
callq 0x3150
cmpl $0x0, %eax
je 0x39d6
movq -0xb0(%rbp), %rdi
leaq 0x6580(%rip), %rsi      # 0x9f34
callq 0x3150
cmpl $0x0, %eax
je 0x39d6
movq -0xb0(%rbp), %rdi
leaq 0x4800(%rip), %rsi      # 0x81cc
callq 0x3150
cmpl $0x0, %eax
jne 0x39e7
movq -0xb0(%rbp), %rdi
callq 0x6570
jmp 0x3d6d
movq -0xb0(%rbp), %rdi
leaq 0x5094(%rip), %rsi      # 0x8a89
callq 0x3150
cmpl $0x0, %eax
jne 0x3a10
leaq 0x47bb(%rip), %rdi      # 0x81c1
callq 0x6570
jmp 0x3d6b
movq -0xb0(%rbp), %rdi
leaq 0x50af(%rip), %rsi      # 0x8acd
callq 0x3150
cmpl $0x0, %eax
jne 0x3a39
leaq 0x4798(%rip), %rdi      # 0x81c7
callq 0x6570
jmp 0x3d69
movq -0xb0(%rbp), %rdi
leaq 0x47d8(%rip), %rsi      # 0x821f
callq 0x3150
cmpl $0x0, %eax
jne 0x3a62
leaq 0x64dc(%rip), %rdi      # 0x9f34
callq 0x6570
jmp 0x3d67
movq -0xb0(%rbp), %rdi
leaq 0x4761(%rip), %rsi      # 0x81d1
callq 0x3150
cmpl $0x0, %eax
jne 0x3a8b
leaq 0x474b(%rip), %rdi      # 0x81cc
callq 0x6570
jmp 0x3d65
movq -0xb0(%rbp), %rdi
leaq 0x473a(%rip), %rsi      # 0x81d3
callq 0x3150
cmpl $0x0, %eax
je 0x3abb
movq -0xb0(%rbp), %rdi
leaq 0x4727(%rip), %rsi      # 0x81d8
callq 0x3150
cmpl $0x0, %eax
jne 0x3b18
cmpq $0x0, -0xa8(%rbp)
je 0x3af9
movq -0xa8(%rbp), %rdi
leaq 0x4709(%rip), %rsi      # 0x81dc
callq 0x3150
cmpl $0x0, %eax
jne 0x3af9
callq 0x6420
movl %eax, %edi
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0x6ab0
jmp 0x3b13
callq 0x6420
movl %eax, %edi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0x6ab0
jmp 0x3d63
movq -0xb0(%rbp), %rdi
leaq 0x46ba(%rip), %rsi      # 0x81e0
callq 0x3150
cmpl $0x0, %eax
jne 0x3b8d
cmpq $0x0, -0xa8(%rbp)
je 0x3b6e
movq -0xa8(%rbp), %rdi
leaq 0x4694(%rip), %rsi      # 0x81dc
callq 0x3150
cmpl $0x0, %eax
jne 0x3b6e
callq 0x6420
movl %eax, %edi
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0x6fb0
jmp 0x3b88
callq 0x6420
movl %eax, %edi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0x6fb0
jmp 0x3d61
movq -0xb0(%rbp), %rdi
leaq 0x464a(%rip), %rsi      # 0x81e5
callq 0x3150
cmpl $0x0, %eax
je 0x3bbd
movq -0xb0(%rbp), %rdi
leaq 0x4639(%rip), %rsi      # 0x81ec
callq 0x3150
cmpl $0x0, %eax
jne 0x3bce
callq 0x6420
movl %eax, %edi
callq 0x6810
jmp 0x3d5f
movq -0xb0(%rbp), %rdi
leaq 0x4615(%rip), %rsi      # 0x81f1
callq 0x3150
cmpl $0x0, %eax
je 0x3c16
movq -0xb0(%rbp), %rdi
leaq 0x45ff(%rip), %rsi      # 0x81f3
callq 0x3150
cmpl $0x0, %eax
je 0x3c16
movq -0xb0(%rbp), %rdi
leaq 0x45f1(%rip), %rsi      # 0x81fd
callq 0x3150
cmpl $0x0, %eax
jne 0x3c20
callq 0x69b0
jmp 0x3d5d
movq -0xb0(%rbp), %rdi
leaq 0x4581(%rip), %rsi      # 0x81af
callq 0x3150
cmpl $0x0, %eax
jne 0x3ccd
movq -0xa8(%rbp), %rdi
leaq 0x45b7(%rip), %rsi      # 0x8201
callq 0x3150
cmpl $0x0, %eax
jne 0x3cae
cmpq $0x0, -0xa0(%rbp)
je 0x3c92
movq -0xa0(%rbp), %rdi
leaq 0x4570(%rip), %rsi      # 0x81dc
callq 0x3150
cmpl $0x0, %eax
jne 0x3c92
callq 0x6420
movl %eax, %edi
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
callq 0x7110
jmp 0x3cac
callq 0x6420
movl %eax, %edi
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0x7110
jmp 0x3cc8
callq 0x6420
movl %eax, %edi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0x7110
jmp 0x3d5b
movq -0xb0(%rbp), %rdi
leaq 0x4529(%rip), %rsi      # 0x8204
callq 0x3150
cmpl $0x0, %eax
jne 0x3cf3
leaq -0xb0(%rbp), %rdi
callq 0x7280
jmp 0x3d59
movq -0xb0(%rbp), %rsi
leaq 0x4507(%rip), %rdi      # 0x8208
movb $0x0, %al
callq 0x30e0
movl $0x1, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jge 0x3d4b
movslq -0xc(%rbp), %rax
cmpq $0x0, -0xb0(%rbp,%rax,8)
je 0x3d3e
movslq -0xc(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %rsi
leaq 0x44e6(%rip), %rdi      # 0x821d
movb $0x0, %al
callq 0x30e0
jmp 0x3d40
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3d0f
leaq 0x44cf(%rip), %rdi      # 0x8221
movb $0x0, %al
callq 0x30e0
jmp 0x3d5b
jmp 0x3d5d
jmp 0x3d5f
jmp 0x3d61
jmp 0x3d63
jmp 0x3d65
jmp 0x3d67
jmp 0x3d69
jmp 0x3d6b
jmp 0x3d6d
jmp 0x3d6f
jmp 0x3d71
jmp 0x3d73
jmp 0x3d75
jmp 0x3d77
addq $0xc0, %rsp
popq %rbp
retq