// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/rings.c
// Function: ring_on
int ring_on()
{
	struct object *obj;
	struct linked_list *item;
	int ring, wh;
	char buf[LINLEN];
	bool okring;

	if (cur_ring[LEFT] != NULL && cur_ring[RIGHT] != NULL) {
		msg("Already wearing two rings.");
		after = FALSE;
		return 0;
	}
	/*
	 * Make certain that it is somethings that we want to wear
	 */
	if ((item = get_item("put on", RING)) == NULL)
		return 0;
	obj = OBJPTR(item);
	if (obj->o_type != RING) {
		msg("That won't fit on your finger.");
		return 0;
	}
	/*
	 * find out which hand to put it on
	 */
	if (is_current(obj))
		return 0;
	if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) {
		if ((ring = gethand(FALSE)))
			return 0;
	}
	else if (cur_ring[LEFT] == NULL)
		ring = LEFT;
	else
		ring = RIGHT;
	cur_ring[ring] = obj;
	wh = obj->o_which;
	/*
	 * okring = FALSE when:
	 * 1) ring is cursed and benefit = plus
	 * 2) ring is blessed and benefit = minus
	 */
	okring = !((obj->o_ac > 0 && o_on(obj, ISCURSED)) ||
	          (obj->o_ac < 0 && o_on(obj, ISBLESS)));
	/*
	 * Calculate the effect it has on the poor guy (if possible).
	 */
	if (okring) {
		switch (wh) {
			case R_SPEED:
				if (--obj->o_ac < 0) {
					obj->o_ac = 0;
					setoflg(obj,ISCURSED);
				}
				else {
					add_haste(FALSE);
					msg("You find yourself moving must faster.");
				}
			when R_GIANT:				/* to 24 */
				him->s_ef.a_str = MAXSTR;
			when R_ADDSTR:
				chg_abil(STR,obj->o_ac,FROMRING);
			when R_KNOW:
				chg_abil(WIS,obj->o_ac,FROMRING);
			when R_DEX:
				chg_abil(DEX,obj->o_ac,FROMRING);
			when R_CONST:
				chg_abil(CON,obj->o_ac,FROMRING);
			when R_SEEINVIS:
				player.t_flags |= CANSEE;
				light(&hero);
				mvwaddch(cw, hero.y, hero.x, PLAYER);
			when R_AGGR:
				aggravate();
			when R_HEAVY:
				updpack();			/* new pack weight */
			when R_BLIND:
				r_know[R_BLIND] = TRUE;
				player.t_flags |= ISBLIND;
				look(FALSE);
			when R_SLOW:
				player.t_flags |= ISSLOW;
			when R_SAPEM:
				fuse(sapem,TRUE,150);
			when R_LIGHT: {
				struct room *rop;

				r_know[R_LIGHT] = TRUE;
				if ((rop = player.t_room) != NULL) {
					rop->r_flags &= ~ISDARK;
					light(&hero);
					mvwaddch(cw, hero.y, hero.x, PLAYER);
				}
			}
		}
	}
	if (r_know[wh] && r_guess[wh]) {
		free(r_guess[wh]);
		r_guess[wh] = NULL;
	}
	else if(!r_know[wh] && r_guess[wh] == NULL) {
		mpos = 0;
		strcpy(buf, r_stones[wh]);
		msg(callit);
		if (get_str(buf, cw) == NORM) {
			r_guess[wh] = new(strlen(buf) + 1);
			strcpy(r_guess[wh], buf);
		}
	}
	mpos = 0;
	msg("Now wearing %s",inv_name(obj,TRUE));
	ringfood = ring_eat();
	nochange = FALSE;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0x2002e(%rip), %rax     # 0x371c0
cmpq $0x0, (%rax)
je 0x171ca
leaq 0x20021(%rip), %rax     # 0x371c0
cmpq $0x0, 0x8(%rax)
je 0x171ca
leaq 0x1517f(%rip), %rdi     # 0x2c32c
movb $0x0, %al
callq 0xd8f0
leaq 0x1c152(%rip), %rax     # 0x3330d
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x176e3
leaq 0x15176(%rip), %rdi     # 0x2c347
movl $0x3d, %esi
callq 0x14b90
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x171f1
movl $0x0, -0x4(%rbp)
jmp 0x176e3
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3d, 0x20(%rax)
je 0x17221
leaq 0x15140(%rip), %rdi     # 0x2c34e
movb $0x0, %al
callq 0xd8f0
movl $0x0, -0x4(%rbp)
jmp 0x176e3
movq -0x10(%rbp), %rdi
callq 0xffc0
testb $0x1, %al
jne 0x17230
jmp 0x1723c
movl $0x0, -0x4(%rbp)
jmp 0x176e3
leaq 0x1ff7d(%rip), %rax     # 0x371c0
cmpq $0x0, (%rax)
jne 0x1727d
leaq 0x1ff70(%rip), %rax     # 0x371c0
cmpq $0x0, 0x8(%rax)
jne 0x1727d
xorl %edi, %edi
callq 0x176f0
movb %al, %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl %ecx, -0x1c(%rbp)
testb $0x1, %al
jne 0x1726f
jmp 0x1727b
movl $0x0, -0x4(%rbp)
jmp 0x176e3
jmp 0x1729c
leaq 0x1ff3c(%rip), %rax     # 0x371c0
cmpq $0x0, (%rax)
jne 0x17293
movl $0x0, -0x1c(%rbp)
jmp 0x1729a
movl $0x1, -0x1c(%rbp)
jmp 0x1729c
movq -0x10(%rbp), %rdx
movslq -0x1c(%rbp), %rcx
leaq 0x1ff15(%rip), %rax     # 0x371c0
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jle 0x172e0
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0xaac0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x81(%rbp)
jne 0x17312
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x34(%rcx)
movb %al, -0x82(%rbp)
jge 0x17306
movq -0x10(%rbp), %rdi
movl $0x20, %esi
callq 0xaac0
movb %al, -0x82(%rbp)
movb -0x82(%rbp), %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x71(%rbp)
testb $0x1, -0x71(%rbp)
je 0x1758f
movl -0x20(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x90(%rbp)
subl $0x18, %eax
ja 0x1758d
movq -0x90(%rbp), %rax
leaq 0x14de6(%rip), %rcx     # 0x2c134
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x34(%rcx)
cmpl $0x0, %eax
jge 0x17384
movq -0x10(%rbp), %rax
movl $0x0, 0x34(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0xab50
jmp 0x17399
xorl %edi, %edi
callq 0x16b70
leaq 0x14fdb(%rip), %rdi     # 0x2c36d
movb $0x0, %al
callq 0xd8f0
jmp 0x1758d
leaq 0x1fe2b(%rip), %rax     # 0x371d0
movq (%rax), %rax
movl $0x18, 0x10(%rax)
jmp 0x1758d
movq -0x10(%rbp), %rax
movl 0x34(%rax), %esi
movl $0x1, %edi
movl $0x2, %edx
callq 0x16910
jmp 0x1758d
movq -0x10(%rbp), %rax
movl 0x34(%rax), %esi
movl $0x4, %edi
movl $0x2, %edx
callq 0x16910
jmp 0x1758d
movq -0x10(%rbp), %rax
movl 0x34(%rax), %esi
movl $0x2, %edx
movl %edx, %edi
callq 0x16910
jmp 0x1758d
movq -0x10(%rbp), %rax
movl 0x34(%rax), %esi
movl $0x3, %edi
movl $0x2, %edx
callq 0x16910
jmp 0x1758d
leaq 0x1fcac(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
orq $0x1000, %rcx           # imm = 0x1000
leaq 0x1fc9a(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
leaq 0x1fc8f(%rip), %rdi     # 0x370d0
addq $0x50, %rdi
callq 0x123b0
leaq 0x229ff(%rip), %rax     # 0x39e50
movq (%rax), %rdi
leaq 0x1fc75(%rip), %rax     # 0x370d0
movl 0x54(%rax), %esi
leaq 0x1fc6b(%rip), %rax     # 0x370d0
movl 0x50(%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x17474
jmp 0x17488
leaq 0x229d5(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl $0x40, %esi
callq 0x64c0
jmp 0x1758d
movb $0x0, %al
callq 0xff00
jmp 0x1758d
movb $0x0, %al
callq 0xaba0
jmp 0x1758d
leaq 0x223e4(%rip), %rax     # 0x39890
movb $0x1, 0x11(%rax)
leaq 0x1fc19(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
orq $0x1, %rcx
leaq 0x1fc0a(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
xorl %edi, %edi
callq 0xf540
jmp 0x1758d
leaq 0x1fbf3(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
orq $0x4000, %rcx           # imm = 0x4000
leaq 0x1fbe1(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
jmp 0x1758d
leaq -0xd0cf(%rip), %rdi     # 0xa430
movl $0x1, %esi
movl $0x96, %edx
callq 0x9c30
jmp 0x1758d
leaq 0x22379(%rip), %rax     # 0x39890
movb $0x1, 0x16(%rax)
leaq 0x1fbae(%rip), %rax     # 0x370d0
movq 0x70(%rax), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x1758b
movq -0x80(%rbp), %rax
movl 0x5c(%rax), %ecx
andl $-0x2, %ecx
movl %ecx, 0x5c(%rax)
leaq 0x1fb8c(%rip), %rdi     # 0x370d0
addq $0x50, %rdi
callq 0x123b0
leaq 0x228fc(%rip), %rax     # 0x39e50
movq (%rax), %rdi
leaq 0x1fb72(%rip), %rax     # 0x370d0
movl 0x54(%rax), %esi
leaq 0x1fb68(%rip), %rax     # 0x370d0
movl 0x50(%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x17577
jmp 0x1758b
leaq 0x228d2(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl $0x40, %esi
callq 0x64c0
jmp 0x1758d
jmp 0x1758f
movslq -0x20(%rbp), %rcx
leaq 0x222f6(%rip), %rax     # 0x39890
testb $0x1, (%rax,%rcx)
je 0x175de
movslq -0x20(%rbp), %rcx
leaq 0x22105(%rip), %rax     # 0x396b0
cmpq $0x0, (%rax,%rcx,8)
je 0x175de
movslq -0x20(%rbp), %rcx
leaq 0x220f3(%rip), %rax     # 0x396b0
movq (%rax,%rcx,8), %rdi
callq 0x6040
movslq -0x20(%rbp), %rcx
leaq 0x220df(%rip), %rax     # 0x396b0
movq $0x0, (%rax,%rcx,8)
jmp 0x17696
movslq -0x20(%rbp), %rcx
leaq 0x222a7(%rip), %rax     # 0x39890
testb $0x1, (%rax,%rcx)
jne 0x17694
movslq -0x20(%rbp), %rcx
leaq 0x220b2(%rip), %rax     # 0x396b0
cmpq $0x0, (%rax,%rcx,8)
jne 0x17694
leaq 0x1f6d0(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
leaq -0x70(%rbp), %rdi
movslq -0x20(%rbp), %rcx
leaq 0x224eb(%rip), %rax     # 0x39b10
movq (%rax,%rcx,8), %rsi
callq 0x60d0
leaq 0x1bd61(%rip), %rdi     # 0x33396
movb $0x0, %al
callq 0xd8f0
leaq -0x70(%rbp), %rdi
leaq 0x22809(%rip), %rax     # 0x39e50
movq (%rax), %rsi
callq 0x13c10
cmpl $0x0, %eax
jne 0x17692
leaq -0x70(%rbp), %rdi
callq 0x6160
addq $0x1, %rax
movl %eax, %edi
callq 0xe520
movq %rax, %rdx
movslq -0x20(%rbp), %rcx
leaq 0x2203a(%rip), %rax     # 0x396b0
movq %rdx, (%rax,%rcx,8)
movslq -0x20(%rbp), %rcx
leaq 0x2202b(%rip), %rax     # 0x396b0
movq (%rax,%rcx,8), %rdi
leaq -0x70(%rbp), %rsi
callq 0x60d0
jmp 0x17694
jmp 0x17696
leaq 0x1f643(%rip), %rax     # 0x36ce0
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x23060
movq %rax, %rsi
leaq 0x14cd8(%rip), %rdi     # 0x2c393
movb $0x0, %al
callq 0xd8f0
callq 0x17c50
movl %eax, %ecx
leaq 0x1f634(%rip), %rax     # 0x36d04
movl %ecx, (%rax)
leaq 0x1f63a(%rip), %rax     # 0x36d13
movb $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop