// File: /workspace/github_c_makefile_star2_O2/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 0x453a(%rip), %r15      # 0x1d5e9
leaq 0x88d3(%rip), %r13      # 0x21989
cmpl $0x2, %edx
cmovlq %r13, %r15
jl 0x190d4
leaq 0x431c(%rip), %rsi      # 0x1d3e2
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x64d0
jmp 0x190db
movw $0x41, 0x8(%rsp)
movq 0x18(%r14), %rbp
movl 0x20(%r14), %edi
cmpl $0x21, %edi
je 0x1941b
cmpl $0x29, %edi
je 0x192ce
cmpl $0x2c, %edi
je 0x193f7
cmpl $0x2f, %edi
je 0x1932e
cmpl $0x3a, %edi
je 0x19198
cmpl $0x3d, %edi
je 0x19241
cmpl $0x5d, %edi
je 0x191e8
cmpl $0x3f, %edi
jne 0x1930c
leaq 0x14d4e(%rip), %rbx     # 0x2de80
leaq 0x8373(%rip), %rsi      # 0x214ac
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x64d0
movq %rbx, %rdi
callq 0x6170
movq %rax, %r15
addq %rbx, %r15
leaq 0x1726d(%rip), %rax     # 0x303d0
cmpb $0x0, (%rax,%r12)
jne 0x1917d
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x195c7
shlq $0x4, %r12
leaq 0x13168(%rip), %rax     # 0x2c2f0
movq (%rax,%r12), %rdx
leaq 0x8387(%rip), %rsi      # 0x2151a
jmp 0x193ed
movl 0x24(%r14), %eax
cmpl $0x1, %r12d
jne 0x194c8
cmpl $0x1, %eax
jne 0x191ba
leaq 0x14d6e(%rip), %rdi     # 0x2df20
callq 0xcb3d
movq %rax, %r13
leaq 0x14cbf(%rip), %rdi     # 0x2de80
leaq 0x8310(%rip), %rsi      # 0x214d8
leaq 0x14d51(%rip), %r8      # 0x2df20
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
xorl %eax, %eax
callq 0x64d0
jmp 0x196d2
movq %r12, %rax
shlq $0x4, %rax
leaq 0x12c5a(%rip), %rcx     # 0x2be50
movq (%rcx,%rax), %rbx
pushq $0x6
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x194f3
imulq $0xc, %r12, %rax
leaq 0x12ce8(%rip), %rcx     # 0x2bf00
movl (%rcx,%rax), %edi
subl 0x34(%r14), %edi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x1b0b2
leaq 0x14c51(%rip), %rdi     # 0x2de80
leaq 0x82d7(%rip), %rsi      # 0x2150d
movq %rax, %rdx
movq %rbx, %rcx
jmp 0x19586
leaq 0x171c8(%rip), %r15     # 0x30410
cmpb $0x0, (%r15,%r12)
jne 0x19262
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19592
movq %r14, %rdi
callq 0x11dc9
movq %r12, %rcx
shlq $0x4, %rcx
leaq 0x13388(%rip), %rdx     # 0x2c600
movq (%rdx,%rcx), %r8
leaq 0x14bfd(%rip), %rbx     # 0x2de80
leaq 0x8289(%rip), %rsi      # 0x21513
movq %rbp, %rcx
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x64d0
cmpb $0x1, (%r15,%r12)
jne 0x196d2
movq %rbx, %rdi
callq 0x6170
addq %rax, %rbx
leaq 0x173d7(%rip), %rax     # 0x30690
movq (%rax,%r12,8), %rdx
leaq 0x826a(%rip), %rsi      # 0x2152e
xorl %ebp, %ebp
movq %rbx, %rdi
jmp 0x194e7
shlq $0x4, %r12
leaq 0x12ca7(%rip), %rax     # 0x2bf80
movq (%rax,%r12), %r12
leaq 0x14b9c(%rip), %rbp     # 0x2de80
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0x60e0
cmpl $0x1, 0x24(%r14)
jne 0x19507
movq %r12, %rdi
callq 0xcb3d
movq %rax, %rbx
jmp 0x1950e
callq 0x6400
leaq 0x14b68(%rip), %rdi     # 0x2de80
leaq 0x8214(%rip), %rsi      # 0x21533
movq %rax, %rdx
xorl %eax, %eax
callq 0x64d0
jmp 0x196cf
imulq $0x18, %r12, %rax
leaq 0x17427(%rip), %rcx     # 0x30760
leaq (%rcx,%rax), %rbx
movq (%rcx,%rax), %rdx
leaq 0x14b38(%rip), %r15     # 0x2de80
leaq 0x81ac(%rip), %rsi      # 0x214fb
movq %r15, %rdi
xorl %eax, %eax
callq 0x64d0
movq %r15, %rdi
callq 0x6170
movq %rax, %r13
addq %r15, %r13
leaq 0x170c2(%rip), %rax     # 0x30430
cmpb $0x0, (%rax,%r12)
jne 0x19388
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x195e7
movq %rbx, 0x10(%rsp)
movq %r12, %rax
shlq $0x4, %rax
leaq 0x13415(%rip), %rcx     # 0x2c7b0
movq (%rcx,%rax), %rbx
movq %r14, %rdi
callq 0x19042
leaq 0x8153(%rip), %rsi      # 0x21501
xorl %ebp, %ebp
movq %r13, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x64d0
leaq 0x17069(%rip), %rax     # 0x30430
cmpb $0x1, (%rax,%r12)
jne 0x196d2
movq %r15, %rdi
callq 0x6170
addq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x8141(%rip), %rsi      # 0x2152e
xorl %ebp, %ebp
movq %r15, %rdi
jmp 0x194e7
movups 0x4123(%rip), %xmm0     # 0x1d521
leaq 0x14a7b(%rip), %rax     # 0x2de80
movups %xmm0, (%rax)
movabsq $0x726f646e655920, %rcx # imm = 0x726F646E655920
movq %rcx, 0xd(%rax)
jmp 0x196cf
leaq 0x14a5e(%rip), %r13     # 0x2de80
leaq 0x8083(%rip), %rsi      # 0x214ac
leaq 0x8(%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x64d0
movq %r13, %rdi
callq 0x6170
movq %rax, %rbx
addq %r13, %rbx
leaq 0x16f9d(%rip), %rax     # 0x303f0
cmpb $0x0, (%rax,%r12)
jne 0x1946d
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19607
movq %r12, %rax
shlq $0x4, %rax
leaq 0x13025(%rip), %rcx     # 0x2c4a0
movq (%rcx,%rax), %rdx
leaq 0x8094(%rip), %rsi      # 0x2151a
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64d0
leaq 0x16f57(%rip), %rax     # 0x303f0
cmpb $0x1, (%rax,%r12)
jne 0x196d2
movq %r13, %rdi
callq 0x6170
addq %rax, %r13
leaq 0x1712a(%rip), %rax     # 0x305e0
movq (%rax,%r12,8), %rdx
leaq 0x806d(%rip), %rsi      # 0x2152e
xorl %ebp, %ebp
movq %r13, %rdi
jmp 0x194e7
movq %rbp, %rcx
leaq 0x149ae(%rip), %rdi     # 0x2de80
cmpl $0x1, %eax
jne 0x19578
leaq 0x8000(%rip), %rsi      # 0x214e2
xorl %ebp, %ebp
movq %rcx, %rdx
xorl %eax, %eax
callq 0x64d0
jmp 0x196d2
leaq 0x14986(%rip), %rdi     # 0x2de80
movq %rbx, %rsi
callq 0x60e0
jmp 0x196cf
leaq 0x847b(%rip), %rbx      # 0x21989
movq %rbp, %rdi
callq 0x6170
movq %rax, %r13
addq %rbp, %r13
pushq $0x6
popq %rsi
movq %r14, %rdi
callq 0x934a
movl %eax, %ebp
testb %al, %al
je 0x19549
movl 0x2c(%r14), %edi
movl 0x30(%r14), %esi
callq 0x1b0b2
leaq 0x7fcb(%rip), %rsi      # 0x2150c
movq %r13, %rdi
movq %rax, %rdx
jmp 0x19556
leaq 0x7fbd(%rip), %rsi      # 0x2150d
movq %r13, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x64d0
xorb $0x1, %bpl
leaq 0x14915(%rip), %rdi     # 0x2de80
movq %r15, %rsi
callq 0x64b0
jmp 0x196d2
leaq 0x7f6b(%rip), %rsi      # 0x214ea
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x64d0
jmp 0x196d2
leaq 0x16c97(%rip), %rax     # 0x30230
movq (%rax,%r12,8), %rcx
leaq 0x170ec(%rip), %rbx     # 0x30690
movq (%rbx,%r12,8), %r8
testq %rcx, %rcx
je 0x19639
leaq 0x148c8(%rip), %rdi     # 0x2de80
leaq 0x7f61(%rip), %rsi      # 0x21520
movq %rbp, %rdx
jmp 0x19695
leaq 0x16ae2(%rip), %rax     # 0x300b0
movq (%rax,%r12,8), %rdx
testq %rdx, %rdx
je 0x1965b
leaq 0x7ed3(%rip), %rsi      # 0x214b5
jmp 0x1966d
leaq 0x16d12(%rip), %rax     # 0x30300
movq (%rax,%r12,8), %rdx
movq 0x8(%rbx), %rcx
testq %rdx, %rdx
je 0x19675
leaq 0x7f23(%rip), %rsi      # 0x21525
movq %r13, %rdi
jmp 0x1962d
leaq 0x16b72(%rip), %rax     # 0x30180
movq (%rax,%r12,8), %rdx
leaq 0x16fc7(%rip), %r13     # 0x305e0
movq (%r13,%r12,8), %rcx
testq %rdx, %rdx
je 0x1969e
leaq 0x7efb(%rip), %rsi      # 0x21525
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64d0
jmp 0x196cf
movq %r8, %rdi
callq 0xcb3d
movq (%rbx,%r12,8), %rcx
leaq 0x14834(%rip), %rdi     # 0x2de80
leaq 0x7eb6(%rip), %rsi      # 0x21509
movq %rax, %rdx
movq %rbp, %r8
jmp 0x19695
leaq 0x16eae(%rip), %rax     # 0x30510
movq (%rax,%r12,8), %rdx
leaq 0x7e52(%rip), %rsi      # 0x214bf
movq %r15, %rdi
jmp 0x19322
movq %rcx, %rdi
callq 0xcb3d
movq (%rbx), %r8
movq 0x8(%rbx), %rcx
leaq 0x147f5(%rip), %rdi     # 0x2de80
leaq 0x7e77(%rip), %rsi      # 0x21509
movq %rax, %rdx
xorl %eax, %eax
callq 0x64d0
jmp 0x196cf
movq %rcx, %rdi
callq 0xcb3d
movq (%r13,%r12,8), %r8
movq %r15, (%rsp)
leaq 0x147ca(%rip), %rdi     # 0x2de80
leaq 0x7e0e(%rip), %rsi      # 0x214cb
leaq 0x8(%rsp), %rdx
movq %rax, %rcx
movq %rbp, %r9
xorl %eax, %eax
callq 0x64d0
movb $0x1, %bpl
leaq 0x1416f(%rip), %rax     # 0x2d848
cmpq %r14, (%rax)
jne 0x1970a
leaq 0x1479b(%rip), %rbx     # 0x2de80
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 0x1412f(%rip), %rax     # 0x2d840
cmpq %r14, (%rax)
movl 0xc(%rsp), %r12d
jne 0x1973c
leaq 0x1475e(%rip), %rbx     # 0x2de80
movq %rbx, %rdi
callq 0x6170
movups 0x7e25(%rip), %xmm0     # 0x21556
movups %xmm0, (%rbx,%rax)
movw $0x29, 0x10(%rbx,%rax)
leaq 0x145fd(%rip), %rax     # 0x2dd40
cmpq %r14, (%rax)
je 0x1976f
cmpq %r14, 0x8(%rax)
jne 0x19789
leaq 0x1472b(%rip), %rbx     # 0x2de80
movq %rbx, %rdi
callq 0x6170
movups 0x7e14(%rip), %xmm0     # 0x21578
movups %xmm0, (%rbx,%rax)
movb $0x0, 0x10(%rbx,%rax)
jmp 0x19789
leaq 0x1470a(%rip), %rbx     # 0x2de80
movq %rbx, %rdi
callq 0x6170
movups 0x7de3(%rip), %xmm0     # 0x21568
movups %xmm0, (%rbx,%rax)
callq 0x6590
movq (%rax), %rax
leaq 0x146e8(%rip), %r15     # 0x2de80
movsbq (%r15), %rbx
movzwl (%rax,%rbx,2), %eax
testb %r12b, %r12b
je 0x197b2
btl $0x8, %eax
jae 0x197c6
callq 0x6580
jmp 0x197bd
btl $0x9, %eax
jae 0x197c6
callq 0x6030
movq (%rax), %rax
movb (%rax,%rbx,4), %al
movb %al, (%r15)
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x197eb
movq %r15, %rdi
callq 0x6170
movl $0x5d215b20, (%r15,%rax) # imm = 0x5D215B20
movb $0x0, 0x4(%r15,%rax)
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19810
movq %r15, %rdi
callq 0x6170
movl $0x5d245b20, (%r15,%rax) # imm = 0x5D245B20
movb $0x0, 0x4(%r15,%rax)
testb %bpl, %bpl
jne 0x1985b
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x19836
movq %r15, %rdi
callq 0x6170
movl $0x5d2d5b20, (%r15,%rax) # imm = 0x5D2D5B20
jmp 0x19855
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x934a
testb %al, %al
je 0x1985b
movq %r15, %rdi
callq 0x6170
movl $0x5d2b5b20, (%r15,%rax) # imm = 0x5D2B5B20
movb $0x0, 0x4(%r15,%rax)
testb %r12b, %r12b
jne 0x1986f
movq %r15, %rdi
callq 0x6170
movw $0x2e, (%r15,%rax)
leaq 0x1460a(%rip), %rax     # 0x2de80
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq