// File: /workspace/github_c_makefile_star2_O0/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstWriterSetAttrBegin
void fstWriterSetAttrBegin(void *ctx, enum fstAttrType attrtype, int subtype,
                const char *attrname, uint64_t arg)
{
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;

if(xc)
        {
        fputc(FST_ST_GEN_ATTRBEGIN, xc->hier_handle);
        if(/*(attrtype < FST_AT_MISC) ||*/ (attrtype > FST_AT_MAX)) { attrtype = FST_AT_MISC; subtype = FST_MT_UNKNOWN; }
        fputc(attrtype, xc->hier_handle);

        switch(attrtype)
                {
                case FST_AT_ARRAY:      if((subtype < FST_AR_NONE) || (subtype > FST_AR_MAX)) subtype = FST_AR_NONE; break;
                case FST_AT_ENUM:       if((subtype < FST_EV_SV_INTEGER) || (subtype > FST_EV_MAX)) subtype = FST_EV_SV_INTEGER; break;
                case FST_AT_PACK:       if((subtype < FST_PT_NONE) || (subtype > FST_PT_MAX)) subtype = FST_PT_NONE; break;

                case FST_AT_MISC:
                default:                break;
                }

        fputc(subtype, xc->hier_handle);
        fprintf(xc->hier_handle, "%s%c",
                attrname ? attrname : "", 0);

        if(attrname)
                {
                xc->hier_file_len += strlen(attrname);
                }

        xc->hier_file_len += 4; /* FST_ST_GEN_ATTRBEGIN + type + subtype + string terminating zero */
        xc->hier_file_len += fstWriterVarint(xc->hier_handle, arg);
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x8c78
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0xfc, %edi
callq 0x21c0
cmpl $0x3, -0xc(%rbp)
jbe 0x8b63
movl $0x0, -0xc(%rbp)
movl $0x8, -0x10(%rbp)
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x21c0
movl -0xc(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x3, %rax
ja 0x8bd5
movq -0x30(%rbp), %rax
leaq 0x216d9(%rip), %rcx     # 0x2a264
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x10(%rbp)
jl 0x8ba0
cmpl $0x3, -0x10(%rbp)
jle 0x8ba7
movl $0x0, -0x10(%rbp)
jmp 0x8bd7
cmpl $0x0, -0x10(%rbp)
jl 0x8bb5
cmpl $0xf, -0x10(%rbp)
jle 0x8bbc
movl $0x0, -0x10(%rbp)
jmp 0x8bd7
cmpl $0x0, -0x10(%rbp)
jl 0x8bca
cmpl $0x3, -0x10(%rbp)
jle 0x8bd1
movl $0x0, -0x10(%rbp)
jmp 0x8bd7
jmp 0x8bd5
jmp 0x8bd7
movl -0x10(%rbp), %edi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x21c0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8c04
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x8c11
leaq 0x228be(%rip), %rax     # 0x2b4c9
movq %rax, -0x40(%rbp)
jmp 0x8c11
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x22397(%rip), %rsi     # 0x2afb7
xorl %ecx, %ecx
movb $0x0, %al
callq 0x2220
cmpq $0x0, -0x18(%rbp)
je 0x8c48
movq -0x18(%rbp), %rdi
callq 0x2130
movq %rax, %rcx
movq -0x28(%rbp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x38(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x78f0
movslq %eax, %rcx
movq -0x28(%rbp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
addq $0x40, %rsp
popq %rbp
retq
nop