// File: /workspace/github_c_makefile_star2_O3/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 0x87c6
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 0x87d5
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 0x8805
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 0x8846
orb $0x1, 0x12c(%rbx)
movq (%rbx), %rcx
movl 0xb8(%rbx), %eax
movb %al, -0x21(%rbp,%r15)
shrl $0x8, %eax
decq %r15
jne 0x884f
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)
shrl $0x8, %eax
decq %r15
jne 0x887b
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)
shrl $0x8, %eax
decq %r15
jne 0x88a7
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)
shrl $0x8, %eax
decq %r15
jne 0x88d6
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 0x890e
orb $0x1, 0x12c(%rbx)
movq (%rbx), %rdi
callq 0x2280
cmpq $0x0, 0x40(%rbx)
jne 0x897d
movq 0x18(%rbx), %rdi
callq 0x2280
callq 0x2070
movl $0x0, (%rax)
movl 0x68(%rbx), %r14d
testl %r14d, %r14d
je 0x897d
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 0xbf4a(%rip), %rdx      # 0x148ba
movq %rax, %rdi
movl $0x3f5, %esi            # imm = 0x3F5
callq 0x7728
cmpq $0x0, 0x48(%rbx)
je 0x898f
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 0x8984
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 0xbeef(%rip), %rdx      # 0x148c9
movq %rax, %rdi
movl $0x3fe, %esi            # imm = 0x3FE
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7728