// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: printCrossReference
void printCrossReference()
{
    int    ix;
    int    xc;
    int    xc_index;
    int    xc_refcount;
    int    xc_cols;
    SYM_T  *sym;

    /* Force top of form for first page. */
    page_lineno = LIST_LINES_PER_PAGE;

    list_lineno = 0;

    for( ix = 0, sym = symtab; ix < symbol_top; ix++, sym++ ) {
	if (M_FIXED(sym->type) && xreftab[sym->xref_index] == 0)
	    continue;
	list_lineno++;
	page_lineno++;
	if( page_lineno >= LIST_LINES_PER_PAGE )
	    topOfForm( list_title, s_xref );

	fprintf( listfile, "%5d", list_lineno );

	/* Get reference count & index into concordance table for this symbol */
	xc_refcount = sym->xref_count;
	xc_index = sym->xref_index;
	/* Determine how to label symbol on concordance. */
	/* XXX flag variables? */
	switch( sym->type & ( DEFINED | REDEFINED )) {
	case UNDEFINED:
	    fprintf( listfile, " U         ");
	    break;

	case REDEFINED:
	    fprintf( listfile, " M  %5d  ", xreftab[xc_index] );
	    break;

	default:
	    fprintf( listfile, " A  %5d  ", xreftab[xc_index] );
	    break;
	}
	fprintf( listfile, "%-6.6s  ", sym->name );

	/* Output the references, 8 numbers per line after symbol name. */
	for( xc_cols = 0, xc = 1; xc < xc_refcount + 1; xc++, xc_cols++ ) {
	    if( xc_cols >= XREF_COLUMNS ) {
		xc_cols = 0;
		page_lineno++;
		if( page_lineno >= LIST_LINES_PER_PAGE )
		    topOfForm( list_title, s_xref);
		list_lineno++;
		fprintf( listfile, "\n%5d%-19s", list_lineno, " " );
	    }
	    fprintf( listfile, "  %5d", xreftab[xc_index + xc] );
	}
	fprintf( listfile, "\n" );
    } /* for */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x3c, 0x92f6(%rip)     # 0xc168
andl $0x0, 0x92eb(%rip)      # 0xc164
movq 0x6ec8(%rip), %rbp      # 0x9d48
movl 0x6eca(%rip), %eax      # 0x9d50
leaq 0x3881(%rip), %r15      # 0x670e
leaq 0x39d5(%rip), %r13      # 0x6869
xorl %r12d, %r12d
cmpl %eax, %r12d
jge 0x303c
testb $0x2, (%rbp)
je 0x2ebb
movq 0x700b(%rip), %rcx      # 0x9eb8
movslq 0x10(%rbp), %rdx
cmpl $0x0, (%rcx,%rdx,4)
je 0x3030
movl 0x92a3(%rip), %edx      # 0xc164
incl %edx
movl %edx, 0x929b(%rip)      # 0xc164
movl 0x9299(%rip), %eax      # 0xc168
leal 0x1(%rax), %ecx
movl %ecx, 0x9290(%rip)      # 0xc168
cmpl $0x3b, %eax
jl 0x2ef6
leaq 0x91ec(%rip), %rdi      # 0xc0d0
leaq 0x6b75(%rip), %rsi      # 0x9a60
callq 0x4d45
movl 0x926e(%rip), %edx      # 0xc164
movq 0x6fa3(%rip), %rdi      # 0x9ea0
leaq 0x3967(%rip), %rsi      # 0x686b
xorl %eax, %eax
callq 0x2110
movl (%rbp), %eax
movl 0x14(%rbp), %ebx
movslq 0x10(%rbp), %r14
andl $0x11, %eax
movq 0x6f81(%rip), %rcx      # 0x9ea0
cmpl $0x11, %eax
movl %r12d, 0x4(%rsp)
je 0x2f41
testl %eax, %eax
jne 0x2f58
leaq 0x3902(%rip), %rdi      # 0x6836
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x2180
jmp 0x2f74
movq 0x6f70(%rip), %rax      # 0x9eb8
movl (%rax,%r14,4), %edx
movq %rcx, %rdi
leaq 0x38ec(%rip), %rsi      # 0x6842
jmp 0x2f6d
movq 0x6f59(%rip), %rax      # 0x9eb8
movl (%rax,%r14,4), %edx
movq %rcx, %rdi
leaq 0x38df(%rip), %rsi      # 0x684c
xorl %eax, %eax
callq 0x2110
movq 0x6f25(%rip), %rdi      # 0x9ea0
leaq 0x4(%rbp), %rdx
xorl %r12d, %r12d
leaq 0x38cd(%rip), %rsi      # 0x6856
xorl %eax, %eax
callq 0x2110
testl %ebx, %ebx
cmovlel %r12d, %ebx
incq %r14
subq $0x1, %rbx
jb 0x3016
cmpl $0x8, %r12d
jl 0x2ff5
movl 0x91bd(%rip), %eax      # 0xc168
leal 0x1(%rax), %ecx
movl %ecx, 0x91b4(%rip)      # 0xc168
cmpl $0x3b, %eax
jl 0x2fcc
leaq 0x9110(%rip), %rdi      # 0xc0d0
leaq 0x6a99(%rip), %rsi      # 0x9a60
callq 0x4d45
movl 0x9192(%rip), %edx      # 0xc164
incl %edx
movl %edx, 0x918a(%rip)      # 0xc164
movq 0x6ebf(%rip), %rdi      # 0x9ea0
xorl %r12d, %r12d
leaq 0x3874(%rip), %rsi      # 0x685f
movq %r15, %rcx
xorl %eax, %eax
callq 0x2110
movq 0x6ea4(%rip), %rdi      # 0x9ea0
movq 0x6eb5(%rip), %rax      # 0x9eb8
movl (%rax,%r14,4), %edx
movq %r13, %rsi
xorl %eax, %eax
callq 0x2110
incl %r12d
jmp 0x2f96
movq 0x6e83(%rip), %rsi      # 0x9ea0
pushq $0xa
popq %rdi
callq 0x20c0
movl 0x6d25(%rip), %eax      # 0x9d50
movl 0x4(%rsp), %r12d
incl %r12d
addq $0x18, %rbp
jmp 0x2e97
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq