// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/things.c
// Function: inv_name
char *inv_name(struct object *obj,bool drop)
{
	char *pb, *tn, *pl;
	int wh, knowit;
	char nm[3], *inm, *q;

	wh = obj->o_which;
	knowit = FALSE;
	if (obj->o_count > 1)
		pl = "s";
	else
		pl = "";
	if (obj->o_count > 1)
		sprintf(nm, "%d", obj->o_count);
	else
		strcpy(nm, "A");
	tn = obj->o_typname;
	q = "";
	switch(obj->o_type) {
	case SCROLL:
		sprintf(prbuf, "%s %s%s ", nm, tn, pl);
		pb = &prbuf[strlen(prbuf)];
		if (s_know[wh] || o_on(obj,ISPOST)) {
			knowit = TRUE;
			sprintf(pb, "of %s", s_magic[wh].mi_name);
		}
		else if (s_guess[wh])
			sprintf(pb, "called %s", s_guess[wh]);
		else
			sprintf(pb, "titled '%s'", s_names[wh]);
    when POTION:
		sprintf(prbuf, "%s %s%s ", nm, tn, pl);
		pb = &prbuf[strlen(prbuf)];
		if (p_know[wh] || o_on(obj, ISPOST)) {
			sprintf(pb, "of %s", p_magic[wh].mi_name);
			knowit = TRUE;
			if (p_know[wh]) {
				pb = &prbuf[strlen(prbuf)];
				sprintf(pb,"(%s)",p_colors[wh]);
			}
		}
		else if (p_guess[wh])
			sprintf(pb,"called %s(%s)", p_guess[wh],p_colors[wh]);
		else
			sprintf(prbuf,"%s%s %s %s%s", nm, vowelstr(p_colors[wh]),
				p_colors[wh], tn, pl);
	when FOOD:
		if (wh == 1) {
			if (obj->o_count == 1)
				q = vowelstr(fruit);
			sprintf(prbuf, "%s%s %s%s", nm, q, fruit, pl);
		}
		else {
			if (obj->o_count == 1)
				sprintf(prbuf, "Some %s", tn);
			else
				sprintf(prbuf, "%s rations of %s", nm, tn);
		}
		knowit = TRUE;
	when WEAPON:
		inm = w_magic[wh].mi_name;
		strcpy(prbuf, nm);
		if (obj->o_count == 1)
			q = vowelstr(inm);
		pb = &prbuf[strlen(prbuf)];
		if (o_on(obj,ISKNOW | ISPOST)) {
			knowit = TRUE;
			sprintf(pb, " %s %s", num(obj->o_hplus, obj->o_dplus), inm);
		}
		else
			sprintf(pb, "%s %s", q, inm);
		strcat(prbuf, pl);
	when ARMOR:
		inm = a_magic[wh].mi_name;
		if (o_on(obj,ISKNOW | ISPOST)) {
			knowit = TRUE;
			sprintf(prbuf, "%s %s",num(armors[wh].a_class - obj->o_ac, 0),
				inm);
		}
		else
			sprintf(prbuf, "%s", inm);
	when AMULET:
		strcpy(prbuf, "The Amulet of Yendor");
	when STICK: {
		struct rod *rd;

		rd = &ws_stuff[wh];
		sprintf(prbuf, "A %s ", rd->ws_type);
		pb = &prbuf[strlen(prbuf)];
		if (ws_know[wh] || o_on(obj, ISPOST)) {
			knowit = TRUE;
			sprintf(pb,"of %s%s",ws_magic[wh].mi_name,charge_str(obj));
			if (ws_know[wh]) {
				pb = &prbuf[strlen(prbuf)];
				sprintf(pb,"(%s)",rd->ws_made);
			}
		}
		else if (ws_guess[wh])
			sprintf(pb, "called %s(%s)", ws_guess[wh], rd->ws_made);
		else
			sprintf(prbuf, "A%s %s %s", vowelstr(rd->ws_made),
				rd->ws_made, rd->ws_type);
	}
    when RING:
		if (r_know[wh] || o_on(obj, ISPOST)) {
			knowit = TRUE;
			sprintf(prbuf, "A%s %s of %s", ring_num(obj), tn,
			  r_magic[wh].mi_name);
			if (r_know[wh]) {
				pb = &prbuf[strlen(prbuf)];
				sprintf(pb,"(%s)", r_stones[wh]);
			}
		}
		else if (r_guess[wh])
			sprintf(prbuf,"A %s called %s(%s)",tn, r_guess[wh],
				r_stones[wh]);
		else
			sprintf(prbuf,"A%s %s %s",vowelstr(r_stones[wh]), 
				r_stones[wh], tn);
	otherwise:
		sprintf(prbuf,"Something bizarre %s", unctrl(obj->o_type));
	}
	if (obj == cur_armor)
		strcat(prbuf, " (being worn)");
	if (obj == cur_weapon)
		strcat(prbuf, " (weapon in hand)");
	if (obj == cur_ring[LEFT])
		strcat(prbuf, " (on left hand)");
	else if (obj == cur_ring[RIGHT])
		strcat(prbuf, " (on right hand)");
	if (drop && isupper(prbuf[0]))
		prbuf[0] = tolower(prbuf[0]);
	else if (!drop && islower(*prbuf))
		*prbuf = toupper(*prbuf);
	if (o_on(obj, ISPROT))
		strcat(prbuf, " [!]");
	if (o_on(obj, ISPOST))
		strcat(prbuf, " [$]");
	if (knowit) {
		if (o_on(obj, ISCURSED))
			strcat(prbuf, " [-]");
		else if (o_on(obj, ISBLESS))
			strcat(prbuf, " [+]");
	}
	if (!drop)
		strcat(prbuf, ".");
	return prbuf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0xc(%rsp)
movq %rdi, %r14
movslq 0x28(%rdi), %r12
movl 0x24(%rdi), %edx
leaq 0x4b22(%rip), %r15      # 0x1f5e9
leaq 0x8e43(%rip), %r13      # 0x23911
cmpl $0x2, %edx
cmovlq %r13, %r15
jl 0x1aaec
leaq 0x4904(%rip), %rsi      # 0x1f3e2
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x64f0
jmp 0x1aaf3
movw $0x41, 0x8(%rsp)
movq 0x18(%r14), %rbp
movl 0x20(%r14), %edi
cmpl $0x39, %edi
jg 0x1ab59
cmpl $0x2b, %edi
jg 0x1ac03
cmpl $0x21, %edi
je 0x1ad5d
cmpl $0x29, %edi
jne 0x1aeda
shlq $0x4, %r12
leaq 0x1146a(%rip), %rax     # 0x2bf90
movq (%rax,%r12), %r12
leaq 0x1335f(%rip), %rbp     # 0x2de90
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0x60e0
cmpl $0x1, 0x24(%r14)
jne 0x1af34
movq %r12, %rdi
callq 0xd320
movq %rax, %rbx
jmp 0x1af3b
cmpl $0x3e, %edi
jg 0x1acd7
cmpl $0x3a, %edi
je 0x1ae0f
cmpl $0x3d, %edi
jne 0x1aeda
leaq 0x158a5(%rip), %r15     # 0x30420
cmpb $0x0, (%r15,%r12)
jne 0x1ab97
movl $0x4, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1afed
movq %r14, %rdi
callq 0x12bb3
movq %r12, %rcx
shlq $0x4, %rcx
leaq 0x11a63(%rip), %rdx     # 0x2c610
movq (%rdx,%rcx), %r8
leaq 0x132d8(%rip), %rbx     # 0x2de90
leaq 0x88dc(%rip), %rsi      # 0x2349b
movq %rbp, %rcx
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x64f0
cmpb $0x1, (%r15,%r12)
jne 0x1b10d
movq %rbx, %rdi
callq 0x6170
addq %rax, %rbx
leaq 0x15ab2(%rip), %rax     # 0x306a0
movq (%rax,%r12,8), %rdx
leaq 0x88bd(%rip), %rsi      # 0x234b6
xorl %ebp, %ebp
movq %rbx, %rdi
jmp 0x1af14
cmpl $0x2c, %edi
je 0x1ae5f
cmpl $0x2f, %edi
jne 0x1aeda
leaq (%r12,%r12,2), %rax
leaq 0x15b50(%rip), %rcx     # 0x30770
leaq (%rcx,%rax,8), %rbx
movq (%rbx), %rdx
leaq 0x13262(%rip), %r15     # 0x2de90
leaq 0x884e(%rip), %rsi      # 0x23483
movq %r15, %rdi
xorl %eax, %eax
callq 0x64f0
movq %r15, %rdi
callq 0x6170
movq %rax, %r13
addq %r15, %r13
leaq 0x157ec(%rip), %rax     # 0x30440
cmpb $0x0, (%rax,%r12)
jne 0x1ac70
movl $0x4, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b022
movq %rbx, 0x10(%rsp)
movq %r12, %rax
shlq $0x4, %rax
leaq 0x11b3d(%rip), %rcx     # 0x2c7c0
movq (%rcx,%rax), %rbx
movq %r14, %rdi
callq 0x1aa57
leaq 0x87f3(%rip), %rsi      # 0x23489
xorl %ebp, %ebp
movq %r13, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x64f0
leaq 0x15791(%rip), %rax     # 0x30440
cmpb $0x1, (%rax,%r12)
jne 0x1b10d
movq %r15, %rdi
callq 0x6170
addq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x87e1(%rip), %rsi      # 0x234b6
jmp 0x1ad53
cmpl $0x5d, %edi
je 0x1ae83
cmpl $0x3f, %edi
jne 0x1aeda
leaq 0x131a0(%rip), %rbx     # 0x2de90
leaq 0x873d(%rip), %rsi      # 0x23434
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x64f0
movq %rbx, %rdi
callq 0x6170
movq %rax, %r15
addq %rbx, %r15
leaq 0x156bf(%rip), %rax     # 0x303e0
cmpb $0x0, (%rax,%r12)
jne 0x1ad3d
movl $0x4, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b050
shlq $0x4, %r12
leaq 0x115b8(%rip), %rax     # 0x2c300
movq (%rax,%r12), %rdx
leaq 0x874f(%rip), %rsi      # 0x234a2
xorl %ebp, %ebp
movq %r15, %rdi
jmp 0x1af14
leaq 0x1312c(%rip), %r13     # 0x2de90
leaq 0x86c9(%rip), %rsi      # 0x23434
leaq 0x8(%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x64f0
movq %r13, %rdi
callq 0x6170
movq %rax, %rbx
addq %r13, %rbx
leaq 0x1566b(%rip), %rax     # 0x30400
cmpb $0x0, (%rax,%r12)
jne 0x1adb1
movl $0x4, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1afa7
movq %r12, %rax
shlq $0x4, %rax
leaq 0x116f1(%rip), %rcx     # 0x2c4b0
movq (%rcx,%rax), %rdx
leaq 0x86d8(%rip), %rsi      # 0x234a2
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64f0
leaq 0x15623(%rip), %rax     # 0x30400
cmpb $0x1, (%rax,%r12)
jne 0x1b10d
movq %r13, %rdi
callq 0x6170
addq %rax, %r13
leaq 0x157f6(%rip), %rax     # 0x305f0
movq (%rax,%r12,8), %rdx
leaq 0x86b1(%rip), %rsi      # 0x234b6
xorl %ebp, %ebp
movq %r13, %rdi
jmp 0x1af14
movl 0x24(%r14), %eax
cmpl $0x1, %r12d
jne 0x1aef5
cmpl $0x1, %eax
jne 0x1ae31
leaq 0x13107(%rip), %rdi     # 0x2df30
callq 0xd320
movq %rax, %r13
leaq 0x13058(%rip), %rdi     # 0x2de90
leaq 0x8621(%rip), %rsi      # 0x23460
leaq 0x130ea(%rip), %r8      # 0x2df30
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10d
movups 0x46bb(%rip), %xmm0     # 0x1f521
leaq 0x13023(%rip), %rax     # 0x2de90
movups %xmm0, (%rax)
movabsq $0x726f646e655920, %rcx # imm = 0x726F646E655920
movq %rcx, 0xd(%rax)
jmp 0x1b10a
movq %r12, %rax
shlq $0x4, %rax
leaq 0x10fcf(%rip), %rcx     # 0x2be60
movq (%rcx,%rax), %rbx
movl $0x6, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1af20
leaq (%r12,%r12,2), %rax
leaq 0x1105f(%rip), %rcx     # 0x2bf10
movl (%rcx,%rax,4), %edi
subl 0x34(%r14), %edi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x1cd29
leaq 0x12fc8(%rip), %rdi     # 0x2de90
leaq 0x85c6(%rip), %rsi      # 0x23495
movq %rax, %rdx
movq %rbx, %rcx
jmp 0x1afe1
callq 0x6420
leaq 0x12faa(%rip), %rdi     # 0x2de90
leaq 0x85ce(%rip), %rsi      # 0x234bb
movq %rax, %rdx
jmp 0x1b103
movq %rbp, %rcx
leaq 0x12f91(%rip), %rdi     # 0x2de90
cmpl $0x1, %eax
jne 0x1afd3
leaq 0x855b(%rip), %rsi      # 0x2346a
xorl %ebp, %ebp
movq %rcx, %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10d
leaq 0x12f69(%rip), %rdi     # 0x2de90
movq %rbx, %rsi
callq 0x60e0
jmp 0x1b10a
leaq 0x89d6(%rip), %rbx      # 0x23911
movq %rbp, %rdi
callq 0x6170
movq %rax, %r13
addq %rbp, %r13
movl $0x6, %esi
movq %r14, %rdi
callq 0x95b3
movl %eax, %ebp
testb %al, %al
je 0x1af78
movl 0x2c(%r14), %edi
movl 0x30(%r14), %esi
callq 0x1cd29
leaq 0x8524(%rip), %rsi      # 0x23494
movq %r13, %rdi
movq %rax, %rdx
jmp 0x1af85
leaq 0x8516(%rip), %rsi      # 0x23495
movq %r13, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x64f0
xorb $0x1, %bpl
leaq 0x12ef6(%rip), %rdi     # 0x2de90
movq %r15, %rsi
callq 0x64d0
jmp 0x1b10d
leaq 0x151e2(%rip), %rax     # 0x30190
movq (%rax,%r12,8), %rdx
leaq 0x15637(%rip), %r13     # 0x305f0
movq (%r13,%r12,8), %rcx
testq %rdx, %rdx
je 0x1b070
leaq 0x84df(%rip), %rsi      # 0x234ad
movq %rbx, %rdi
jmp 0x1b044
leaq 0x8498(%rip), %rsi      # 0x23472
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10d
leaq 0x1524c(%rip), %rax     # 0x30240
movq (%rax,%r12,8), %rcx
leaq 0x156a1(%rip), %rbx     # 0x306a0
movq (%rbx,%r12,8), %r8
testq %rcx, %rcx
je 0x1b0a3
leaq 0x12e7d(%rip), %rdi     # 0x2de90
leaq 0x848e(%rip), %rsi      # 0x234a8
movq %rbp, %rdx
jmp 0x1b0e5
leaq 0x152e7(%rip), %rax     # 0x30310
movq (%rax,%r12,8), %rdx
movq 0x8(%rbx), %rcx
testq %rdx, %rdx
je 0x1b0c5
leaq 0x846c(%rip), %rsi      # 0x234ad
movq %r13, %rdi
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10a
leaq 0x15069(%rip), %rax     # 0x300c0
movq (%rax,%r12,8), %rdx
testq %rdx, %rdx
je 0x1b0ee
leaq 0x83d2(%rip), %rsi      # 0x2343d
jmp 0x1b100
movq %rcx, %rdi
callq 0xd320
movq (%r13,%r12,8), %r8
movq %r15, (%rsp)
leaq 0x12e08(%rip), %rdi     # 0x2de90
leaq 0x83c4(%rip), %rsi      # 0x23453
leaq 0x8(%rsp), %rdx
movq %rax, %rcx
movq %rbp, %r9
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10a
movq %r8, %rdi
callq 0xd320
movq (%rbx,%r12,8), %rcx
leaq 0x12dda(%rip), %rdi     # 0x2de90
leaq 0x83d4(%rip), %rsi      # 0x23491
movq %rax, %rdx
movq %rbp, %r8
jmp 0x1b0e5
movq %rcx, %rdi
callq 0xd320
movq (%rbx), %r8
movq 0x8(%rbx), %rcx
leaq 0x12db5(%rip), %rdi     # 0x2de90
leaq 0x83af(%rip), %rsi      # 0x23491
movq %rax, %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b10a
leaq 0x1542b(%rip), %rax     # 0x30520
movq (%rax,%r12,8), %rdx
leaq 0x8347(%rip), %rsi      # 0x23447
movq %r15, %rdi
xorl %eax, %eax
callq 0x64f0
movb $0x1, %bpl
leaq 0x12744(%rip), %rax     # 0x2d858
cmpq %r14, (%rax)
jne 0x1b145
leaq 0x12d70(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movabsq $0x20676e6965622820, %rcx # imm = 0x20676E6965622820
movq %rcx, (%rbx,%rax)
movabsq $0x296e726f772067, %rcx # imm = 0x296E726F772067
movq %rcx, 0x6(%rbx,%rax)
leaq 0x12704(%rip), %rax     # 0x2d850
cmpq %r14, (%rax)
movl 0xc(%rsp), %r15d
jne 0x1b177
leaq 0x12d33(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x8372(%rip), %xmm0     # 0x234de
movups %xmm0, (%rbx,%rax)
movw $0x29, 0x10(%rbx,%rax)
leaq 0x12bd2(%rip), %rax     # 0x2dd50
cmpq %r14, (%rax)
je 0x1b1aa
cmpq %r14, 0x8(%rax)
jne 0x1b1c4
leaq 0x12d00(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x8361(%rip), %xmm0     # 0x23500
movups %xmm0, (%rbx,%rax)
movb $0x0, 0x10(%rbx,%rax)
jmp 0x1b1c4
leaq 0x12cdf(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x8330(%rip), %xmm0     # 0x234f0
movups %xmm0, (%rbx,%rax)
testb %r15b, %r15b
je 0x1b1e8
callq 0x65b0
movq (%rax), %rax
leaq 0x12cb8(%rip), %rcx     # 0x2de90
movsbq (%rcx), %rbx
testb $0x1, 0x1(%rax,%rbx,2)
jne 0x1b209
testb %r15b, %r15b
jne 0x1b21d
callq 0x65b0
movq (%rax), %rax
leaq 0x12c99(%rip), %rcx     # 0x2de90
movsbq (%rcx), %rbx
testb $0x2, 0x1(%rax,%rbx,2)
je 0x1b21d
callq 0x6030
jmp 0x1b20e
callq 0x65a0
movq (%rax), %rax
movb (%rax,%rbx,4), %al
leaq 0x12c75(%rip), %rcx     # 0x2de90
movb %al, (%rcx)
movl $0x10, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b249
leaq 0x12c5b(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movl $0x5d215b20, (%rbx,%rax) # imm = 0x5D215B20
movb $0x0, 0x4(%rbx,%rax)
movl $0x4, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b275
leaq 0x12c2f(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movl $0x5d245b20, (%rbx,%rax) # imm = 0x5D245B20
movb $0x0, 0x4(%rbx,%rax)
testb %bpl, %bpl
jne 0x1b2cf
movl $0x1, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b2a3
leaq 0x12bfe(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movl $0x5d2d5b20, (%rbx,%rax) # imm = 0x5D2D5B20
jmp 0x1b2ca
movl $0x20, %esi
movq %r14, %rdi
callq 0x95b3
testb %al, %al
je 0x1b2cf
leaq 0x12bd5(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movl $0x5d2b5b20, (%rbx,%rax) # imm = 0x5D2B5B20
movb $0x0, 0x4(%rbx,%rax)
testb %r15b, %r15b
jne 0x1b2e9
leaq 0x12bb5(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movw $0x2e, (%rbx,%rax)
leaq 0x12ba0(%rip), %rax     # 0x2de90
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq