// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
leaq 0xf9ed(%rip), %r12      # 0x1d088
movq (%r12), %rax
movl 0x38(%rax), %edx
cmpl $0x2, %edx
leaq 0x65f4(%rip), %rcx      # 0x13ca0
leaq 0x65f6(%rip), %rbx      # 0x13ca9
cmoveq %rcx, %rbx
leaq 0xf8aa(%rip), %r15      # 0x1cf68
cmpl $0x3, (%r15)
jne 0xd768
movq 0x8(%rax), %rcx
leaq 0xf91d(%rip), %rsi      # 0x1cff0
movq (%rsi), %rsi
movl 0x10(%rsi), %esi
subq %rsi, %rcx
jae 0xd703
addq $0x10, %rax
cmpl $0x1, %edx
je 0xd744
cmpl $0x2, %edx
jne 0xd760
leaq 0x65cb(%rip), %rsi      # 0x13cbe
leaq 0x65a6(%rip), %rdx      # 0x13ca0
leaq 0x6a0b(%rip), %rcx      # 0x1410c
jmp 0xd73a
jne 0xd70d
movw $0x24, (%rsp)
jmp 0xd725
leaq 0x659f(%rip), %rsi      # 0x13cb3
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x91b0
movq (%r12), %rax
addq $0x10, %rax
leaq 0x5eca(%rip), %rsi      # 0x135fa
leaq 0x69d5(%rip), %rcx      # 0x1410c
movq %rsp, %rdx
movq %rax, %rdi
callq 0xcb44
jmp 0xd768
leaq 0x6577(%rip), %rsi      # 0x13cc2
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x91b0
movq %r14, %rdi
jmp 0xd763
movq %rax, %rdi
callq 0xc9ee
movq (%r12), %rax
leaq 0xf91d(%rip), %r14      # 0x1d090
movq %rax, (%r14)
leaq 0xf903(%rip), %r13      # 0x1d080
movq (%r13), %rdi
movl $0x1, %esi
callq 0x1288c
movq %rax, (%r13)
movq 0x20(%rax), %rcx
movq %rcx, (%r12)
movl (%rcx), %edx
movq (%r14), %rax
cmpl (%rax), %edx
jne 0xd7e2
movq 0x8(%rcx), %rcx
cmpq 0x8(%rax), %rcx
jne 0xd7e2
cmpl $0x3, (%r15)
jne 0xd7dd
cmpl $0x1, 0x38(%rax)
je 0xd7d8
leaq 0x6501(%rip), %rdi      # 0x13cbe
callq 0xcb07
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9070
movq %r14, %rdi
callq 0xca45
callq 0xcaab
callq 0xd687
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq