// File: /workspace/github_c_makefile_star2_O1/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstWriterCreateMmaps
static void fstWriterCreateMmaps(struct fstWriterContext *xc)
{
off_t curpos = ftello(xc->handle);

fflush(xc->hier_handle);

/* write out intermediate header */
fstWriterFseeko(xc, xc->handle, FST_HDR_OFFS_START_TIME, SEEK_SET);
fstWriterUint64(xc->handle, xc->firsttime);
fstWriterUint64(xc->handle, xc->curtime);
fstWriterFseeko(xc, xc->handle, FST_HDR_OFFS_NUM_SCOPES, SEEK_SET);
fstWriterUint64(xc->handle, xc->numscopes);
fstWriterUint64(xc->handle, xc->numsigs);
fstWriterUint64(xc->handle, xc->maxhandle);
fstWriterUint64(xc->handle, xc->secnum);
fstWriterFseeko(xc, xc->handle, curpos, SEEK_SET);
fflush(xc->handle);

/* do mappings */
if(!xc->valpos_mem)
        {
        fflush(xc->valpos_handle);
	errno = 0;
	if(xc->maxhandle)
		{
	        fstWriterMmapSanity(xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0), __FILE__, __LINE__, "xc->valpos_mem");
		}
        }
if(!xc->curval_mem)
        {
        fflush(xc->curval_handle);
	errno = 0;
	if(xc->maxvalpos)
		{
	        fstWriterMmapSanity(xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0), __FILE__, __LINE__, "xc->curval_handle");
		}
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x20b0
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x2280
movq (%rbx), %rdi
movl $0x9, %esi
xorl %edx, %edx
callq 0x2320
testl %eax, %eax
jns 0x6db6
orb $0x1, 0x12c(%rbx)
movq (%rbx), %rcx
movq 0x98(%rbx), %rax
movl $0x8, %edx
movb %al, -0x21(%rbp,%rdx)
shrq $0x8, %rax
decq %rdx
jne 0x6dc5
leaq -0x20(%rbp), %rdi
movl $0x8, %r15d
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rcx
movq 0x90(%rbx), %rax
movb %al, -0x21(%rbp,%r15)
shrq $0x8, %rax
decq %r15
jne 0x6df5
leaq -0x20(%rbp), %rdi
movl $0x8, %r15d
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rdi
movl $0x29, %esi
xorl %edx, %edx
callq 0x2320
testl %eax, %eax
jns 0x6e36
orb $0x1, 0x12c(%rbx)
movq (%rbx), %rcx
movl 0xb8(%rbx), %eax
movb %al, -0x21(%rbp,%r15)
shrq $0x8, %rax
decq %r15
jne 0x6e3f
leaq -0x20(%rbp), %rdi
movl $0x8, %r15d
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rcx
movl 0x6c(%rbx), %eax
movb %al, -0x21(%rbp,%r15)
shrq $0x8, %rax
decq %r15
jne 0x6e6c
leaq -0x20(%rbp), %rdi
movl $0x8, %r15d
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rcx
movl 0x68(%rbx), %eax
movb %al, -0x21(%rbp,%r15)
shrq $0x8, %rax
decq %r15
jne 0x6e99
leaq -0x20(%rbp), %rdi
movl $0x8, %r15d
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rcx
movl 0xa8(%rbx), %eax
movb %al, -0x21(%rbp,%r15)
shrq $0x8, %rax
decq %r15
jne 0x6ec9
leaq -0x20(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x2390
movq (%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2320
testl %eax, %eax
jns 0x6f02
orb $0x1, 0x12c(%rbx)
movq (%rbx), %rdi
callq 0x2280
cmpq $0x0, 0x40(%rbx)
jne 0x6f71
movq 0x18(%rbx), %rdi
callq 0x2280
callq 0x2070
movl $0x0, (%rax)
movl 0x68(%rbx), %r14d
testl %r14d, %r14d
je 0x6f71
shll $0x2, %r14d
shlq $0x2, %r14
movq 0x18(%rbx), %rdi
callq 0x2260
xorl %edi, %edi
movq %r14, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x2140
movq %rax, 0x40(%rbx)
leaq 0xe956(%rip), %rdx      # 0x158ba
movq %rax, %rdi
movl $0x3f5, %esi            # imm = 0x3F5
callq 0x5d26
cmpq $0x0, 0x48(%rbx)
je 0x6f83
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rbx), %rdi
callq 0x2280
callq 0x2070
movl $0x0, (%rax)
movl 0x70(%rbx), %r14d
testq %r14, %r14
je 0x6f78
movq 0x20(%rbx), %rdi
callq 0x2260
xorl %edi, %edi
movq %r14, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x2140
movq %rax, 0x48(%rbx)
leaq 0xe8fb(%rip), %rdx      # 0x158c9
movq %rax, %rdi
movl $0x3fe, %esi            # imm = 0x3FE
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5d26