// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/oreport.c
// Function: print_ext
void print_ext( ext_rec )
    EXT_T   *ext_rec;
{
    char            operand[80];
    char            *var_type;
    char            *label;
    int             type;
    NODE_T          *pub_node;
    PUB_T           *pub_rec;

    /*
    ** Make sure name doesn't already exist as a public symbol
    */
    pub_node = start( public_tree, RIGHT );
    while ( pub_node != public_tree ) {
        pub_rec = (PUB_T *)pub_node->data;
        if ( strcmp(pub_rec->name, ext_rec->name) == 0 ) {
            return;
        }
        pub_node = traverse( pub_node, RIGHT );
    }

    if ( ext_rec->scope ) {
        label = "";
    } else {
        label = ";Static";
    }

    if ( ext_rec->com_ext == 0 ) {
        if ( ext_rec->type == UNKNOWN && ext_rec->pos_abs == FALSE ) {
            ext_rec->type = NEAR;
        }
        sprintf( operand, "%s:%s", ext_rec->name, ext_type[ext_rec->type] );
        out_label( label );
        out_opcode( "EXTRN" );
        tab_seek(3);
        out_operand( operand );
    } else {
        switch( ext_rec->var_type ) {
            case 0x61:
                var_type = "COMM FAR";
                break;
            case 0x62:
                var_type = "COMM";
                break;
            default:
                fmt_error( "Unknown Communal Variable Type" );
                break;
        }
        type = ext_rec->type;

        sprintf( operand, "%s:%s:%ld", ext_rec->name, ext_type[type], 
                                                            ext_rec->size );
        out_label( label );
        if ( ext_rec->var_type == 0x62 ) {
            tab_seek(3);
        }
        out_opcode( var_type );
        out_operand( operand );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xf1f2(%rip), %rax      # 0x20178
movq (%rax), %rdi
movl $0x1, %esi
callq 0x16d10
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
leaq 0xf1d6(%rip), %rcx      # 0x20178
cmpq (%rcx), %rax
je 0x10fec
movq -0x80(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
callq 0x9100
cmpl $0x0, %eax
jne 0x10fd8
jmp 0x11142
movq -0x80(%rbp), %rdi
movl $0x1, %esi
callq 0x16d70
movq %rax, -0x80(%rbp)
jmp 0x10f97
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
je 0x11003
leaq 0x71c3(%rip), %rax      # 0x181c0
movq %rax, -0x70(%rbp)
jmp 0x1100e
leaq 0x6fcf(%rip), %rax      # 0x17fd9
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jne 0x11091
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jne 0x11037
movq -0x8(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x11037
movq -0x8(%rbp), %rax
movl $0x1, 0x2c(%rax)
leaq -0x60(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x4, %rdx
movq -0x8(%rbp), %rax
movslq 0x2c(%rax), %rcx
leaq 0xbbee(%rip), %rax      # 0x1cc40
movq (%rax,%rcx,8), %rcx
leaq 0x6f84(%rip), %rsi      # 0x17fe1
movb $0x0, %al
callq 0x9190
movq -0x70(%rbp), %rdi
callq 0xe110
leaq 0x6f73(%rip), %rdi      # 0x17fe7
callq 0xe150
movl $0x3, %edi
callq 0xe030
leaq -0x60(%rbp), %rdi
callq 0xe190
jmp 0x11142
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x8c(%rbp)
subl $0x61, %eax
je 0x110b2
jmp 0x110a5
movl -0x8c(%rbp), %eax
subl $0x62, %eax
je 0x110bf
jmp 0x110cc
leaq 0x6f34(%rip), %rax      # 0x17fed
movq %rax, -0x68(%rbp)
jmp 0x110d8
leaq 0x6f30(%rip), %rax      # 0x17ff6
movq %rax, -0x68(%rbp)
jmp 0x110d8
leaq 0x6f28(%rip), %rdi      # 0x17ffb
callq 0x16e00
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x4, %rdx
movslq -0x74(%rbp), %rcx
leaq 0xbb47(%rip), %rax      # 0x1cc40
movq (%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %r8
leaq 0x6f0e(%rip), %rsi      # 0x1801a
movb $0x0, %al
callq 0x9190
movq -0x70(%rbp), %rdi
callq 0xe110
movq -0x8(%rbp), %rax
cmpl $0x62, 0x38(%rax)
jne 0x11130
movl $0x3, %edi
callq 0xe030
movq -0x68(%rbp), %rdi
callq 0xe150
leaq -0x60(%rbp), %rdi
callq 0xe190
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)