// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/move.c
// Function: dip_it
int dip_it()
{
	struct linked_list *what;
	struct object *ob;
	struct trap *tp;
	int wh;

	tp = trap_at(hero.y,hero.x);
	if (tp == NULL || inpool == FALSE || (tp->tr_flags & ISGONE))
		return 0;

	if ((what = get_item("dip",0)) == NULL)
		return 0;
	ob = OBJPTR(what);
	mpos = 0;
	/*
	 * If hero is trying to dip an object OTHER than his
	 * current weapon, make sure that he could drop his
	 * current weapon
	 */
	if (ob != cur_weapon) {
		if (cur_weapon != NULL && o_on(cur_weapon, ISCURSED)) {
			msg("You are unable to release your weapon.");
			after = FALSE;
			return 0;
		}
	}
	if (ob == cur_armor) {
		msg("You have to take off your armor before you can dip it.");
		after = FALSE;
		return 0;
	}
	else if (ob == cur_ring[LEFT] || ob == cur_ring[RIGHT]) {
		msg("You have to take that ring off before you can dip it.");
		after = FALSE;
		return 0;
	}
	wh = ob->o_which;
	tp->tr_flags |= ISGONE;
	if (ob != NULL && o_off(ob,ISPROT)) {
		setoflg(ob,ISKNOW);
		switch(ob->o_type) {
		case WEAPON:
			if(rnd(100) < 20) {		/* enchant weapon here */
				if (o_off(ob,ISCURSED)) {
					ob->o_hplus += 1;
					ob->o_dplus += 1;
				}
				else {		/* weapon was prev cursed here */
					ob->o_hplus = rnd(2);
					ob->o_dplus = rnd(2);
				}
				resoflg(ob,ISCURSED);
			}
			else if(rnd(100) < 10) {	/* curse weapon here */
				if (o_off(ob,ISCURSED)) {
					ob->o_hplus = -(rnd(2)+1);
					ob->o_dplus = -(rnd(2)+1);
				}
				else {			/* if already cursed */
					ob->o_hplus--;
					ob->o_dplus--;
				}
				setoflg(ob,ISCURSED);
			}			
			msg("The %s glows for a moment.",w_magic[wh].mi_name);
		when ARMOR:
			if (rnd(100) < 30) {			/* enchant armor */
				if(o_off(ob,ISCURSED))
					ob->o_ac -= rnd(2) + 1;
				else
					ob->o_ac = -rnd(3)+ armors[wh].a_class;
				resoflg(ob,ISCURSED);
			}
			else if(rnd(100) < 15){			/* curse armor */
				if (o_off(ob,ISCURSED))
					ob->o_ac = rnd(3)+ armors[wh].a_class;
				else
					ob->o_ac += rnd(2) + 1;
				setoflg(ob,ISCURSED);
			}
			msg("The %s glows for a moment.",a_magic[wh].mi_name);
		when STICK: {
			int i;
			struct rod *rd;

			i = rnd(8) + 1;
			if(rnd(100) < 25)		/* add charges */
				ob->o_charges += i;
			else if(rnd(100) < 10) {	/* remove charges */
				if ((ob->o_charges -= i) < 0)
					ob->o_charges = 0;
			}
			ws_know[wh] = TRUE;
			rd = &ws_stuff[wh];
			msg("The %s %s glows for a moment.",rd->ws_made,rd->ws_type);
		}
		when SCROLL:
			s_know[wh] = TRUE;
			msg("The '%s' scroll unfurls.",s_names[wh]);
		when POTION:
			p_know[wh] = TRUE;
			msg("The %s potion bubbles for a moment.",p_colors[wh]);
		when RING:
			r_know[wh] = TRUE;
			if (magring(ob)) {
				if(rnd(100) < 25) {	 		/* enchant ring */
					if (o_off(ob,ISCURSED))
						ob->o_ac += rnd(2) + 1;
					else
						ob->o_ac = rnd(2) + 1;
					resoflg(ob,ISCURSED);
				}
				else if(rnd(100) < 10) {	 /* curse ring */
					if (o_off(ob,ISCURSED))
						ob->o_ac = -(rnd(2) + 1);
					else
						ob->o_ac -= (rnd(2) + 1);
					setoflg(ob,ISCURSED);
				}
			}
			msg("The %s ring vibrates for a moment.",r_stones[wh]);
		otherwise:
			msg("The pool bubbles for a moment.");
		}
	}
	cur_weapon = ob;	/* hero has to weild item to dip it */
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x24901(%rip), %rax     # 0x370d0
movl 0x54(%rax), %edi
leaq 0x248f7(%rip), %rax     # 0x370d0
movl 0x50(%rax), %esi
callq 0x12e80
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1280e
leaq 0x24517(%rip), %rax     # 0x36d0a
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x1280e
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1281a
movl $0x0, -0x4(%rbp)
jmp 0x12e6b
leaq 0x1904c(%rip), %rdi     # 0x2b86d
xorl %esi, %esi
callq 0x14b90
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
jne 0x1283e
movl $0x0, -0x4(%rbp)
jmp 0x12e6b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0x2448f(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
leaq 0x2445e(%rip), %rcx     # 0x36cc0
cmpq (%rcx), %rax
je 0x128b4
leaq 0x24452(%rip), %rax     # 0x36cc0
cmpq $0x0, (%rax)
je 0x128b2
leaq 0x24445(%rip), %rax     # 0x36cc0
movq (%rax), %rdi
movl $0x1, %esi
callq 0xaac0
testb $0x1, %al
jne 0x1288e
jmp 0x128b2
leaq 0x18fdc(%rip), %rdi     # 0x2b871
movb $0x0, %al
callq 0xd8f0
leaq 0x20a6a(%rip), %rax     # 0x3330d
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x12e6b
jmp 0x128b4
movq -0x18(%rbp), %rax
leaq 0x24409(%rip), %rcx     # 0x36cc8
cmpq (%rcx), %rax
jne 0x128e8
leaq 0x18fcd(%rip), %rdi     # 0x2b898
movb $0x0, %al
callq 0xd8f0
leaq 0x20a34(%rip), %rax     # 0x3330d
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x12e6b
movq -0x18(%rbp), %rax
leaq 0x248cd(%rip), %rcx     # 0x371c0
cmpq (%rcx), %rax
je 0x12909
movq -0x18(%rbp), %rax
leaq 0x248bd(%rip), %rcx     # 0x371c0
cmpq 0x8(%rcx), %rax
jne 0x1292d
leaq 0x18fbf(%rip), %rdi     # 0x2b8cf
movb $0x0, %al
callq 0xd8f0
leaq 0x209ef(%rip), %rax     # 0x3330d
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x12e6b
jmp 0x1292f
movq -0x18(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x10(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x12e56
movq -0x18(%rbp), %rdi
movl $0x10, %esi
callq 0xab00
testb $0x1, %al
jne 0x12968
jmp 0x12e56
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0xab50
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x34(%rbp)
subl $0x21, %eax
je 0x12cfb
jmp 0x1298b
movl -0x34(%rbp), %eax
subl $0x29, %eax
je 0x129d0
jmp 0x12995
movl -0x34(%rbp), %eax
subl $0x2f, %eax
je 0x12c1d
jmp 0x129a3
movl -0x34(%rbp), %eax
subl $0x3d, %eax
je 0x12d2c
jmp 0x129b1
movl -0x34(%rbp), %eax
subl $0x3f, %eax
je 0x12cca
jmp 0x129bf
movl -0x34(%rbp), %eax
subl $0x5d, %eax
je 0x12afb
jmp 0x12e46
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x14, %eax
jge 0x12a4e
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x129f5
jmp 0x12a11
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
movq -0x18(%rbp), %rax
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
jmp 0x12a3b
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab70
jmp 0x12ad3
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0xa, %eax
jge 0x12ad1
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x12a73
jmp 0x12aa9
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
addl $0x1, %eax
xorl %ecx, %ecx
subl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
addl $0x1, %eax
xorl %ecx, %ecx
subl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
jmp 0x12ac3
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2c(%rax)
movq -0x18(%rbp), %rax
movl 0x30(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab50
jmp 0x12ad3
movslq -0x24(%rbp), %rcx
leaq 0x224b2(%rip), %rax     # 0x34f90
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq 0x18e16(%rip), %rdi     # 0x2b905
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x1e, %eax
jge 0x12b7a
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x12b20
jmp 0x12b3f
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %edx
addl $0x1, %edx
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x34(%rax)
jmp 0x12b6a
movl $0x3, %edi
movb $0x0, %al
callq 0xef20
xorl %ecx, %ecx
subl %eax, %ecx
movslq -0x24(%rbp), %rdx
leaq 0x223b6(%rip), %rax     # 0x34f10
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
addl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab70
jmp 0x12bf5
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0xf, %eax
jge 0x12bf3
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x12b9f
jmp 0x12bca
movl $0x3, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
movslq -0x24(%rbp), %rdx
leaq 0x22358(%rip), %rax     # 0x34f10
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
addl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
jmp 0x12be5
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab50
jmp 0x12bf5
movslq -0x24(%rbp), %rcx
leaq 0x22260(%rip), %rax     # 0x34e60
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq 0x18cf4(%rip), %rdi     # 0x2b905
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
movl $0x8, %edi
movb $0x0, %al
callq 0xef20
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x19, %eax
jge 0x12c4f
movl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
jmp 0x12c83
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0xa, %eax
jge 0x12c81
movl -0x28(%rbp), %edx
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %eax
subl %edx, %eax
movl %eax, 0x34(%rcx)
cmpl $0x0, %eax
jge 0x12c7f
movq -0x18(%rbp), %rax
movl $0x0, 0x34(%rax)
jmp 0x12c81
jmp 0x12c83
movslq -0x24(%rbp), %rcx
leaq 0x26c22(%rip), %rax     # 0x398b0
movb $0x1, (%rax,%rcx)
movslq -0x24(%rbp), %rcx
leaq 0x26f43(%rip), %rax     # 0x39be0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
leaq 0x18c62(%rip), %rdi     # 0x2b920
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
movslq -0x24(%rbp), %rcx
leaq 0x26b7b(%rip), %rax     # 0x39850
movb $0x1, (%rax,%rcx)
movslq -0x24(%rbp), %rcx
leaq 0x26cac(%rip), %rax     # 0x39990
movq (%rax,%rcx,8), %rsi
leaq 0x18c4f(%rip), %rdi     # 0x2b93e
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
movslq -0x24(%rbp), %rcx
leaq 0x26b6a(%rip), %rax     # 0x39870
movb $0x1, (%rax,%rcx)
movslq -0x24(%rbp), %rcx
leaq 0x26d4b(%rip), %rax     # 0x39a60
movq (%rax,%rcx,8), %rsi
leaq 0x18c37(%rip), %rdi     # 0x2b957
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
movslq -0x24(%rbp), %rcx
leaq 0x26b59(%rip), %rax     # 0x39890
movb $0x1, (%rax,%rcx)
movq -0x18(%rbp), %rdi
callq 0x17ec0
testb $0x1, %al
jne 0x12d4d
jmp 0x12e27
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x19, %eax
jge 0x12db7
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x12d72
jmp 0x12d8f
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
jmp 0x12da7
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab70
jmp 0x12e25
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0xa, %eax
jge 0x12e23
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab00
testb $0x1, %al
jne 0x12ddc
jmp 0x12df8
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
addl $0x1, %eax
xorl %ecx, %ecx
subl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
jmp 0x12e15
movl $0x2, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %edx
addl $0x1, %edx
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xab50
jmp 0x12e25
jmp 0x12e27
movslq -0x24(%rbp), %rcx
leaq 0x26cde(%rip), %rax     # 0x39b10
movq (%rax,%rcx,8), %rsi
leaq 0x18b3e(%rip), %rdi     # 0x2b97b
movb $0x0, %al
callq 0xd8f0
jmp 0x12e54
leaq 0x18b51(%rip), %rdi     # 0x2b99e
movb $0x0, %al
callq 0xd8f0
jmp 0x12e56
movq -0x18(%rbp), %rcx
leaq 0x23e5f(%rip), %rax     # 0x36cc0
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)