// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/rip.c
// Function: showtop
bool showtop(int showname)
{
	int fd, i;
	char *killer;
	struct sc_ent *scp;

	if ((fd = open(scorefile, O_RDONLY)) < 0)
		return FALSE;
       
        for(i = 0; i < 10; i++)
        {
            unsigned int mon;
            encread((char *) &top_ten[i].sc_name, LINLEN, fd);
            encread((char *) scoreline, 100, fd);
            sscanf(scoreline, " %d %d %d %d %u %d %ld %lx \n",
                &top_ten[i].sc_score,   &top_ten[i].sc_flags,
                &top_ten[i].sc_level,   &top_ten[i].sc_uid,
                &mon,                   &top_ten[i].sc_explvl,
                &top_ten[i].sc_exppts,  &top_ten[i].sc_date);
            top_ten[i].sc_monster = mon;
        }
	close(fd);
	printf("Top Ten Adventurers:\nRank\tScore\tName\n");
	for (scp = top_ten; scp <= &top_ten[9]; scp++) {
		if (scp->sc_score > 0) {
			printf("%ld\t%d\t%s: %s\t\t--> %s on level %d",
			  scp - top_ten + 1, scp->sc_score, scp->sc_name,
			  ctime(&scp->sc_date), reason[scp->sc_flags],
			  scp->sc_level);
			if (scp->sc_flags == KILLED) {
				killer = killname(scp->sc_monster);
				printf(" by a%s %s",vowelstr(killer), killer);
			}
			printf(" [Exp: %d/%ld]",scp->sc_explvl,scp->sc_exppts);
			if (showname) {
				struct passwd *pp, *getpwuid();

				if ((pp = getpwuid(scp->sc_uid)) == NULL)
					printf(" (%d)\n", scp->sc_uid);
				else
					printf(" (%s)\n", pp->pw_name);
			}
			else
				printf("\n");
		}
	}
	return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x68, %rsp
movl %edi, -0x10(%rbp)
leaq 0x1e53d(%rip), %rdi     # 0x37490
xorl %esi, %esi
movb $0x0, %al
callq 0x6450
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jge 0x18f6d
movb $0x0, -0x9(%rbp)
jmp 0x19226
movl $0x0, -0x18(%rbp)
cmpl $0xa, -0x18(%rbp)
jge 0x1909f
movslq -0x18(%rbp), %rax
leaq 0x233b7(%rip), %rdi     # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movl -0x14(%rbp), %edx
movl $0x50, %esi
callq 0x1bc90
movl -0x14(%rbp), %edx
leaq 0x23845(%rip), %rdi     # 0x3c7f0
movl $0x64, %esi
callq 0x1bc90
movslq -0x18(%rbp), %rax
leaq 0x23380(%rip), %rdx     # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %rdx
movslq -0x18(%rbp), %rax
leaq 0x2336e(%rip), %rcx     # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %rcx
addq $0x54, %rcx
movslq -0x18(%rbp), %rax
leaq 0x23358(%rip), %r8      # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %r8
addq $0x58, %r8
movslq -0x18(%rbp), %rax
leaq 0x23342(%rip), %r9      # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %r9
addq $0x5c, %r9
movslq -0x18(%rbp), %rax
leaq 0x2332c(%rip), %r11     # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %r11
addq $0x64, %r11
movslq -0x18(%rbp), %rax
leaq 0x23316(%rip), %r10     # 0x3c340
imulq $0x78, %rax, %rax
addq %rax, %r10
addq $0x68, %r10
movslq -0x18(%rbp), %rsi
leaq 0x23300(%rip), %rax     # 0x3c340
imulq $0x78, %rsi, %rsi
addq %rsi, %rax
addq $0x70, %rax
leaq 0x2379e(%rip), %rdi     # 0x3c7f0
leaq 0x13464(%rip), %rsi     # 0x2c4bd
leaq -0x2c(%rbp), %rbx
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x6370
movl -0x2c(%rbp), %eax
movb %al, %cl
movslq -0x18(%rbp), %rdx
leaq 0x232b9(%rip), %rax     # 0x3c340
imulq $0x78, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x60(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x18f74
movl -0x14(%rbp), %edi
callq 0x6230
leaq 0x1342c(%rip), %rdi     # 0x2c4da
movb $0x0, %al
callq 0x61b0
leaq 0x23284(%rip), %rax     # 0x3c340
movq %rax, -0x28(%rbp)
leaq 0x23279(%rip), %rax     # 0x3c340
addq $0x438, %rax            # imm = 0x438
cmpq %rax, -0x28(%rbp)
ja 0x19222
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x1920f
movq -0x28(%rbp), %rax
leaq 0x23251(%rip), %rcx     # 0x3c340
subq %rcx, %rax
movl $0x78, %ecx
cqto
idivq %rcx
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
addq $0x70, %rdi
callq 0x6150
movq -0x50(%rbp), %rsi
movl -0x44(%rbp), %edx
movq -0x40(%rbp), %rcx
movq %rax, %r8
movq -0x28(%rbp), %rax
movslq 0x54(%rax), %rdi
leaq 0x1d40d(%rip), %rax     # 0x36550
movq (%rax,%rdi,8), %r9
movq -0x28(%rbp), %rax
movl 0x58(%rax), %eax
leaq 0x133ab(%rip), %rdi     # 0x2c500
movl %eax, (%rsp)
movb $0x0, %al
callq 0x61b0
movq -0x28(%rbp), %rax
cmpl $0x0, 0x54(%rax)
jne 0x19198
movq -0x28(%rbp), %rax
movzbl 0x60(%rax), %edi
callq 0x18560
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xff50
movq %rax, %rsi
movq -0x20(%rbp), %rdx
leaq 0x13391(%rip), %rdi     # 0x2c522
movb $0x0, %al
callq 0x61b0
movq -0x28(%rbp), %rax
movl 0x64(%rax), %esi
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x1337f(%rip), %rdi     # 0x2c52d
movb $0x0, %al
callq 0x61b0
cmpl $0x0, -0x10(%rbp)
je 0x191ff
movq -0x28(%rbp), %rax
movl 0x5c(%rax), %edi
callq 0x6140
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x191e8
movq -0x28(%rbp), %rax
movl 0x5c(%rax), %esi
leaq 0x1335d(%rip), %rdi     # 0x2c53c
movb $0x0, %al
callq 0x61b0
jmp 0x191fd
movq -0x38(%rbp), %rax
movq (%rax), %rsi
leaq 0x1334d(%rip), %rdi     # 0x2c543
movb $0x0, %al
callq 0x61b0
jmp 0x1920d
leaq 0x150a8(%rip), %rdi     # 0x2e2ae
movb $0x0, %al
callq 0x61b0
jmp 0x1920f
jmp 0x19211
movq -0x28(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x28(%rbp)
jmp 0x190c0
movb $0x1, -0x9(%rbp)
movb -0x9(%rbp), %al
andb $0x1, %al
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)