// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
pushq $0xa
popq %rdi
callq 0x3050
xorl %eax, %eax
cmpq $0x4, %rax
je 0x5a3c
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x5a2b
xorl %r12d, %r12d
pushq $0x1
popq %r13
leaq 0x8e3(%rip), %r14       # 0x632d
cmpq $0x8, %r13
je 0x5a8c
movq (%rbx,%r13,8), %r15
testq %r15, %r15
je 0x5a87
cmpb $0x6f, (%r15)
jne 0x5a6d
cmpb $0x6e, 0x1(%r15)
jne 0x5a6d
cmpb $0x0, 0x2(%r15)
je 0x5a87
movq %r15, %rdi
movq %r14, %rsi
callq 0x3180
testl %eax, %eax
je 0x5a87
movslq %r12d, %r12
movq %r15, 0x10(%rsp,%r12,8)
incl %r12d
incq %r13
jmp 0x5a4a
cmpq $0x0, 0x10(%rsp)
je 0x5af9
xorl %r15d, %r15d
callq 0x51fc
movl %eax, %ebx
xorl %ebp, %ebp
cmpl $0x2, %ebp
jg 0x5b0b
cmpq $0x1, %r15
ja 0x5b0b
movslq %ebp, %r12
movq 0x10(%rsp,%r12,8), %r14
testq %r14, %r14
je 0x5b05
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x5765
cmpl $-0x1, %eax
je 0x5ad3
cmpl $-0x2, %eax
jne 0x5aed
jmp 0x5c10
movq 0x18(%rsp,%r12,8), %rdx
movl %ebx, %edi
movq %r14, %rsi
callq 0x5765
cmpl $-0x1, %eax
je 0x5c19
incl %ebp
movl %eax, 0x8(%rsp,%r15,4)
incq %r15
incl %ebp
jmp 0x5aa0
leaq 0x4df9(%rip), %rdi      # 0xa8f9
jmp 0x5bfd
orl $-0x1, 0x8(%rsp,%r15,4)
movl 0x8(%rsp), %ebp
movl 0xc(%rsp), %r14d
leaq 0x8675(%rip), %r15      # 0xe190
leaq 0x863e(%rip), %r12      # 0xe160
leaq 0x3e53(%rip), %r13      # 0x997c
cmpl $-0x1, -0x30(%r15)
je 0x5bf6
cmpl %ebx, -0x24(%r15)
jne 0x5bed
cmpl %ebp, -0x2c(%r15)
jne 0x5bed
cmpl %r14d, -0x28(%r15)
jne 0x5bed
cmpl $0x1, -0x20(%r15)
jne 0x5bed
movl -0x1c(%r15), %eax
cmpq $0x4, %rax
ja 0x5bb6
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movl -0x18(%r15), %esi
movl -0x14(%r15), %edi
movl -0x10(%r15), %edx
callq 0x53f7
jmp 0x5bb6
movl -0x14(%r15), %edi
callq 0x5756
jmp 0x5bb6
movl -0x14(%r15), %edi
movl -0x10(%r15), %esi
callq 0x59fd
jmp 0x5bb6
movl -0x14(%r15), %eax
leaq 0x900b(%rip), %rcx      # 0xebb4
movl %eax, (%rcx)
jmp 0x5bb6
movl -0x14(%r15), %edi
callq 0x59de
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5bc3
callq 0x3090
andl $0x0, -0x20(%r15)
movslq -0xc(%r15), %rax
cmpq $-0x1, %rax
je 0x5be6
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
cmpl $0x1, 0x10(%rax,%r12)
setne %cl
movl %ecx, 0x10(%rax,%r12)
cmpl $0x1, -0x8(%r15)
je 0x5c38
addq $0x38, %r15
jmp 0x5b29
leaq 0x4d06(%rip), %rdi      # 0xa903
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3090
leaq 0x3d06(%rip), %rdi      # 0x991d
jmp 0x5c20
leaq 0x3d70(%rip), %rdi      # 0x9990
movq %r14, %rsi
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30f0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)