// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/rings.c
// Function: ring_eat
int ring_eat()
{
	struct object *lb;
	int hand, i, howmuch;
	bool addit;

	howmuch = 0;
	addit = TRUE;
	for (i = LEFT; i <= RIGHT ; i += 1) {
		lb = cur_ring[i];
		if (lb != NULL) {
			switch (lb->o_which) {
				case R_REGEN:
				case R_GIANT:
					howmuch += 2;
				when R_SPEED:
				case R_SUSTSTR:
				case R_SUSAB:
					howmuch += 1;
				when R_SEARCH:
					howmuch += (rnd(100) < 33);
				when R_DIGEST:
					switch(lb->o_ac) {
						case -3: if (rnd(100) < 25)
									howmuch += 3;
						when -2: if (rnd(100) < 50)
									howmuch += 2;
						when -1: howmuch += 1;
						when  0: howmuch -= (rnd(100) < 50);
						when  3: if (rnd(100) < 25)
									howmuch -= 3;
						when  2: if (rnd(100) < 50)
									howmuch -= 2;
						default: howmuch -= 1;
					}
				otherwise:
					addit = FALSE;
			}
			if (addit) {
				if (o_on(lb, ISBLESS))
					howmuch -= 1;
				else if (o_on(lb, ISCURSED))
					howmuch += 1;
			}
		}
	}
	return howmuch;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x14(%rbp)
movb $0x1, -0x15(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x1, -0x10(%rbp)
jg 0x17e30
movslq -0x10(%rbp), %rcx
leaq 0x1f541(%rip), %rax     # 0x371c0
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x17e20
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x11, %eax
ja 0x17dd4
movq -0x20(%rbp), %rax
leaq 0x14546(%rip), %rcx     # 0x2c1fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x14(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd8
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x21, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd8
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
addl $0x3, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x6, %eax
ja 0x17dc9
movq -0x28(%rbp), %rax
leaq 0x14523(%rip), %rcx     # 0x2c244
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x19, %eax
jge 0x17d44
movl -0x14(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd2
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x32, %eax
jge 0x17d63
movl -0x14(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd2
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x32, %eax
setl %al
andb $0x1, %al
movzbl %al, %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd2
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x19, %eax
jge 0x17dab
movl -0x14(%rbp), %eax
subl $0x3, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd2
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x32, %eax
jge 0x17dc7
movl -0x14(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dc9
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x17dd8
movb $0x0, -0x15(%rbp)
testb $0x1, -0x15(%rbp)
je 0x17e1e
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0xaac0
testb $0x1, %al
jne 0x17df2
jmp 0x17dfd
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x17e1c
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xaac0
testb $0x1, %al
jne 0x17e11
jmp 0x17e1a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x17e1c
jmp 0x17e1e
jmp 0x17e20
jmp 0x17e22
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x17c6a
movl -0x14(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)