// File: /workspace/github_c_makefile_star2_O1/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
movb $0x0, 0x20(%rsp)
movq 0xf4d6(%rip), %rax      # 0x1e5d0
movq %rax, 0xf4d7(%rip)      # 0x1e5d8
testl %edi, %edi
je 0xf30b
movl %edi, %ebx
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0xf4b8(%rip), %rax      # 0x1e5d0
cmpq 0xf4c1(%rip), %rax      # 0x1e5e0
je 0xf138
leaq 0x1(%rax), %rcx
movq %rcx, 0xf4a4(%rip)      # 0x1e5d0
movsbl (%rax), %ebp
movq %rcx, 0xf4a2(%rip)      # 0x1e5d8
jmp 0xf13d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leal -0x7f(%rbp), %r14d
cmpl $-0x60, %r14d
ja 0xf16c
leaq 0xe(%rsp), %rdi
leaq 0x4e8a(%rip), %rsi      # 0x13fdd
movl %ebp, %edx
xorl %eax, %eax
callq 0x91b0
movl $0x4, %r9d
movl $0x2, 0x14(%rsp)
jmp 0xf1a5
cmpl $0x27, %ebp
jne 0xf18d
movb $0x0, 0x10(%rsp)
movw $0x2727, 0xe(%rsp)      # imm = 0x2727
movl $0x2, %r9d
movl $0x1, 0x14(%rsp)
jmp 0xf1a5
movb %bpl, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
movl $0x1, 0x14(%rsp)
movl $0x1, %r9d
cmpl $-0x5f, %r14d
setae %cl
setb %al
cmpl $0x1, %r15d
sete %dl
leaq 0x4e2a(%rip), %rsi      # 0x13fe7
andb %al, %dl
jne 0xf1c8
leaq 0x4f44(%rip), %rsi      # 0x1410c
cmpl $0x2, %r15d
sete %dil
andb %dil, %cl
leaq 0x4e10(%rip), %r8       # 0x13fea
cmovneq %r8, %rsi
orb %dl, %cl
movzbl %cl, %r12d
addl %r12d, %r12d
testb %al, %dil
leaq 0x4df7(%rip), %rax      # 0x13fe8
cmovneq %rax, %rsi
movl $0x1, %eax
cmovnel %eax, %r12d
leal (%r9,%r13), %eax
addl %r12d, %eax
cmpl $0x3c, %eax
movq %r9, 0x18(%rsp)
jl 0xf262
cmpl $0x1, %r15d
jne 0xf226
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdd3b(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf24d
leaq 0x4db4(%rip), %rdi      # 0x13fed
callq 0xca9b
leaq 0x20(%rsp), %rdi
callq 0xc9d9
callq 0xca3f
movb $0x0, 0x20(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
leaq 0x4ead(%rip), %rsi      # 0x1410c
xorl %r12d, %r12d
cmpl $-0x5f, %r14d
setb %al
testl %r15d, %r15d
setne %cl
orb %al, %cl
leaq 0x4d6d(%rip), %rax      # 0x13fe5
cmoveq %rax, %rsi
movl $0x1, %eax
cmovel %eax, %r12d
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x91a0
movq %r15, %rdi
leaq 0xe(%rsp), %rsi
callq 0x91a0
cmpl $0x24, %ebp
je 0xf2a8
testl %ebp, %ebp
jne 0xf2f2
cmpl $-0x5f, %r14d
jb 0xf2bf
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdca2(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf2e6
leaq 0x4d1b(%rip), %rdi      # 0x13fed
callq 0xca9b
leaq 0x20(%rsp), %rdi
callq 0xc9d9
callq 0xca3f
movb $0x0, 0x20(%rsp)
xorl %eax, %eax
xorl %r13d, %r13d
jmp 0xf2fe
addl 0x18(%rsp), %r13d
addl %r12d, %r13d
movl 0x14(%rsp), %eax
movl %eax, %r15d
decl %ebx
jne 0xf111
jmp 0xf30d
xorl %eax, %eax
testl %eax, %eax
je 0xf34e
cmpl $0x1, %eax
jne 0xf327
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdc3a(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf34e
leaq 0x4cb3(%rip), %rdi      # 0x13fed
callq 0xca9b
leaq 0x20(%rsp), %rdi
callq 0xc9d9
callq 0xca3f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq