// File: /workspace/github_c_makefile_star2_O3/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:
movl $0x3c, 0x907f(%rip)     # 0xc168
movl $0x0, 0x9071(%rip)      # 0xc164
movl 0x6c57(%rip), %eax      # 0x9d50
testl %eax, %eax
jle 0x32cb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x6c35(%rip), %r13      # 0x9d48
leaq 0x377f(%rip), %r15      # 0x6899
xorl %ebx, %ebx
testb $0x2, (%r13)
je 0x3138
movq 0x6d8e(%rip), %rcx      # 0x9eb8
movslq 0x10(%r13), %rdx
cmpl $0x0, (%rcx,%rdx,4)
je 0x32af
movl 0x9026(%rip), %edx      # 0xc164
incl %edx
movl %edx, 0x901e(%rip)      # 0xc164
movl 0x901c(%rip), %eax      # 0xc168
leal 0x1(%rax), %ecx
movl %ecx, 0x9013(%rip)      # 0xc168
cmpl $0x3b, %eax
jl 0x3173
leaq 0x8f6f(%rip), %rdi      # 0xc0d0
leaq 0x68f8(%rip), %rsi      # 0x9a60
callq 0x534c
movl 0x8ff1(%rip), %edx      # 0xc164
movq 0x6d26(%rip), %rdi      # 0x9ea0
leaq 0x371a(%rip), %rsi      # 0x689b
xorl %eax, %eax
callq 0x2110
movl (%r13), %eax
movl 0x14(%r13), %r14d
movslq 0x10(%r13), %rbp
andl $0x11, %eax
movq 0x6d02(%rip), %rcx      # 0x9ea0
cmpl $0x11, %eax
je 0x31bf
testl %eax, %eax
jne 0x31d5
movl $0xb, %esi
movl $0x1, %edx
leaq 0x36ae(%rip), %rdi      # 0x6866
callq 0x2180
jmp 0x31f0
movq 0x6cf2(%rip), %rax      # 0x9eb8
movl (%rax,%rbp,4), %edx
movq %rcx, %rdi
leaq 0x369f(%rip), %rsi      # 0x6872
jmp 0x31e9
movq 0x6cdc(%rip), %rax      # 0x9eb8
movl (%rax,%rbp,4), %edx
movq %rcx, %rdi
leaq 0x3693(%rip), %rsi      # 0x687c
xorl %eax, %eax
callq 0x2110
movq 0x6ca9(%rip), %rdi      # 0x9ea0
leaq 0x4(%r13), %rdx
leaq 0x3684(%rip), %rsi      # 0x6886
xorl %eax, %eax
callq 0x2110
testl %r14d, %r14d
jle 0x3298
incq %rbp
xorl %r12d, %r12d
cmpl $0x8, %r12d
jl 0x3272
movl 0x8f44(%rip), %eax      # 0xc168
leal 0x1(%rax), %ecx
movl %ecx, 0x8f3b(%rip)      # 0xc168
cmpl $0x3b, %eax
jl 0x3245
leaq 0x8e97(%rip), %rdi      # 0xc0d0
leaq 0x6820(%rip), %rsi      # 0x9a60
callq 0x534c
movl 0x8f19(%rip), %edx      # 0xc164
incl %edx
movl %edx, 0x8f11(%rip)      # 0xc164
movq 0x6c46(%rip), %rdi      # 0x9ea0
xorl %r12d, %r12d
leaq 0x362b(%rip), %rsi      # 0x688f
leaq 0x34d3(%rip), %rcx      # 0x673e
xorl %eax, %eax
callq 0x2110
movq 0x6c27(%rip), %rdi      # 0x9ea0
movq 0x6c38(%rip), %rax      # 0x9eb8
movl (%rax,%rbp,4), %edx
movq %r15, %rsi
xorl %eax, %eax
callq 0x2110
incl %r12d
incq %rbp
decq %r14
jne 0x3218
movq 0x6c01(%rip), %rsi      # 0x9ea0
movl $0xa, %edi
callq 0x20c0
movl 0x6aa1(%rip), %eax      # 0x9d50
incl %ebx
addq $0x18, %r13
cmpl %eax, %ebx
jl 0x311c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq