// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/rings.c
// Function: toss_ring
void toss_ring(struct object *what)
{
	bool okring;

	/*
	 * okring = FALSE when:
	 * 1) ring is cursed and benefit = plus
	 * 2) ring is blessed and benefit = minus
	 */
	okring = !((what->o_ac > 0 && o_on(what, ISCURSED)) ||
	          (what->o_ac < 0 && o_on(what, ISBLESS)));

	cur_ring[what == cur_ring[LEFT] ? LEFT : RIGHT] = NULL;
	if (okring) {
		switch (what->o_which) {
			case R_SPEED:
				extinguish(nohaste);
				nohaste(FALSE);
			when R_BLIND:
				sight(FALSE);
			when R_SLOW:
				player.t_flags &= ~ISSLOW;
			when R_SAPEM:
				extinguish(sapem);
			when R_GIANT:
				him->s_ef = him->s_re;
				ringabil();
			when R_ADDSTR:
				chg_abil(STR,-what->o_ac,FALSE);
			when R_KNOW:
				chg_abil(WIS,-what->o_ac,FALSE);
			when R_DEX:
				chg_abil(DEX,-what->o_ac,FALSE);
			when R_CONST:
				chg_abil(CON,-what->o_ac,FALSE);
			when R_SEEINVIS:
				player.t_flags &= ~CANSEE;
				extinguish(unsee);
				light(&hero);
				mvwaddch(cw, hero.y, hero.x, PLAYER);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jle 0x17a50
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xaac0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xa(%rbp)
jne 0x17a76
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x34(%rcx)
movb %al, -0xb(%rbp)
jge 0x17a70
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0xaac0
movb %al, -0xb(%rbp)
movb -0xb(%rbp), %al
movb %al, -0xa(%rbp)
movb -0xa(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rdx
leaq 0x1f735(%rip), %rax     # 0x371c0
movq (%rax), %rsi
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movslq %eax, %rcx
leaq 0x1f71b(%rip), %rax     # 0x371c0
movq $0x0, (%rax,%rcx,8)
testb $0x1, -0x9(%rbp)
je 0x17c49
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x18, %eax
ja 0x17c47
movq -0x18(%rbp), %rax
leaq 0x146be(%rip), %rcx     # 0x2c198
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0xd9ca(%rip), %rdi     # 0xa120
callq 0x9cd0
xorl %edi, %edi
movb $0x0, %al
callq 0xa120
jmp 0x17c47
xorl %edi, %edi
movb $0x0, %al
callq 0xa0c0
jmp 0x17c47
leaq 0x1f5be(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
andq $-0x4001, %rcx          # imm = 0xBFFF
leaq 0x1f5ac(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
jmp 0x17c47
leaq -0xd704(%rip), %rdi     # 0xa430
callq 0x9cd0
jmp 0x17c47
leaq 0x1f68b(%rip), %rax     # 0x371d0
movq (%rax), %rax
leaq 0x1f681(%rip), %rcx     # 0x371d0
movq (%rcx), %rcx
movq (%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x18(%rax)
callq 0x17f30
jmp 0x17c47
movq -0x8(%rbp), %rax
xorl %esi, %esi
subl 0x34(%rax), %esi
movl $0x1, %edi
xorl %edx, %edx
callq 0x16910
jmp 0x17c47
movq -0x8(%rbp), %rax
xorl %esi, %esi
subl 0x34(%rax), %esi
movl $0x4, %edi
xorl %edx, %edx
callq 0x16910
jmp 0x17c47
movq -0x8(%rbp), %rax
xorl %esi, %esi
subl 0x34(%rax), %esi
movl $0x2, %edi
xorl %edx, %edx
callq 0x16910
jmp 0x17c47
movq -0x8(%rbp), %rax
xorl %esi, %esi
subl 0x34(%rax), %esi
movl $0x3, %edi
xorl %edx, %edx
callq 0x16910
jmp 0x17c47
leaq 0x1f4f9(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
andq $-0x1001, %rcx          # imm = 0xEFFF
leaq 0x1f4e7(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
leaq -0xdb64(%rip), %rdi     # 0xa090
callq 0x9cd0
leaq 0x1f4d0(%rip), %rdi     # 0x370d0
addq $0x50, %rdi
callq 0x123b0
leaq 0x22240(%rip), %rax     # 0x39e50
movq (%rax), %rdi
leaq 0x1f4b6(%rip), %rax     # 0x370d0
movl 0x54(%rax), %esi
leaq 0x1f4ac(%rip), %rax     # 0x370d0
movl 0x50(%rax), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x17c33
jmp 0x17c47
leaq 0x22216(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl $0x40, %esi
callq 0x64c0
jmp 0x17c49
addq $0x20, %rsp
popq %rbp
retq
nop