// File: /workspace/github_c_makefile_star2_O3/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 0x4bc2(%rip), %r15      # 0x1f5e9
leaq 0x8f5b(%rip), %r13      # 0x23989
cmpl $0x2, %edx
cmovlq %r13, %r15
jl 0x1aa4c
leaq 0x49a4(%rip), %rsi      # 0x1f3e2
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x64f0
jmp 0x1aa53
movw $0x41, 0x8(%rsp)
movq 0x18(%r14), %rbp
movl 0x20(%r14), %edi
cmpl $0x39, %edi
jg 0x1aab9
cmpl $0x2b, %edi
jg 0x1ab63
cmpl $0x21, %edi
je 0x1acbd
cmpl $0x29, %edi
jne 0x1ae3a
shlq $0x4, %r12
leaq 0x1150a(%rip), %rax     # 0x2bf90
movq (%rax,%r12), %r12
leaq 0x133ff(%rip), %rbp     # 0x2de90
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0x60e0
cmpl $0x1, 0x24(%r14)
jne 0x1ae94
movq %r12, %rdi
callq 0xd2c6
movq %rax, %rbx
jmp 0x1ae9b
cmpl $0x3e, %edi
jg 0x1ac37
cmpl $0x3a, %edi
je 0x1ad6f
cmpl $0x3d, %edi
jne 0x1ae3a
leaq 0x15945(%rip), %r15     # 0x30420
cmpb $0x0, (%r15,%r12)
jne 0x1aaf7
movl $0x4, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1af4d
movq %r14, %rdi
callq 0x12a43
movq %r12, %rcx
shlq $0x4, %rcx
leaq 0x11b03(%rip), %rdx     # 0x2c610
movq (%rdx,%rcx), %r8
leaq 0x13378(%rip), %rbx     # 0x2de90
leaq 0x89f4(%rip), %rsi      # 0x23513
movq %rbp, %rcx
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x64f0
cmpb $0x1, (%r15,%r12)
jne 0x1b06d
movq %rbx, %rdi
callq 0x6170
addq %rax, %rbx
leaq 0x15b52(%rip), %rax     # 0x306a0
movq (%rax,%r12,8), %rdx
leaq 0x89d5(%rip), %rsi      # 0x2352e
xorl %ebp, %ebp
movq %rbx, %rdi
jmp 0x1ae74
cmpl $0x2c, %edi
je 0x1adbf
cmpl $0x2f, %edi
jne 0x1ae3a
leaq (%r12,%r12,2), %rax
leaq 0x15bf0(%rip), %rcx     # 0x30770
leaq (%rcx,%rax,8), %rbx
movq (%rbx), %rdx
leaq 0x13302(%rip), %r15     # 0x2de90
leaq 0x8966(%rip), %rsi      # 0x234fb
movq %r15, %rdi
xorl %eax, %eax
callq 0x64f0
movq %r15, %rdi
callq 0x6170
movq %rax, %r13
addq %r15, %r13
leaq 0x1588c(%rip), %rax     # 0x30440
cmpb $0x0, (%rax,%r12)
jne 0x1abd0
movl $0x4, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1af82
movq %rbx, 0x10(%rsp)
movq %r12, %rax
shlq $0x4, %rax
leaq 0x11bdd(%rip), %rcx     # 0x2c7c0
movq (%rcx,%rax), %rbx
movq %r14, %rdi
callq 0x1a9b6
leaq 0x890b(%rip), %rsi      # 0x23501
xorl %ebp, %ebp
movq %r13, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x64f0
leaq 0x15831(%rip), %rax     # 0x30440
cmpb $0x1, (%rax,%r12)
jne 0x1b06d
movq %r15, %rdi
callq 0x6170
addq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x88f9(%rip), %rsi      # 0x2352e
jmp 0x1acb3
cmpl $0x5d, %edi
je 0x1ade3
cmpl $0x3f, %edi
jne 0x1ae3a
leaq 0x13240(%rip), %rbx     # 0x2de90
leaq 0x8855(%rip), %rsi      # 0x234ac
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 0x1575f(%rip), %rax     # 0x303e0
cmpb $0x0, (%rax,%r12)
jne 0x1ac9d
movl $0x4, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1afb0
shlq $0x4, %r12
leaq 0x11658(%rip), %rax     # 0x2c300
movq (%rax,%r12), %rdx
leaq 0x8867(%rip), %rsi      # 0x2351a
xorl %ebp, %ebp
movq %r15, %rdi
jmp 0x1ae74
leaq 0x131cc(%rip), %r13     # 0x2de90
leaq 0x87e1(%rip), %rsi      # 0x234ac
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 0x1570b(%rip), %rax     # 0x30400
cmpb $0x0, (%rax,%r12)
jne 0x1ad11
movl $0x4, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1af07
movq %r12, %rax
shlq $0x4, %rax
leaq 0x11791(%rip), %rcx     # 0x2c4b0
movq (%rcx,%rax), %rdx
leaq 0x87f0(%rip), %rsi      # 0x2351a
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x64f0
leaq 0x156c3(%rip), %rax     # 0x30400
cmpb $0x1, (%rax,%r12)
jne 0x1b06d
movq %r13, %rdi
callq 0x6170
addq %rax, %r13
leaq 0x15896(%rip), %rax     # 0x305f0
movq (%rax,%r12,8), %rdx
leaq 0x87c9(%rip), %rsi      # 0x2352e
xorl %ebp, %ebp
movq %r13, %rdi
jmp 0x1ae74
movl 0x24(%r14), %eax
cmpl $0x1, %r12d
jne 0x1ae55
cmpl $0x1, %eax
jne 0x1ad91
leaq 0x131a7(%rip), %rdi     # 0x2df30
callq 0xd2c6
movq %rax, %r13
leaq 0x130f8(%rip), %rdi     # 0x2de90
leaq 0x8739(%rip), %rsi      # 0x234d8
leaq 0x1318a(%rip), %r8      # 0x2df30
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r9
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06d
movups 0x475b(%rip), %xmm0     # 0x1f521
leaq 0x130c3(%rip), %rax     # 0x2de90
movups %xmm0, (%rax)
movabsq $0x726f646e655920, %rcx # imm = 0x726F646E655920
movq %rcx, 0xd(%rax)
jmp 0x1b06a
movq %r12, %rax
shlq $0x4, %rax
leaq 0x1106f(%rip), %rcx     # 0x2be60
movq (%rcx,%rax), %rbx
movl $0x6, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1ae80
leaq (%r12,%r12,2), %rax
leaq 0x110ff(%rip), %rcx     # 0x2bf10
movl (%rcx,%rax,4), %edi
subl 0x34(%r14), %edi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x1cc59
leaq 0x13068(%rip), %rdi     # 0x2de90
leaq 0x86de(%rip), %rsi      # 0x2350d
movq %rax, %rdx
movq %rbx, %rcx
jmp 0x1af41
callq 0x6420
leaq 0x1304a(%rip), %rdi     # 0x2de90
leaq 0x86e6(%rip), %rsi      # 0x23533
movq %rax, %rdx
jmp 0x1b063
movq %rbp, %rcx
leaq 0x13031(%rip), %rdi     # 0x2de90
cmpl $0x1, %eax
jne 0x1af33
leaq 0x8673(%rip), %rsi      # 0x234e2
xorl %ebp, %ebp
movq %rcx, %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06d
leaq 0x13009(%rip), %rdi     # 0x2de90
movq %rbx, %rsi
callq 0x60e0
jmp 0x1b06a
leaq 0x8aee(%rip), %rbx      # 0x23989
movq %rbp, %rdi
callq 0x6170
movq %rax, %r13
addq %rbp, %r13
movl $0x6, %esi
movq %r14, %rdi
callq 0x9531
movl %eax, %ebp
testb %al, %al
je 0x1aed8
movl 0x2c(%r14), %edi
movl 0x30(%r14), %esi
callq 0x1cc59
leaq 0x863c(%rip), %rsi      # 0x2350c
movq %r13, %rdi
movq %rax, %rdx
jmp 0x1aee5
leaq 0x862e(%rip), %rsi      # 0x2350d
movq %r13, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x64f0
xorb $0x1, %bpl
leaq 0x12f96(%rip), %rdi     # 0x2de90
movq %r15, %rsi
callq 0x64d0
jmp 0x1b06d
leaq 0x15282(%rip), %rax     # 0x30190
movq (%rax,%r12,8), %rdx
leaq 0x156d7(%rip), %r13     # 0x305f0
movq (%r13,%r12,8), %rcx
testq %rdx, %rdx
je 0x1afd0
leaq 0x85f7(%rip), %rsi      # 0x23525
movq %rbx, %rdi
jmp 0x1afa4
leaq 0x85b0(%rip), %rsi      # 0x234ea
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06d
leaq 0x152ec(%rip), %rax     # 0x30240
movq (%rax,%r12,8), %rcx
leaq 0x15741(%rip), %rbx     # 0x306a0
movq (%rbx,%r12,8), %r8
testq %rcx, %rcx
je 0x1b003
leaq 0x12f1d(%rip), %rdi     # 0x2de90
leaq 0x85a6(%rip), %rsi      # 0x23520
movq %rbp, %rdx
jmp 0x1b045
leaq 0x15387(%rip), %rax     # 0x30310
movq (%rax,%r12,8), %rdx
movq 0x8(%rbx), %rcx
testq %rdx, %rdx
je 0x1b025
leaq 0x8584(%rip), %rsi      # 0x23525
movq %r13, %rdi
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06a
leaq 0x15109(%rip), %rax     # 0x300c0
movq (%rax,%r12,8), %rdx
testq %rdx, %rdx
je 0x1b04e
leaq 0x84ea(%rip), %rsi      # 0x234b5
jmp 0x1b060
movq %rcx, %rdi
callq 0xd2c6
movq (%r13,%r12,8), %r8
movq %r15, (%rsp)
leaq 0x12ea8(%rip), %rdi     # 0x2de90
leaq 0x84dc(%rip), %rsi      # 0x234cb
leaq 0x8(%rsp), %rdx
movq %rax, %rcx
movq %rbp, %r9
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06a
movq %r8, %rdi
callq 0xd2c6
movq (%rbx,%r12,8), %rcx
leaq 0x12e7a(%rip), %rdi     # 0x2de90
leaq 0x84ec(%rip), %rsi      # 0x23509
movq %rax, %rdx
movq %rbp, %r8
jmp 0x1b045
movq %rcx, %rdi
callq 0xd2c6
movq (%rbx), %r8
movq 0x8(%rbx), %rcx
leaq 0x12e55(%rip), %rdi     # 0x2de90
leaq 0x84c7(%rip), %rsi      # 0x23509
movq %rax, %rdx
xorl %eax, %eax
callq 0x64f0
jmp 0x1b06a
leaq 0x154cb(%rip), %rax     # 0x30520
movq (%rax,%r12,8), %rdx
leaq 0x845f(%rip), %rsi      # 0x234bf
movq %r15, %rdi
xorl %eax, %eax
callq 0x64f0
movb $0x1, %bpl
leaq 0x127e4(%rip), %rax     # 0x2d858
cmpq %r14, (%rax)
jne 0x1b0a5
leaq 0x12e10(%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 0x127a4(%rip), %rax     # 0x2d850
cmpq %r14, (%rax)
movl 0xc(%rsp), %r12d
jne 0x1b0d7
leaq 0x12dd3(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x848a(%rip), %xmm0     # 0x23556
movups %xmm0, (%rbx,%rax)
movw $0x29, 0x10(%rbx,%rax)
leaq 0x12c72(%rip), %rax     # 0x2dd50
cmpq %r14, (%rax)
je 0x1b10a
cmpq %r14, 0x8(%rax)
jne 0x1b124
leaq 0x12da0(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x8479(%rip), %xmm0     # 0x23578
movups %xmm0, (%rbx,%rax)
movb $0x0, 0x10(%rbx,%rax)
jmp 0x1b124
leaq 0x12d7f(%rip), %rbx     # 0x2de90
movq %rbx, %rdi
callq 0x6170
movups 0x8448(%rip), %xmm0     # 0x23568
movups %xmm0, (%rbx,%rax)
callq 0x65b0
movq (%rax), %rax
leaq 0x12d5d(%rip), %r15     # 0x2de90
movsbq (%r15), %rbx
movzwl (%rax,%rbx,2), %eax
testb %r12b, %r12b
je 0x1b14d
btl $0x8, %eax
jae 0x1b161
callq 0x65a0
jmp 0x1b158
btl $0x9, %eax
jae 0x1b161
callq 0x6030
movq (%rax), %rax
movb (%rax,%rbx,4), %al
movb %al, (%r15)
movl $0x10, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1b188
movq %r15, %rdi
callq 0x6170
movl $0x5d215b20, (%r15,%rax) # imm = 0x5D215B20
movb $0x0, 0x4(%r15,%rax)
movl $0x4, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1b1af
movq %r15, %rdi
callq 0x6170
movl $0x5d245b20, (%r15,%rax) # imm = 0x5D245B20
movb $0x0, 0x4(%r15,%rax)
testb %bpl, %bpl
jne 0x1b1fe
movl $0x1, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1b1d7
movq %r15, %rdi
callq 0x6170
movl $0x5d2d5b20, (%r15,%rax) # imm = 0x5D2D5B20
jmp 0x1b1f8
movl $0x20, %esi
movq %r14, %rdi
callq 0x9531
testb %al, %al
je 0x1b1fe
movq %r15, %rdi
callq 0x6170
movl $0x5d2b5b20, (%r15,%rax) # imm = 0x5D2B5B20
movb $0x0, 0x4(%r15,%rax)
testb %r12b, %r12b
jne 0x1b212
movq %r15, %rdi
callq 0x6170
movw $0x2e, (%r15,%rax)
leaq 0x12c77(%rip), %rax     # 0x2de90
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq