// File: /workspace/github_c_makefile_star2_O0/hughbarney[P]pEmacs/random.c
// Function: showcpos
int showcpos(int f, int n)
{
	LINE *lp;	/* current line */
	long numchars;	/* # of chars in file */
	int numlines;	/* # of lines in file */
	long predchars;	/* # chars preceding point */
	int predlines;	/* # lines preceding point */
	int curchar;	/* character under cursor */
	int ratio;
	int col;
	int savepos;		/* temp save for current offset */
	int ecol;		/* column pos/end of current line */

	/* starting at the beginning of the buffer */
	lp = lforw(curbp->b_linep);

	/* start counting chars and lines */
	numchars = 0;
	numlines = 0;
	predchars = 0;
	predlines = 0;
	curchar = 0;
	while (lp != curbp->b_linep) {
		/* if we are on the current line, record it */
		if (lp == curwp->w_dotp) {
			predlines = numlines;
			predchars = numchars + curwp->w_doto;
			if ((curwp->w_doto) == llength(lp))
				curchar = '\n';
			else
				curchar = lgetc(lp, curwp->w_doto);
		}
		/* on to the next line */
		++numlines;
		numchars += llength(lp) + 1;
		lp = lforw(lp);
	}

	/* if at end of file, record it */
	if (curwp->w_dotp == curbp->b_linep) {
		predlines = numlines;
		predchars = numchars;
	}

	/* Get real column and end-of-line column. */
	col = getccol(FALSE);
	savepos = curwp->w_doto;
	curwp->w_doto = llength(curwp->w_dotp);
	ecol = getccol(FALSE);
	curwp->w_doto = savepos;

	ratio = 0;		/* Ratio before dot. */
	if (numchars != 0)
		ratio = (100L * predchars) / numchars;

	/* summarize and report the info */
	mlwrite("Line %d/%d Col %d/%d Char %d/%d (%d%%) char = 0x%x",
		predlines + 1, numlines + 1, col, ecol,
		predchars, numchars, ratio, curchar);
	return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
leaq 0x8383(%rip), %rax      # 0x10a48
movq (%rax), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
leaq 0x8345(%rip), %rcx      # 0x10a48
movq (%rcx), %rcx
cmpq 0x28(%rcx), %rax
je 0x87b2
movq -0x10(%rbp), %rax
leaq 0x833d(%rip), %rcx      # 0x10a58
movq (%rcx), %rcx
cmpq 0x18(%rcx), %rax
jne 0x8785
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
leaq 0x8323(%rip), %rcx      # 0x10a58
movq (%rcx), %rcx
addq 0x20(%rcx), %rax
movq %rax, -0x28(%rbp)
leaq 0x8311(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x14(%rcx), %rcx
cmpq %rcx, %rax
jne 0x8764
movl $0xa, -0x30(%rbp)
jmp 0x8783
movq -0x10(%rbp), %rax
leaq 0x82e9(%rip), %rcx      # 0x10a58
movq (%rcx), %rcx
movq 0x20(%rcx), %rcx
movsbl 0x18(%rax,%rcx), %eax
andl $0xff, %eax
movl %eax, -0x30(%rbp)
jmp 0x8785
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x1, %eax
cltq
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x86f8
leaq 0x829f(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x18(%rax), %rax
leaq 0x8281(%rip), %rcx      # 0x10a48
movq (%rcx), %rcx
cmpq 0x28(%rcx), %rax
jne 0x87de
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
xorl %edi, %edi
callq 0x88a0
movl %eax, -0x38(%rbp)
leaq 0x8269(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x20(%rax), %rax
movl %eax, -0x3c(%rbp)
leaq 0x8258(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq 0x18(%rax), %rax
movslq 0x14(%rax), %rcx
leaq 0x8246(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq %rcx, 0x20(%rax)
xorl %edi, %edi
callq 0x88a0
movl %eax, -0x40(%rbp)
movslq -0x3c(%rbp), %rcx
leaq 0x822a(%rip), %rax      # 0x10a58
movq (%rax), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8851
imulq $0x64, -0x28(%rbp), %rax
cqto
idivq -0x18(%rbp)
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %esi
addl $0x1, %esi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movl -0x38(%rbp), %ecx
movl -0x40(%rbp), %r8d
movq -0x28(%rbp), %r9
movq -0x18(%rbp), %r11
movl -0x34(%rbp), %r10d
movl -0x30(%rbp), %eax
leaq 0x3d34(%rip), %rdi      # 0xc5ae
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x56d0
movl $0x1, %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)