// File: /workspace/github_c_makefile_star2_O3/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 0xf49a(%rip), %rax      # 0x1e5d0
movq %rax, 0xf49b(%rip)      # 0x1e5d8
testl %edi, %edi
je 0xf389
movl %edi, %ebx
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0xf47c(%rip), %rax      # 0x1e5d0
cmpq 0xf485(%rip), %rax      # 0x1e5e0
je 0xf1a5
leaq 0x1(%rax), %rcx
movq %rcx, 0xf468(%rip)      # 0x1e5d0
movb (%rax), %al
movsbl %al, %ebp
movq %rcx, 0xf464(%rip)      # 0x1e5d8
leal -0x7f(%rbp), %ecx
cmpl $-0x60, %ecx
jbe 0xf1aa
cmpb $0x27, %al
jne 0xf32a
movb $0x0, 0x10(%rsp)
movw $0x2727, 0xe(%rsp)      # imm = 0x2727
movl $0x2, %r8d
movl $0x1, %eax
movl $0x27, %ebp
xorl %r14d, %r14d
jmp 0xf1cd
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0xe(%rsp), %rdi
leaq 0x4e27(%rip), %rsi      # 0x13fdd
movl %ebp, %edx
xorl %eax, %eax
callq 0x91b0
movl $0x4, %r8d
movl $0x2, %eax
movb $0x1, %r14b
movl %eax, 0x14(%rsp)
cmpl $0x1, %r15d
sete %al
leaq 0x4e08(%rip), %rsi      # 0x13fe7
andb %r14b, %al
jne 0xf1eb
leaq 0x4f21(%rip), %rsi      # 0x1410c
movl %r14d, %ecx
xorb $0x1, %cl
cmpl $0x2, %r15d
sete %dl
andb %dl, %cl
leaq 0x4de9(%rip), %rdi      # 0x13fea
cmovneq %rdi, %rsi
orb %al, %cl
movzbl %cl, %r12d
addl %r12d, %r12d
testb %r14b, %dl
leaq 0x4dd0(%rip), %rax      # 0x13fe8
cmovneq %rax, %rsi
movl $0x1, %eax
cmovnel %eax, %r12d
leal (%r8,%r13), %eax
addl %r12d, %eax
cmpl $0x3c, %eax
movq %r8, 0x18(%rsp)
jl 0xf289
cmpl $0x1, %r15d
jne 0xf24d
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdd14(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf274
leaq 0x4d8d(%rip), %rdi      # 0x13fed
callq 0xcb07
leaq 0x20(%rsp), %rdi
callq 0xca45
callq 0xcaab
movb $0x0, 0x20(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
leaq 0x4e86(%rip), %rsi      # 0x1410c
xorl %r12d, %r12d
testl %r15d, %r15d
setne %al
orb %r14b, %al
leaq 0x4d4c(%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 0xf2c9
testl %ebp, %ebp
jne 0xf313
testb %r14b, %r14b
jne 0xf2df
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdc82(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf306
leaq 0x4cfb(%rip), %rdi      # 0x13fed
callq 0xcb07
leaq 0x20(%rsp), %rdi
callq 0xca45
callq 0xcaab
movb $0x0, 0x20(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
jmp 0xf320
addl 0x18(%rsp), %r13d
addl %r12d, %r13d
movl 0x14(%rsp), %r15d
decl %ebx
jne 0xf14d
jmp 0xf346
movb %al, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
movl $0x1, %eax
xorl %r14d, %r14d
movl $0x1, %r8d
jmp 0xf1cd
testl %r15d, %r15d
je 0xf389
cmpl $0x1, %r15d
jne 0xf362
leaq 0x20(%rsp), %rdi
callq 0x90b0
movw $0x27, 0x20(%rsp,%rax)
leaq 0xdbff(%rip), %rax      # 0x1cf68
cmpl $0x3, (%rax)
jne 0xf389
leaq 0x4c78(%rip), %rdi      # 0x13fed
callq 0xcb07
leaq 0x20(%rsp), %rdi
callq 0xca45
callq 0xcaab
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq