// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/outarget.c
// Function: get_seg
void get_seg( result, fixup, ref_mode, data, seg_reg )
    char    *result;
    FIX_T   *fixup;
    int     ref_mode;
    void    *data;
    int     seg_reg;
{
    char    *this_name;
    int     form;
    int     mode;
    int     index;
    int     ref_seg;
    EXT_T   *ext_rec;
    PUB_T   *pub_rec;

    form  = fixup->form;
    mode  = fixup->a_mode;
    index = fixup->a_index;

    strcpy( result, "" );

    if ( mode == TARGET || mode == NONE ) {
        return;
    }

    /*
    ** Check for Externals with implied or lacking segment
    **  This means that the fixup tells that the external was defined in
    **  that segment (for implied, SI:EI). Or that the external was defined
    **  outside any segment (for lacking, EI:EI).
    */
    if ( fixup->b_mode == EXTERNAL ) {
        ext_rec = data;
        if ( mode == EXTERNAL ) {
            /* Must be EI:EI */
            ext_rec->used = -1;         /* Remove from any segments! */
            return;
        }
        if ( mode == SEGMENT ) {
            ext_rec->pos_abs = FALSE;
            if ( ref_mode != 0 ) {
                /* Must be Segment:EI */
                if ( pass == 1 && ext_rec->used == 0 ) {
                    sex_insert( index, ext_rec );
                    ext_rec->used = index;
                }
                if ( ext_rec->used == index ) {
                    return;
                }
            }
        }
    } else {
        if ( fixup->b_mode == SEGMENT ) {
            pub_rec = data;
            if ( ref_mode == 2 && (ref_mode == 1 && form == POINTER) ) {
                if ( pub_rec->seg_idx == index ) {
                    return;
                }
            }
        }
    }

    /*
    ** On first important fixup, assign the "ASSIGN xx:" values
    */
    if ( ref_mode == 0 || (ref_mode == 1 && form != POINTER) ) {
        ref_seg = seg_reg - ES;                 /* Convert to 0,1,2,3,etc */
        seg_rec->new_mode [ref_seg] = mode;
        seg_rec->new_index[ref_seg] = index;
        if ( mode == SEGMENT ) {
            if ( fixup->b_mode == EXTERNAL && ext_rec->used == index ) {
                return;
            }
        }
        if ( mode == SEGMENT || mode == GROUP ) {
            if ( fixup->b_mode == SEGMENT || fixup->b_mode == EXTERNAL ) {
                return;
            }
        }
        /*
        ** Frame on a code reference is always taken from the assume?
        */
    }

    if ( form == BASE ) {
        if ( fixup->b_mode == mode && fixup->b_index == index ) {
            return;
        }
    }

    this_name = mode_name( mode, index );
    if ( this_name ) {
        sprintf( result, "%s:", this_name );
        return;
    } else {
        return;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5c5c(%rip), %rsi      # 0x181c0
callq 0x9060
cmpl $0x5, -0x38(%rbp)
je 0x12575
cmpl $0x6, -0x38(%rbp)
jne 0x1257a
jmp 0x12713
movq -0x10(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jne 0x125fc
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x2, -0x38(%rbp)
jne 0x125a2
movq -0x48(%rbp), %rax
movl $0xffffffff, 0x48(%rax) # imm = 0xFFFFFFFF
jmp 0x12713
cmpl $0x0, -0x38(%rbp)
jne 0x125fa
movq -0x48(%rbp), %rax
movl $0x0, 0x30(%rax)
cmpl $0x0, -0x14(%rbp)
je 0x125f8
leaq 0xdb78(%rip), %rax      # 0x20138
cmpl $0x1, (%rax)
jne 0x125e5
movq -0x48(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jne 0x125e5
movl -0x3c(%rbp), %edi
movq -0x48(%rbp), %rsi
callq 0x11d80
movl -0x3c(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x48(%rbp), %rax
movl 0x48(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x125f6
jmp 0x12713
jmp 0x125f8
jmp 0x125fa
jmp 0x12636
movq -0x10(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x12634
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpl $0x2, -0x14(%rbp)
jne 0x12632
cmpl $0x1, -0x14(%rbp)
jne 0x12632
cmpl $0x3, -0x34(%rbp)
jne 0x12632
movq -0x50(%rbp), %rax
movl (%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x12630
jmp 0x12713
jmp 0x12632
jmp 0x12634
jmp 0x12636
cmpl $0x0, -0x14(%rbp)
je 0x12648
cmpl $0x1, -0x14(%rbp)
jne 0x126c1
cmpl $0x3, -0x34(%rbp)
je 0x126c1
movl -0x24(%rbp), %eax
subl $0x11, %eax
movl %eax, -0x40(%rbp)
movl -0x38(%rbp), %edx
leaq 0xdb65(%rip), %rax      # 0x201c0
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, 0x1c(%rax,%rcx,4)
movl -0x3c(%rbp), %edx
leaq 0xdb50(%rip), %rax      # 0x201c0
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, 0x34(%rax,%rcx,4)
cmpl $0x0, -0x38(%rbp)
jne 0x1269b
movq -0x10(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jne 0x12699
movq -0x48(%rbp), %rax
movl 0x48(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x12699
jmp 0x12713
jmp 0x1269b
cmpl $0x0, -0x38(%rbp)
je 0x126a7
cmpl $0x1, -0x38(%rbp)
jne 0x126bf
movq -0x10(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0x126bb
movq -0x10(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jne 0x126bd
jmp 0x12713
jmp 0x126bf
jmp 0x126c1
cmpl $0x2, -0x34(%rbp)
jne 0x126e3
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
cmpl -0x38(%rbp), %eax
jne 0x126e1
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x126e1
jmp 0x12713
jmp 0x126e3
movl -0x38(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x122d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x12711
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x5658(%rip), %rsi      # 0x17d60
movb $0x0, %al
callq 0x9190
jmp 0x12713
jmp 0x12713
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)