// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/xmlwriter.c
// Function: escape_attributes
STATIC char *
_escape_attributes(struct xml_attribute *attribute)
{
    char *encoded = (char *) calloc(LXW_MAX_ENCODED_ATTRIBUTE_LENGTH, 1);
    char *p_encoded = encoded;
    char *p_attr = attribute->value;

    while (*p_attr) {
        switch (*p_attr) {
            case '&':
                memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
                p_encoded += sizeof(LXW_AMP) - 1;
                break;
            case '<':
                memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
                p_encoded += sizeof(LXW_LT) - 1;
                break;
            case '>':
                memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
                p_encoded += sizeof(LXW_GT) - 1;
                break;
            case '"':
                memcpy(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
                p_encoded += sizeof(LXW_QUOT) - 1;
                break;
            case '\n':
                memcpy(p_encoded, LXW_NL, sizeof(LXW_NL) - 1);
                p_encoded += sizeof(LXW_NL) - 1;
                break;
            default:
                *p_encoded = *p_attr;
                p_encoded++;
                break;
        }
        p_attr++;
    }

    return encoded;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x30c0, %edi           # imm = 0x30C0
movl $0x1, %esi
callq 0xc870
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x820, %rax            # imm = 0x820
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x6512d
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x24(%rbp)
subl $0xa, %eax
je 0x650e1
jmp 0x65037
movl -0x24(%rbp), %eax
subl $0x22, %eax
je 0x650bc
jmp 0x65041
movl -0x24(%rbp), %eax
subl $0x26, %eax
je 0x65062
jmp 0x6504b
movl -0x24(%rbp), %eax
subl $0x3c, %eax
je 0x65088
jmp 0x65055
movl -0x24(%rbp), %eax
subl $0x3e, %eax
je 0x650a2
jmp 0x65104
movq -0x18(%rbp), %rax
movl 0xa21b(%rip), %ecx      # 0x6f287
movl %ecx, (%rax)
movb 0xa217(%rip), %cl       # 0x6f28b
movb %cl, 0x4(%rax)
movq -0x18(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x18(%rbp)
jmp 0x6511c
movq -0x18(%rbp), %rax
movl 0xa1fb(%rip), %ecx      # 0x6f28d
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
jmp 0x6511c
movq -0x18(%rbp), %rax
movl 0xa1e6(%rip), %ecx      # 0x6f292
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
jmp 0x6511c
movq -0x18(%rbp), %rax
movl 0xa1ee(%rip), %ecx      # 0x6f2b4
movl %ecx, (%rax)
movw 0xa1e9(%rip), %cx       # 0x6f2b8
movw %cx, 0x4(%rax)
movq -0x18(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x18(%rbp)
jmp 0x6511c
movq -0x18(%rbp), %rax
movl 0xa1d0(%rip), %ecx      # 0x6f2bb
movl %ecx, (%rax)
movb 0xa1cc(%rip), %cl       # 0x6f2bf
movb %cl, 0x4(%rax)
movq -0x18(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x18(%rbp)
jmp 0x6511c
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x65015
movq -0x10(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq