// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/wizard.c
// Function: create_obj
int create_obj(bool fscr)
{
	struct linked_list *item;
	struct object *obj;
	int wh, ch, otype;
	char newitem, newtype, msz, *oname;
	struct magic_info *mf;
	bool nogood = TRUE, inhw = FALSE;

	if (fscr)
		msg(" ");
	else if (wizard) {
		msg("Create what?%s: ", starlist);
		ch = readchar();
		mpos = 0;
		if (ch == ESCAPE)
			return 0;
		else if (ch != '*')
			nogood = FALSE;
	}
	if (nogood) {
		inhw = TRUE;
		wclear(hw);
		wprintw(hw,"Item\tKey\n\n");
		for (otype = 0; otype < NUMTHINGS; otype++) {
			if (otype != TYP_AMULET || wizard) {
				mf = &thnginfo[otype];
				wprintw(hw,"%s\t %c\n",things[otype].mi_name,mf->mf_show);
			}
		}
		if (wizard)
			waddstr(hw,"monster\t (A-z)");
		wprintw(hw,"\n\nWhat do you want to create? ");
		draw(hw);
		do {
			ch = readchar();
			if (ch == ESCAPE) {
				after = FALSE;
				restscr(cw);
				return 0;
			}
			switch (ch) {
				case RING:		case STICK:	case POTION:
				case SCROLL:	case ARMOR:	case WEAPON:
				case FOOD:		case AMULET:
					nogood = FALSE;
					break;
				default:
					if (isalpha(ch))
						nogood = FALSE;
			}
		} while (nogood);
	}
	if (isalpha(ch)) {
		if (inhw)
			restscr(cw);
		makemons(ch);		/* make monster & be done with it */
		return 0;
	}
	otype = getindex(ch);
	if (otype == -1 || (otype == AMULET && !wizard)) {
		if (inhw)
			restscr(cw);
		mpos = 0;
		msg("You can't create that !!");
		return 0;
	}
	newitem = ch;
	mf = &thnginfo[otype];
	oname = things[otype].mi_name;
	msz = mf->mf_max;
	nogood = TRUE;
	if (msz == 1) {		/* if only one type of item */
		ch = 'a';
		nogood = FALSE;
	}
	else if (!fscr && wizard) {
		if (!inhw) {
			msg("Which %s?%s: ", oname, starlist);
			ch = readchar();
			if (ch == ESCAPE)
				return 0;
			if (ch != '*')
				nogood = FALSE;
		}
	}
	if (nogood) {
		struct magic_item *wmi;
		int ii;

		mpos = 0;
		inhw = TRUE;
		switch(newitem) {
			case POTION:	wmi = &p_magic[0];
			when SCROLL:	wmi = &s_magic[0];
			when RING:		wmi = &r_magic[0];
			when STICK:		wmi = &ws_magic[0];
			when WEAPON:	wmi = &w_magic[0];
			otherwise:		wmi = &a_magic[0];
		}
		wclear(hw);
		for (ii = 0 ; ii < msz ; ii++) {
			mvwaddch(hw,ii % 13,ii > 12 ? COLS/2 : 0, ii + 'a');
			waddstr(hw,") ");
			waddstr(hw,wmi->mi_name);
			wmi++;
		}
		sprintf(prbuf,"Which %s? ", oname);
		mvwaddstr(hw,LINES - 1, 0, prbuf);
		draw(hw);
		do {
			ch = readchar();
			if (ch == ESCAPE) {
				restscr(cw);
				msg("");
				return 0;
			}
		} while (!isalpha(ch));
	}
	if (inhw)			/* restore screen if need be */
		restscr(cw);

	newtype = tolower(ch) - 'a';
	if (newtype < 0 || newtype >= msz) {	/* if an illegal value */
		mpos = 0;
		after = FALSE;
		if (inhw)
			restscr(cw);
		msg("There is no such %s", oname);
		return 0;
	}
	mpos = 0;
	item = new_thing(FALSE, newitem, newtype);
	obj = OBJPTR(item);
	wh = obj->o_type;
	if (wh == WEAPON || wh == ARMOR || wh == RING) {
		if (fscr)					/* users get +3 to -3 */
			ch = rnd(7) - 3;
		else {						/* wizard gets to choose */
			if (wh == RING)
				init_ring(obj, TRUE);
			else
				ch = getbless();
		}
		if (wh == WEAPON)
			obj->o_hplus = obj->o_dplus = ch;
		else if (wh == ARMOR)
			obj->o_ac = armors[obj->o_which].a_class - ch;
		if (ch < 0)
			setoflg(obj, ISCURSED);
		else
			resoflg(obj, ISCURSED);
	}
	mpos = 0;
	if (fscr)
		whatis(item);			/* identify for aquirement scroll */
	wh = add_pack(item, FALSE);
	if (wh == FALSE)			/* won't fit in pack */
		discard(item);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x5(%rbp)
movb $0x1, -0x39(%rbp)
movb $0x0, -0x3a(%rbp)
testb $0x1, -0x5(%rbp)
je 0x2637e
leaq 0x541d(%rip), %rdi      # 0x2b792
movb $0x0, %al
callq 0xd8f0
jmp 0x263db
leaq 0x10988(%rip), %rax     # 0x36d0d
testb $0x1, (%rax)
je 0x263d9
leaq 0x7f03(%rip), %rdi      # 0x2e294
leaq 0xd008(%rip), %rsi      # 0x333a0
movb $0x0, %al
callq 0xd8f0
movb $0x0, %al
callq 0xdce0
movsbl %al, %eax
movl %eax, -0x20(%rbp)
leaq 0x1092d(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
cmpl $0x1b, -0x20(%rbp)
jne 0x263cb
movl $0x0, -0x4(%rbp)
jmp 0x26adb
cmpl $0x2a, -0x20(%rbp)
je 0x263d5
movb $0x0, -0x39(%rbp)
jmp 0x263d7
jmp 0x263d9
jmp 0x263db
testb $0x1, -0x39(%rbp)
je 0x26594
movb $0x1, -0x3a(%rbp)
leaq 0x13a68(%rip), %rax     # 0x39e58
movq (%rax), %rdi
callq 0x6110
leaq 0x13a59(%rip), %rax     # 0x39e58
movq (%rax), %rdi
leaq 0x7e9c(%rip), %rsi      # 0x2e2a5
movb $0x0, %al
callq 0x6510
movl $0x0, -0x24(%rbp)
cmpl $0x8, -0x24(%rbp)
jge 0x26487
cmpl $0x7, -0x24(%rbp)
jne 0x2642f
leaq 0x108e3(%rip), %rax     # 0x36d0d
testb $0x1, (%rax)
je 0x2647a
movslq -0x24(%rbp), %rcx
leaq 0xf536(%rip), %rax      # 0x35970
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
leaq 0x13a0c(%rip), %rax     # 0x39e58
movq (%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0xe976(%rip), %rax      # 0x34dd0
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x38(%rbp), %rax
movsbl 0x8(%rax), %ecx
leaq 0x7e3d(%rip), %rsi      # 0x2e2b0
movb $0x0, %al
callq 0x6510
jmp 0x2647c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x26417
leaq 0x1087f(%rip), %rax     # 0x36d0d
testb $0x1, (%rax)
je 0x264ae
leaq 0x139be(%rip), %rax     # 0x39e58
movq (%rax), %rdi
leaq 0x7e14(%rip), %rsi      # 0x2e2b8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6560
leaq 0x139a3(%rip), %rax     # 0x39e58
movq (%rax), %rdi
leaq 0x7e08(%rip), %rsi      # 0x2e2c7
movb $0x0, %al
callq 0x6510
leaq 0x1398b(%rip), %rax     # 0x39e58
movq (%rax), %rdi
callq 0x61f0
movb $0x0, %al
callq 0xdce0
movsbl %al, %eax
movl %eax, -0x20(%rbp)
cmpl $0x1b, -0x20(%rbp)
jne 0x2650d
leaq 0xce1e(%rip), %rax      # 0x3330d
movb $0x0, (%rax)
leaq 0x13957(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
movl $0x0, -0x4(%rbp)
jmp 0x26adb
movl -0x20(%rbp), %eax
movl %eax, -0x50(%rbp)
subl $0x21, %eax
je 0x26560
jmp 0x2651a
movl -0x50(%rbp), %eax
subl $0x29, %eax
je 0x26560
jmp 0x26524
movl -0x50(%rbp), %eax
subl $0x2c, %eax
je 0x26560
jmp 0x2652e
movl -0x50(%rbp), %eax
subl $0x2f, %eax
je 0x26560
jmp 0x26538
movl -0x50(%rbp), %eax
subl $0x3a, %eax
je 0x26560
jmp 0x26542
movl -0x50(%rbp), %eax
subl $0x3d, %eax
je 0x26560
jmp 0x2654c
movl -0x50(%rbp), %eax
subl $0x3f, %eax
je 0x26560
jmp 0x26556
movl -0x50(%rbp), %eax
subl $0x5d, %eax
jne 0x26566
jmp 0x26560
movb $0x0, -0x39(%rbp)
jmp 0x26586
callq 0x65b0
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x26584
movb $0x0, -0x39(%rbp)
jmp 0x26586
jmp 0x26588
testb $0x1, -0x39(%rbp)
jne 0x264d5
jmp 0x26594
callq 0x65b0
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x265d7
testb $0x1, -0x3a(%rbp)
je 0x265c3
leaq 0x13895(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
movl -0x20(%rbp), %edi
callq 0x26af0
movl $0x0, -0x4(%rbp)
jmp 0x26adb
movl -0x20(%rbp), %eax
movsbl %al, %edi
callq 0xf3b0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x265fd
cmpl $0x2c, -0x24(%rbp)
jne 0x26639
leaq 0x10715(%rip), %rax     # 0x36d0d
testb $0x1, (%rax)
jne 0x26639
testb $0x1, -0x3a(%rbp)
je 0x26612
leaq 0x13846(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
leaq 0x106c7(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
leaq 0x7cc0(%rip), %rdi      # 0x2e2e6
movb $0x0, %al
callq 0xd8f0
movl $0x0, -0x4(%rbp)
jmp 0x26adb
movl -0x20(%rbp), %eax
movb %al, -0x25(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0xf326(%rip), %rax      # 0x35970
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0xe770(%rip), %rax      # 0x34dd0
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movb %al, -0x27(%rbp)
movb $0x1, -0x39(%rbp)
movsbl -0x27(%rbp), %eax
cmpl $0x1, %eax
jne 0x26691
movl $0x61, -0x20(%rbp)
movb $0x0, -0x39(%rbp)
jmp 0x266f1
testb $0x1, -0x5(%rbp)
jne 0x266ef
leaq 0x1066f(%rip), %rax     # 0x36d0d
testb $0x1, (%rax)
je 0x266ef
testb $0x1, -0x3a(%rbp)
jne 0x266ed
movq -0x30(%rbp), %rsi
leaq 0x7c4b(%rip), %rdi      # 0x2e2ff
leaq 0xcce5(%rip), %rdx      # 0x333a0
movb $0x0, %al
callq 0xd8f0
movb $0x0, %al
callq 0xdce0
movsbl %al, %eax
movl %eax, -0x20(%rbp)
cmpl $0x1b, -0x20(%rbp)
jne 0x266e1
movl $0x0, -0x4(%rbp)
jmp 0x26adb
cmpl $0x2a, -0x20(%rbp)
je 0x266eb
movb $0x0, -0x39(%rbp)
jmp 0x266ed
jmp 0x266ef
jmp 0x266f1
testb $0x1, -0x39(%rbp)
je 0x26925
leaq 0x105de(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
movb $0x1, -0x3a(%rbp)
movsbl -0x25(%rbp), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x1e, %eax
ja 0x26773
movq -0x58(%rbp), %rax
leaq 0x7aef(%rip), %rcx      # 0x2e218
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xed77(%rip), %rax      # 0x354b0
movq %rax, -0x48(%rbp)
jmp 0x2677e
leaq 0xebba(%rip), %rax      # 0x35300
movq %rax, -0x48(%rbp)
jmp 0x2677e
leaq 0xeebd(%rip), %rax      # 0x35610
movq %rax, -0x48(%rbp)
jmp 0x2677e
leaq 0xf060(%rip), %rax      # 0x357c0
movq %rax, -0x48(%rbp)
jmp 0x2677e
leaq 0xe823(%rip), %rax      # 0x34f90
movq %rax, -0x48(%rbp)
jmp 0x2677e
leaq 0xe6e6(%rip), %rax      # 0x34e60
movq %rax, -0x48(%rbp)
leaq 0x136d3(%rip), %rax     # 0x39e58
movq (%rax), %rdi
callq 0x6110
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movsbl -0x27(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2685d
leaq 0x136ae(%rip), %rax     # 0x39e58
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl -0x4c(%rbp), %eax
movl $0xd, %ecx
cltd
idivl %ecx
movl %edx, -0x5c(%rbp)
cmpl $0xc, -0x4c(%rbp)
jle 0x267db
movq 0xc80c(%rip), %rax      # 0x32fd8
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x6c(%rbp)
jmp 0x267e2
xorl %eax, %eax
movl %eax, -0x6c(%rbp)
jmp 0x267e2
movl -0x5c(%rbp), %esi
movq -0x68(%rbp), %rdi
movl -0x6c(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x267f8
jmp 0x2680d
leaq 0x13659(%rip), %rax     # 0x39e58
movq (%rax), %rdi
movl -0x4c(%rbp), %esi
addl $0x61, %esi
callq 0x64c0
leaq 0x13644(%rip), %rax     # 0x39e58
movq (%rax), %rdi
leaq 0x7aef(%rip), %rsi      # 0x2e30d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6560
leaq 0x13629(%rip), %rax     # 0x39e58
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6560
movq -0x48(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x26794
movq -0x30(%rbp), %rdx
leaq 0x10a98(%rip), %rdi     # 0x37300
leaq 0x7aa1(%rip), %rsi      # 0x2e310
movb $0x0, %al
callq 0x64f0
leaq 0x135db(%rip), %rax     # 0x39e58
movq (%rax), %rdi
movq 0xc759(%rip), %rax      # 0x32fe0
movl (%rax), %esi
subl $0x1, %esi
xorl %edx, %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x2689a
jmp 0x268b5
leaq 0x135b7(%rip), %rax     # 0x39e58
movq (%rax), %rdi
leaq 0x10a55(%rip), %rsi     # 0x37300
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6560
leaq 0x1359c(%rip), %rax     # 0x39e58
movq (%rax), %rdi
callq 0x61f0
movb $0x0, %al
callq 0xdce0
movsbl %al, %eax
movl %eax, -0x20(%rbp)
cmpl $0x1b, -0x20(%rbp)
jne 0x26900
leaq 0x13572(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
leaq 0x79c2(%rip), %rdi      # 0x2e2af
movb $0x0, %al
callq 0xd8f0
movl $0x0, -0x4(%rbp)
jmp 0x26adb
jmp 0x26902
callq 0x65b0
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x268c4
jmp 0x26925
testb $0x1, -0x3a(%rbp)
je 0x2693a
leaq 0x1351e(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
movl -0x20(%rbp), %edi
callq 0x6320
subl $0x61, %eax
movb %al, -0x26(%rbp)
movsbl -0x26(%rbp), %eax
cmpl $0x0, %eax
jl 0x2695d
movsbl -0x26(%rbp), %eax
movsbl -0x27(%rbp), %ecx
cmpl %ecx, %eax
jl 0x269a7
leaq 0x1037c(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
leaq 0xc99c(%rip), %rax      # 0x3330d
movb $0x0, (%rax)
testb $0x1, -0x3a(%rbp)
je 0x26989
leaq 0x134cf(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0xe2d0
movq -0x30(%rbp), %rsi
leaq 0x7987(%rip), %rdi      # 0x2e31b
movb $0x0, %al
callq 0xd8f0
movl $0x0, -0x4(%rbp)
jmp 0x26adb
leaq 0x10332(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
movsbl -0x25(%rbp), %esi
movsbl -0x26(%rbp), %edx
xorl %edi, %edi
callq 0x24020
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x29, -0x1c(%rbp)
je 0x269f3
cmpl $0x5d, -0x1c(%rbp)
je 0x269f3
cmpl $0x3d, -0x1c(%rbp)
jne 0x26a96
testb $0x1, -0x5(%rbp)
je 0x26a0d
movl $0x7, %edi
movb $0x0, %al
callq 0xef20
subl $0x3, %eax
movl %eax, -0x20(%rbp)
jmp 0x26a2d
cmpl $0x3d, -0x1c(%rbp)
jne 0x26a23
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x18010
jmp 0x26a2b
callq 0x26c10
movl %eax, -0x20(%rbp)
jmp 0x26a2d
cmpl $0x29, -0x1c(%rbp)
jne 0x26a46
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
jmp 0x26a70
cmpl $0x5d, -0x1c(%rbp)
jne 0x26a6e
movq -0x18(%rbp), %rax
movslq 0x28(%rax), %rcx
leaq 0xe4b5(%rip), %rax      # 0x34f10
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
subl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
jmp 0x26a70
cmpl $0x0, -0x20(%rbp)
jge 0x26a86
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab50
jmp 0x26a94
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab70
jmp 0x26a96
leaq 0x10243(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
testb $0x1, -0x5(%rbp)
je 0x26ab2
movq -0x10(%rbp), %rdi
callq 0x26160
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x14280
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x26ad4
movq -0x10(%rbp), %rdi
callq 0xe490
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)