// File: /workspace/github_c_makefile_star2_O0/ethinethin[P]Secret/inter.c
// Function: use
extern void use(char *input[8])
{
	int i;
	int j;
	int room;
	int items[2];
	int cur_phrase;
	char *words[4];

	putchar('\n');

	/* initialize words to null */
	for (i = 0; i < 4; i++)
		words[i] = NULL;

	/* condense input to four words at most */
	for (j = 0, i = 1; i < 8; i++) {
		if (input[i] == NULL ||
			strcmp(input[i],"on") == 0 ||
			strcmp(input[i],"the") == 0) {
			continue;
		} else {
			words[j] = input[i];
			j++;
		}
	}

	/* Make sure something was used */
	if (words[0] == NULL) {
		printf("Use what?\n");
		return;
	}

	/* room id for item information */
	room = room_id();

	/* process word by word */
	for (j = 0, i = 0; i < 3 && j < 2; i++) {
		if (words[i] == NULL) { 
			items[j] = -1;
			break;
		}
		if ((cur_phrase = unique_item(room, NULL, words[i])) == -2) {
			printf("Which %s?\n",words[i]);
			return;
		} else if (cur_phrase == -1) {
			if ((cur_phrase = unique_item(room, words[i], words[i+1])) == -1) {
				printf("There is no %s here.\n",words[i]);
				return;
			}
			i++;
		}
		items[j++] = cur_phrase;
	}

	/* parsed items, now use them */
	interact(room, items[0], items[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl $0xa, %edi
callq 0x3050
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jge 0x72bb
movslq -0xc(%rbp), %rax
movq $0x0, -0x40(%rbp,%rax,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x729d
movl $0x0, -0x10(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0x8, -0xc(%rbp)
jge 0x7345
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x7318
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x47c9(%rip), %rsi      # 0xbaba
callq 0x3150
cmpl $0x0, %eax
je 0x7318
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xece(%rip), %rsi       # 0x81dc
callq 0x3150
cmpl $0x0, %eax
jne 0x731a
jmp 0x733a
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0x10(%rbp), %rax
movq %rcx, -0x40(%rbp,%rax,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x733a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x72c9
cmpq $0x0, -0x40(%rbp)
jne 0x735f
leaq 0x476a(%rip), %rdi      # 0xbabd
movb $0x0, %al
callq 0x30e0
jmp 0x746c
callq 0x6420
movl %eax, -0x14(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
xorl %eax, %eax
cmpl $0x3, -0xc(%rbp)
movb %al, -0x41(%rbp)
jge 0x738a
cmpl $0x2, -0x10(%rbp)
setl %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x7396
jmp 0x745e
movslq -0xc(%rbp), %rax
cmpq $0x0, -0x40(%rbp,%rax,8)
jne 0x73b3
movslq -0x10(%rbp), %rax
movl $0xffffffff, -0x1c(%rbp,%rax,4) # imm = 0xFFFFFFFF
jmp 0x745e
movl -0x14(%rbp), %edi
movslq -0xc(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x6df0
movl %eax, -0x20(%rbp)
cmpl $-0x2, %eax
jne 0x73ec
movslq -0xc(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rsi
leaq 0x46cf(%rip), %rdi      # 0xbaaf
movb $0x0, %al
callq 0x30e0
jmp 0x746c
cmpl $-0x1, -0x20(%rbp)
jne 0x743a
movl -0x14(%rbp), %edi
movslq -0xc(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rsi
movl -0xc(%rbp), %eax
addl $0x1, %eax
cltq
movq -0x40(%rbp,%rax,8), %rdx
callq 0x6df0
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
jne 0x7431
movslq -0xc(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rsi
leaq 0x46a0(%rip), %rdi      # 0xbac8
movb $0x0, %al
callq 0x30e0
jmp 0x746c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x743c
movl -0x20(%rbp), %ecx
movl -0x10(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x10(%rbp)
cltq
movl %ecx, -0x1c(%rbp,%rax,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7375
movl -0x14(%rbp), %edi
movl -0x1c(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x7480
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)