// File: /workspace/github_c_makefile_star2_O0/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstWriterEmitVariableLengthValueChange
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len)
{
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
const unsigned char *buf = (const unsigned char *)val;

if(FST_LIKELY((xc) && (handle <= xc->maxhandle)))
        {
        uint32_t fpos;
        uint32_t *vm4ip;

        if(FST_UNLIKELY(!xc->valpos_mem))
                {
                xc->vc_emitted = 1;
                fstWriterCreateMmaps(xc);
                }

        handle--; /* move starting at 1 index to starting at 0 */
        vm4ip = &(xc->valpos_mem[4*handle]);

        /* there is no initial time dump for variable length value changes */
        if(FST_LIKELY(!vm4ip[1])) /* len of zero = variable length */
                {
                fpos = xc->vchg_siz;

                if(FST_UNLIKELY((fpos + len + 10 + 5) > xc->vchg_alloc_siz))
                        {
                        xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */
                        xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
                        if(FST_UNLIKELY(!xc->vchg_mem))
                                {
                                fprintf(stderr, FST_APIMESS "Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n");
                                exit(255);
                                }
                        }

                xc->vchg_siz += fstWriterUint32WithVarint32AndLength(xc, &vm4ip[2], xc->tchn_idx - vm4ip[3], buf, len); /* do one fwrite op only */
                vm4ip[3] = xc->tchn_idx;
                vm4ip[2] = fpos;
                }
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x41(%rbp)
je 0x9e02
movl -0xc(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x68(%rcx), %eax
setbe %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x9fbb
movq -0x28(%rbp), %rax
cmpq $0x0, 0x40(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x9e52
movq -0x28(%rbp), %rax
movb 0x74(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x74(%rax)
movq -0x28(%rbp), %rdi
callq 0x9510
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movl -0xc(%rbp), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, 0x4(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x9fb9
movq -0x28(%rbp), %rax
movl 0xa0(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl -0x1c(%rbp), %eax
addl $0xa, %eax
addl $0x5, %eax
movq -0x28(%rbp), %rcx
cmpl 0xa4(%rcx), %eax
seta %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x9f62
movq -0x28(%rbp), %rax
movq 0x108(%rax), %rdx
movl -0x1c(%rbp), %eax
addq %rax, %rdx
addq $0x5, %rdx
movq -0x28(%rbp), %rax
movl 0xa4(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0xa4(%rax)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x28(%rbp), %rax
movl 0xa4(%rax), %eax
movl %eax, %esi
callq 0x22c0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x30(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x9f60
movq 0x250ab(%rip), %rax     # 0x2eff0
movq (%rax), %rdi
leaq 0x21149(%rip), %rsi     # 0x2b098
movb $0x0, %al
callq 0x2220
movl $0xff, %edi
callq 0x2380
jmp 0x9f62
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x8, %rsi
movq -0x28(%rbp), %rax
movl 0x8c(%rax), %edx
movq -0x40(%rbp), %rax
subl 0xc(%rax), %edx
movq -0x30(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x9fd0
movl %eax, %ecx
movq -0x28(%rbp), %rax
addl 0xa0(%rax), %ecx
movl %ecx, 0xa0(%rax)
movq -0x28(%rbp), %rax
movl 0x8c(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x9fbb
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)