// File: /workspace/github_c_makefile_star2_O1/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 0x4a69(%rip), %r14      # 0xa97c
leaq 0x141f(%rip), %r15      # 0x7339
movq (%rbx,%rbp,8), %r12
testq %r12, %r12
je 0x5f4c
movq %r12, %rdi
movq %r14, %rsi
callq 0x3170
testl %eax, %eax
je 0x5f4c
movq %r12, %rdi
movq %r15, %rsi
callq 0x3170
testl %eax, %eax
je 0x5f4c
movslq %r13d, %r13
movq %r12, 0x10(%rsp,%r13,8)
incl %r13d
incq %rbp
cmpq $0x8, %rbp
jne 0x5f1a
cmpq $0x0, 0x10(%rsp)
je 0x5fc5
xorl %r15d, %r15d
callq 0x5618
movl %eax, %ebx
xorl %ebp, %ebp
movslq %ebp, %r12
movq 0x10(%rsp,%r12,8), %r14
testq %r14, %r14
je 0x5fd1
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x5c0d
cmpl $-0x1, %eax
je 0x5f91
cmpl $-0x2, %eax
jne 0x5fab
jmp 0x60fd
movq 0x18(%rsp,%r12,8), %rdx
movl %ebx, %edi
movq %r14, %rsi
callq 0x5c0d
cmpl $-0x1, %eax
je 0x6106
incl %ebp
movl %eax, 0x8(%rsp,%r15)
cmpl $0x1, %ebp
jg 0x5fda
incl %ebp
leaq 0x4(%r15), %rax
testq %r15, %r15
movq %rax, %r15
je 0x5f69
jmp 0x5fda
leaq 0x591c(%rip), %rdi      # 0xb8e8
jmp 0x60ea
movl $0xffffffff, 0x8(%rsp,%r15) # imm = 0xFFFFFFFF
cmpl $-0x1, 0x916f(%rip)     # 0xf150
je 0x60e3
movl 0x8(%rsp), %ebp
movl 0xc(%rsp), %r14d
leaq 0x915d(%rip), %r12      # 0xf154
leaq 0x9152(%rip), %r15      # 0xf150
leaq 0x4963(%rip), %r13      # 0xa968
cmpl %ebx, 0x8(%r12)
jne 0x60d2
cmpl %ebp, (%r12)
jne 0x60d2
cmpl %r14d, 0x4(%r12)
jne 0x60d2
cmpl $0x1, 0xc(%r12)
jne 0x60d2
movl 0x10(%r12), %eax
cmpq $0x4, %rax
ja 0x6093
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movl 0x14(%r12), %esi
movl 0x18(%r12), %edi
movl 0x1c(%r12), %edx
callq 0x5851
jmp 0x6093
movl 0x18(%r12), %edi
callq 0x5bfe
jmp 0x6093
movl 0x18(%r12), %edi
movl 0x1c(%r12), %esi
callq 0x5ec7
jmp 0x6093
movl 0x18(%r12), %eax
leaq 0x9b1f(%rip), %rcx      # 0xfba4
movl %eax, (%rcx)
jmp 0x6093
movl 0x18(%r12), %edi
callq 0x5ea5
movq 0x2c(%r12), %rdi
testq %rdi, %rdi
je 0x60a2
callq 0x3090
movl $0x0, 0xc(%r12)
movslq 0x20(%r12), %rax
cmpq $-0x1, %rax
je 0x60ca
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
cmpl $0x1, 0x10(%rax,%r15)
setne %cl
movl %ecx, 0x10(%rax,%r15)
cmpl $0x1, 0x24(%r12)
je 0x6125
cmpl $-0x1, 0x34(%r12)
leaq 0x38(%r12), %r12
jne 0x6005
leaq 0x5808(%rip), %rdi      # 0xb8f2
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3090
leaq 0x4805(%rip), %rdi      # 0xa909
jmp 0x610d
leaq 0x4872(%rip), %rdi      # 0xa97f
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 %cs:(%rax,%rax)
nop