// File: /workspace/github_c_makefile_star2_O3/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
movl $0xa, %edi
callq 0x3050
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
xorl %r13d, %r13d
movl $0x1, %ebp
leaq 0x1496(%rip), %r14      # 0x732d
movq (%rbx,%rbp,8), %r15
testq %r15, %r15
je 0x5ece
cmpb $0x6f, (%r15)
jne 0x5eb4
cmpb $0x6e, 0x1(%r15)
jne 0x5eb4
cmpb $0x0, 0x2(%r15)
je 0x5ece
movq %r15, %rdi
movq %r14, %rsi
callq 0x3180
testl %eax, %eax
je 0x5ece
movslq %r13d, %r13
movq %r15, 0x10(%rsp,%r13,8)
incl %r13d
incq %rbp
cmpq $0x8, %rbp
jne 0x5e97
cmpq $0x0, 0x10(%rsp)
je 0x5f6d
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movb $0x1, %bpl
callq 0x55b8
xorl %r13d, %r13d
movl %eax, 0x4(%rsp)
movslq %r13d, %rbx
movq 0x10(%rsp,%rbx,8), %r14
testq %r14, %r14
je 0x5f79
movl %eax, %r12d
movl %eax, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x5b9b
cmpl $-0x1, %eax
je 0x5f25
cmpl $-0x2, %eax
jne 0x5f41
jmp 0x60a9
movq 0x18(%rsp,%rbx,8), %rdx
movl %r12d, %edi
movq %r14, %rsi
callq 0x5b9b
cmpl $-0x1, %eax
je 0x60b2
incl %r13d
movl %eax, (%r15)
cmpl $0x2, %r13d
leal 0x1(%r13), %eax
setl %cl
movl $0x1, %r12d
leaq 0xc(%rsp), %r15
movl %eax, %r13d
testb %bpl, %cl
movl $0x0, %ebp
movl 0x4(%rsp), %eax
jne 0x5efa
jmp 0x5f82
leaq 0x5985(%rip), %rdi      # 0xb8f9
jmp 0x6096
movl $0xffffffff, 0x8(%rsp,%r12,4) # imm = 0xFFFFFFFF
cmpl $-0x1, 0x91d7(%rip)     # 0xf160
je 0x608f
movl 0x8(%rsp), %ebp
movl 0xc(%rsp), %r14d
leaq 0x91c5(%rip), %r12      # 0xf164
leaq 0x91ba(%rip), %r15      # 0xf160
leaq 0x49cf(%rip), %r13      # 0xa97c
leaq 0x9c00(%rip), %rbx      # 0xfbb4
cmpl %eax, 0x8(%r12)
jne 0x607e
cmpl %ebp, (%r12)
jne 0x607e
cmpl %r14d, 0x4(%r12)
jne 0x607e
cmpl $0x1, 0xc(%r12)
jne 0x607e
movl 0x10(%r12), %eax
cmpq $0x4, %rax
ja 0x603b
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movl 0x14(%r12), %esi
movl 0x18(%r12), %edi
movl 0x1c(%r12), %edx
callq 0x57f9
jmp 0x603b
movl 0x18(%r12), %edi
callq 0x5b8c
jmp 0x603b
movl 0x18(%r12), %edi
movl 0x1c(%r12), %esi
callq 0x5e4a
jmp 0x603b
movl 0x18(%r12), %eax
movl %eax, (%rbx)
jmp 0x603b
movl 0x18(%r12), %edi
callq 0x5e28
movq 0x2c(%r12), %rdi
testq %rdi, %rdi
je 0x604a
callq 0x3090
movl $0x0, 0xc(%r12)
movslq 0x20(%r12), %rcx
cmpq $-0x1, %rcx
movl 0x4(%rsp), %eax
je 0x6076
imulq $0x38, %rcx, %rdx
xorl %ecx, %ecx
cmpl $0x1, 0x10(%rdx,%r15)
setne %cl
movl %ecx, 0x10(%rdx,%r15)
cmpl $0x1, 0x24(%r12)
je 0x60d1
cmpl $-0x1, 0x34(%r12)
leaq 0x38(%r12), %r12
jne 0x5fb4
leaq 0x586d(%rip), %rdi      # 0xb903
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3090
leaq 0x486d(%rip), %rdi      # 0xa91d
jmp 0x60b9
leaq 0x48d7(%rip), %rdi      # 0xa990
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