// File: /workspace/github_c_makefile_star2_O2/Nico01[P]obj2asm/oubuff.c
// Function: empty_string
void empty_string( length )
    int     length;
{
    int     prev_mode;
    int     curr_mode;
    int     out_count;
    char    out_buff[OPSIZE+1];
    int     this_char;
    char    byte_buff[5];
    int     byte_len;
    char    *pre_text;
    int     pre_len;

    prev_mode = NOTHING;
    out_count = 0;
    out_buff[0] = '\0';
    buff_reseek();
    while ( length ) {
        this_char = buff_regetc();
        if ( this_char < ' ' || this_char > '~' ) {
            curr_mode = SPECIAL;
            sprintf( byte_buff, "0%02Xh", this_char );
            byte_len = 4;
        } else {
            curr_mode = ASCII;
            if ( this_char == '\'' ) {
                strcpy( byte_buff, "''" );  /* Two apostrophes to indicate one */
                byte_len = 2;
            } else {
                sprintf( byte_buff, "%c", this_char );
                byte_len = 1;
            }
        }
        pre_text = "";                  /* Default to no separator */
        pre_len = 0;
        if ( prev_mode == ASCII && curr_mode == SPECIAL ) {
            pre_text = "',";            /* Separator between ascii and hex */
            pre_len = 2;
        }
        if ( prev_mode == SPECIAL && curr_mode == ASCII ) {
            pre_text = ",'";            /* Separator between hex and ascii */
            pre_len = 2;
        }
        if ( prev_mode == SPECIAL && curr_mode == SPECIAL ) {
            pre_text = ",";             /* Separator between hex codes */
            pre_len = 1;
        }
        if ( out_count + pre_len + byte_len >= OPSIZE ) {
            /*
            ** Output current line and proceed to next line
            */
            if ( prev_mode == ASCII ) {
                strcat( out_buff, "'" );
            }
            if ( pass == 3 ) {
                out_directive( "db" );
                out_operand( out_buff );
                out_endline();
            }
            out_count = 0;
            out_buff[0] = '\0';
            prev_mode = NOTHING;
            pre_text = "";              /* Back to no seperator */
            pre_len = 0;
        }
        if ( prev_mode == NOTHING && curr_mode == ASCII ) {
            pre_text = "'";
            pre_len = 1;
        }
        strcat( out_buff, pre_text );
        strcat( out_buff, byte_buff );
        out_count += pre_len + byte_len;
        prev_mode = curr_mode;
        if ( this_char == '\0' || this_char == '$' ) {
            /*
            ** Output current line (with this_char) and proceed to next line
            */
            if ( prev_mode == ASCII ) {
                strcat( out_buff, "'" );
            }
            if ( pass == 3 ) {
                out_directive( "db" );
                out_operand( out_buff );
                out_endline();
            }
            out_count = 0;
            out_buff[0] = '\0';
            prev_mode = NOTHING;
            pre_text = "";              /* Back to no seperator */
            pre_len = 0;
        }
        --length;
    }
    if ( prev_mode != NOTHING ) {
        if ( prev_mode == ASCII ) {
            strcat( out_buff, "'" );
        }
        if ( pass == 3 ) {
            out_directive( "db" );
            out_operand( out_buff );
            out_endline();
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edi, %ebx
leaq 0x20(%rsp), %rax
movb $0x0, (%rax)
movq 0xebed(%rip), %rax      # 0x1d5d0
movq %rax, 0xebee(%rip)      # 0x1d5d8
xorl %r13d, %r13d
xorl %r15d, %r15d
subl $0x1, %ebx
jb 0xebb4
callq 0xec15
movl %eax, %ebp
leal -0x7f(%rbp), %r12d
cmpl $-0x60, %r12d
ja 0xea2a
leaq 0xe(%rsp), %rdi
leaq 0x45c7(%rip), %rsi      # 0x12fdd
movl %ebp, %edx
xorl %eax, %eax
callq 0x91b0
pushq $0x2
popq %rax
movl %eax, 0x14(%rsp)
pushq $0x4
jmp 0xea44
cmpl $0x27, %ebp
jne 0xea47
movb $0x0, 0x10(%rsp)
movw $0x2727, 0xe(%rsp)      # imm = 0x2727
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
pushq $0x2
popq %rax
jmp 0xea58
movb %bpl, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
movl %eax, %r9d
cmpl $-0x5f, %r12d
setae %cl
setb %al
cmpl $0x1, %r13d
sete %dl
leaq 0x4574(%rip), %rsi      # 0x12fe7
andb %al, %dl
jne 0xea7e
leaq 0x468e(%rip), %rsi      # 0x1310c
cmpl $0x2, %r13d
sete %dil
andb %dil, %cl
leaq 0x455a(%rip), %r8       # 0x12fea
cmovneq %r8, %rsi
orb %dl, %cl
movzbl %cl, %r14d
addl %r14d, %r14d
testb %al, %dil
leaq 0x4541(%rip), %rax      # 0x12fe8
cmovneq %rax, %rsi
pushq $0x1
popq %rax
cmovnel %eax, %r14d
leal (%r15,%r9), %eax
addl %r14d, %eax
cmpl $0x3c, %eax
movq %r9, 0x18(%rsp)
jl 0xeb16
cmpl $0x1, %r13d
jne 0xeada
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xd487(%rip), %rax      # 0x1bf68
cmpl $0x3, (%rax)
jne 0xeb01
leaq 0x4500(%rip), %rdi      # 0x12fed
callq 0xc554
leaq 0x20(%rsp), %rdi
callq 0xc4c6
callq 0xc522
movb $0x0, 0x20(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
leaq 0x45f9(%rip), %rsi      # 0x1310c
xorl %r14d, %r14d
cmpl $-0x5f, %r12d
setb %al
testl %r13d, %r13d
setne %cl
orb %al, %cl
leaq 0x44b9(%rip), %rax      # 0x12fe5
cmoveq %rax, %rsi
pushq $0x1
popq %rax
cmovel %eax, %r14d
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x91a0
movq %r13, %rdi
leaq 0xe(%rsp), %rsi
callq 0x91a0
cmpl $0x24, %ebp
je 0xeb6c
testl %ebp, %ebp
je 0xeb6c
addl 0x18(%rsp), %r15d
addl %r14d, %r15d
movl 0x14(%rsp), %r13d
jmp 0xe9f0
cmpl $-0x5f, %r12d
jb 0xeb83
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xd3de(%rip), %rax      # 0x1bf68
cmpl $0x3, (%rax)
jne 0xebaa
leaq 0x4457(%rip), %rdi      # 0x12fed
callq 0xc554
leaq 0x20(%rsp), %rdi
callq 0xc4c6
callq 0xc522
movb $0x0, 0x20(%rsp)
jmp 0xe9ea
testl %r13d, %r13d
je 0xebf7
cmpl $0x1, %r13d
jne 0xebd0
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xd391(%rip), %rax      # 0x1bf68
cmpl $0x3, (%rax)
jne 0xebf7
leaq 0x440a(%rip), %rdi      # 0x12fed
callq 0xc554
leaq 0x20(%rsp), %rdi
callq 0xc4c6
callq 0xc522
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq