// File: /workspace/github_c_makefile_star2_O2/Nico01[P]obj2asm/oprocess.c
// Function: proc_label
int proc_label()
{
    char            text[50];
    dword   past_seg;
    char            *size_text;

    if ( pub_rec->type == FAR ) { 
        size_text = "THIS FAR";
    } else {
        size_text = "THIS NEAR";
    }

    if ( pass == 3 ) {
        if ( pub_rec->offset >= seg_rec->length ) {
            past_seg = pub_rec->offset - seg_rec->length;
            if ( past_seg == 0 ) {
                strcpy( text, "$" );
            } else {
                sprintf( text, "$ + 0%04Xh", size_text, past_seg );
            }
            out_line( pub_rec->name, "=", text, "" );
        } else {
            if ( pub_rec->type == FAR ) {
                out_line( pub_rec->name, "equ", "THIS FAR", "" );
            } else {
                if ( pub_rec->type == NEAR ) {
                    /* Put a colon ':' on labels within code segments */
                    sprintf( text, "%s:", pub_rec->name );
                    out_label( text );
                } else {
                    out_label( pub_rec->name );
                }
            }
        }
    }
    last_pub_rec = pub_rec;
    pub_advance();
    if ( pub_rec->seg_idx == last_pub_rec->seg_idx 
            && pub_rec->offset == last_pub_rec->offset ) {
        if ( pass == 3 ) {
            if ( last_pub_rec->type != NEAR ) {
                out_directive( "equ" );
                sprintf( text, "%s", size_text );
                out_operand( text );
            }
            out_endline();
        }
        proc_label();
    }
    return( 0 );
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0xf026(%rip), %r12      # 0x1c088
movq (%r12), %rax
movl 0x38(%rax), %edx
cmpl $0x2, %edx
leaq 0x5c2d(%rip), %rcx      # 0x12ca0
leaq 0x5c2f(%rip), %rbx      # 0x12ca9
cmoveq %rcx, %rbx
leaq 0xeee3(%rip), %r15      # 0x1bf68
cmpl $0x3, (%r15)
jne 0xd12f
movq 0x8(%rax), %rcx
leaq 0xef56(%rip), %rsi      # 0x1bff0
movq (%rsi), %rsi
movl 0x10(%rsi), %esi
subq %rsi, %rcx
jae 0xd0ca
addq $0x10, %rax
cmpl $0x1, %edx
je 0xd10b
cmpl $0x2, %edx
jne 0xd127
leaq 0x5c04(%rip), %rsi      # 0x12cbe
leaq 0x5bdf(%rip), %rdx      # 0x12ca0
leaq 0x6044(%rip), %rcx      # 0x1310c
jmp 0xd101
jne 0xd0d4
movw $0x24, (%rsp)
jmp 0xd0ec
leaq 0x5bd8(%rip), %rsi      # 0x12cb3
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x91b0
movq (%r12), %rax
addq $0x10, %rax
leaq 0x5503(%rip), %rsi      # 0x125fa
leaq 0x600e(%rip), %rcx      # 0x1310c
movq %rsp, %rdx
movq %rax, %rdi
callq 0xc585
jmp 0xd12f
leaq 0x5bb0(%rip), %rsi      # 0x12cc2
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x91b0
movq %r14, %rdi
jmp 0xd12a
movq %rax, %rdi
callq 0xc471
movq (%r12), %rax
leaq 0xef56(%rip), %r14      # 0x1c090
movq %rax, (%r14)
callq 0xc654
movq (%r12), %rcx
movl (%rcx), %edx
movq (%r14), %rax
cmpl (%rax), %edx
jne 0xd191
movq 0x8(%rcx), %rcx
cmpq 0x8(%rax), %rcx
jne 0xd191
cmpl $0x3, (%r15)
jne 0xd18c
cmpl $0x1, 0x38(%rax)
je 0xd187
leaq 0x5b52(%rip), %rdi      # 0x12cbe
callq 0xc554
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9070
movq %r14, %rdi
callq 0xc4c6
callq 0xc522
callq 0xd050
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq