// File: /workspace/github_c_makefile_star2_O0/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstWriterClose
void fstWriterClose(void *ctx)
{
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;

#ifdef FST_WRITER_PARALLEL
if(xc)
        {
        pthread_mutex_lock(&xc->mutex);
        pthread_mutex_unlock(&xc->mutex);
        }
#endif

if(xc && !xc->already_in_close && !xc->already_in_flush)
        {
        unsigned char *tmem = NULL;
        off_t fixup_offs, tlen, hlen;

        xc->already_in_close = 1; /* never need to zero this out as it is freed at bottom */

        if(xc->section_header_only && xc->section_header_truncpos && (xc->vchg_siz <= 1) && (!xc->is_initial_time))
                {
                fstFtruncate(fileno(xc->handle), xc->section_header_truncpos);
                fstWriterFseeko(xc, xc->handle, xc->section_header_truncpos, SEEK_SET);
                xc->section_header_only = 0;
                }
                else
                {
                xc->skip_writing_section_hdr = 1;
                if(!xc->size_limit_locked)
                        {
                        if(FST_UNLIKELY(xc->is_initial_time)) /* simulation time never advanced so mock up the changes as time zero ones */
                                {
                                fstHandle dupe_idx;

                                fstWriterEmitTimeChange(xc, 0); /* emit some time change just to have one */
                                for(dupe_idx = 0; dupe_idx < xc->maxhandle; dupe_idx++) /* now clone the values */
                                        {
                                        fstWriterEmitValueChange(xc, dupe_idx+1, xc->curval_mem + xc->valpos_mem[4*dupe_idx]);
                                        }
                                }
                        fstWriterFlushContextPrivate(xc);
#ifdef FST_WRITER_PARALLEL
                        pthread_mutex_lock(&xc->mutex);
                        pthread_mutex_unlock(&xc->mutex);

			while (xc->in_pthread) 
				{ 
				pthread_mutex_lock(&xc->mutex); 
				pthread_mutex_unlock(&xc->mutex); 
				};
#endif
                        }
                }
        fstDestroyMmaps(xc, 1);
	if(xc->outval_mem)
		{
		free(xc->outval_mem); xc->outval_mem = NULL;
		xc->outval_alloc_siz = 0;
		}

        /* write out geom section */
        fflush(xc->geom_handle);
        tlen = ftello(xc->geom_handle);
	errno = 0;
	if(tlen)
		{
	        fstWriterMmapSanity(tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0), __FILE__, __LINE__, "tmem");
		}

        if(tmem)
                {
                unsigned long destlen = tlen;
                unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
                int rc = compress2(dmem, &destlen, tmem, tlen, 9);

                if((rc != Z_OK) || (((off_t)destlen) > tlen))
                        {
                        destlen = tlen;
                        }

                fixup_offs = ftello(xc->handle);
                fputc(FST_BL_SKIP, xc->handle);                 /* temporary tag */
                fstWriterUint64(xc->handle, destlen + 24);      /* section length */
                fstWriterUint64(xc->handle, tlen);              /* uncompressed */
                                                                /* compressed len is section length - 24 */
                fstWriterUint64(xc->handle, xc->maxhandle);     /* maxhandle */
                fstFwrite((((off_t)destlen) != tlen) ? dmem : tmem, destlen, 1, xc->handle);
                fflush(xc->handle);

                fstWriterFseeko(xc, xc->handle, fixup_offs, SEEK_SET);
                fputc(FST_BL_GEOM, xc->handle);                 /* actual tag */

                fstWriterFseeko(xc, xc->handle, 0, SEEK_END);           /* move file pointer to end for any section adds */
                fflush(xc->handle);

                free(dmem);
                fstMunmap(tmem, tlen);
                }

        if(xc->num_blackouts)
                {
                uint64_t cur_bl = 0;
                off_t bpos, eos;
                uint32_t i;

                fixup_offs = ftello(xc->handle);
                fputc(FST_BL_SKIP, xc->handle);                 /* temporary tag */
                bpos = fixup_offs + 1;
                fstWriterUint64(xc->handle, 0);                 /* section length */
                fstWriterVarint(xc->handle, xc->num_blackouts);

                for(i=0;i<xc->num_blackouts;i++)
                        {
                        fputc(xc->blackout_head->active, xc->handle);
                        fstWriterVarint(xc->handle, xc->blackout_head->tim - cur_bl);
                        cur_bl = xc->blackout_head->tim;
                        xc->blackout_curr = xc->blackout_head->next;
                        free(xc->blackout_head);
                        xc->blackout_head = xc->blackout_curr;
                        }

                eos = ftello(xc->handle);
                fstWriterFseeko(xc, xc->handle, bpos, SEEK_SET);
                fstWriterUint64(xc->handle, eos - bpos);
                fflush(xc->handle);

                fstWriterFseeko(xc, xc->handle, fixup_offs, SEEK_SET);
                fputc(FST_BL_BLACKOUT, xc->handle);     /* actual tag */

                fstWriterFseeko(xc, xc->handle, 0, SEEK_END);   /* move file pointer to end for any section adds */
                fflush(xc->handle);
                }

        if(xc->compress_hier)
                {
                off_t hl, eos;
                gzFile zhandle;
                int zfd;
                int fourpack_duo = 0;
#ifndef __MINGW32__
                char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1);
#endif

                fixup_offs = ftello(xc->handle);
                fputc(FST_BL_SKIP, xc->handle);                 /* temporary tag */
                hlen = ftello(xc->handle);
                fstWriterUint64(xc->handle, 0);                 /* section length */
                fstWriterUint64(xc->handle, xc->hier_file_len); /* uncompressed length */

                if(!xc->fourpack)
                        {
                        unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
                        zfd = dup(fileno(xc->handle));
                        fflush(xc->handle);
                        zhandle = gzdopen(zfd, "wb4");
                        if(zhandle)
                                {
                                fstWriterFseeko(xc, xc->hier_handle, 0, SEEK_SET);
                                for(hl = 0; hl < xc->hier_file_len; hl += FST_GZIO_LEN)
                                        {
                                        unsigned len = ((xc->hier_file_len - hl) > FST_GZIO_LEN) ? FST_GZIO_LEN : (xc->hier_file_len - hl);
                                        fstFread(mem, len, 1, xc->hier_handle);
                                        gzwrite(zhandle, mem, len);
                                        }
                                gzclose(zhandle);
                                }
                                else
                                {
                                close(zfd);
                                }
                        free(mem);
                        }
                        else
                        {
                        int lz4_maxlen;
                        unsigned char *mem;
                        unsigned char *hmem = NULL;
                        int packed_len;

                        fflush(xc->handle);

                        lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
                        mem = (unsigned char *)malloc(lz4_maxlen);
			errno = 0;
			if(xc->hier_file_len)
				{
	                        fstWriterMmapSanity(hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0), __FILE__, __LINE__, "hmem");
				}
                        packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
                        fstMunmap(hmem, xc->hier_file_len);

                        fourpack_duo = (!xc->repack_on_close) && (xc->hier_file_len > FST_HDR_FOURPACK_DUO_SIZE); /* double pack when hierarchy is large */

                        if(fourpack_duo)        /* double packing with LZ4 is faster than gzip */
                                {
                                unsigned char *mem_duo;
                                int lz4_maxlen_duo;
                                int packed_len_duo;

                                lz4_maxlen_duo = LZ4_compressBound(packed_len);
                                mem_duo = (unsigned char *)malloc(lz4_maxlen_duo);
                                packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len);

                                fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */
                                fstFwrite(mem_duo, packed_len_duo, 1, xc->handle);
                                free(mem_duo);
                                }
                                else
                                {
                                fstFwrite(mem, packed_len, 1, xc->handle);
                                }

                        free(mem);
                        }

                fstWriterFseeko(xc, xc->handle, 0, SEEK_END);
                eos = ftello(xc->handle);
                fstWriterFseeko(xc, xc->handle, hlen, SEEK_SET);
                fstWriterUint64(xc->handle, eos - hlen);
                fflush(xc->handle);

                fstWriterFseeko(xc, xc->handle, fixup_offs, SEEK_SET);
                fputc(xc->fourpack ?
                        ( fourpack_duo ? FST_BL_HIER_LZ4DUO : FST_BL_HIER_LZ4) :
                        FST_BL_HIER, xc->handle); /* actual tag now also == compression type */

                fstWriterFseeko(xc, xc->handle, 0, SEEK_END);   /* move file pointer to end for any section adds */
                fflush(xc->handle);

#ifndef __MINGW32__
                sprintf(fnam, "%s.hier", xc->filename);
                unlink(fnam);
                free(fnam);
#endif
                }

        /* finalize out 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);
        fflush(xc->handle);

        tmpfile_close(&xc->tchn_handle, &xc->tchn_handle_nam);
        free(xc->vchg_mem); xc->vchg_mem = NULL;
        tmpfile_close(&xc->curval_handle, &xc->curval_handle_nam);
        tmpfile_close(&xc->valpos_handle, &xc->valpos_handle_nam);
        tmpfile_close(&xc->geom_handle, &xc->geom_handle_nam);
        if(xc->hier_handle) { fclose(xc->hier_handle); xc->hier_handle = NULL; }
        if(xc->handle)
                {
                if(xc->repack_on_close)
                        {
                        FILE *fp;
                        off_t offpnt, uclen;
                        int flen = strlen(xc->filename);
                        char *hf = (char *)calloc(1, flen + 5);

                        strcpy(hf, xc->filename);
                        strcpy(hf+flen, ".pak");
                        fp = fopen(hf, "wb");

                        if(fp)
                                {
                                gzFile dsth;
                                int zfd;
                                char gz_membuf[FST_GZIO_LEN];

                                fstWriterFseeko(xc, xc->handle, 0, SEEK_END);
                                uclen = ftello(xc->handle);

                                fputc(FST_BL_ZWRAPPER, fp);
                                fstWriterUint64(fp, 0);
                                fstWriterUint64(fp, uclen);
                                fflush(fp);

                                fstWriterFseeko(xc, xc->handle, 0, SEEK_SET);
                                zfd = dup(fileno(fp));
                                dsth = gzdopen(zfd, "wb4");
                                if(dsth)
                                        {
                                        for(offpnt = 0; offpnt < uclen; offpnt += FST_GZIO_LEN)
                                                {
                                                size_t this_len = ((uclen - offpnt) > FST_GZIO_LEN) ? FST_GZIO_LEN : (uclen - offpnt);
                                                fstFread(gz_membuf, this_len, 1, xc->handle);
                                                gzwrite(dsth, gz_membuf, this_len);
                                                }
                                        gzclose(dsth);
                                        }
                                        else
                                        {
                                        close(zfd);
                                        }
                                fstWriterFseeko(xc, fp, 0, SEEK_END);
                                offpnt = ftello(fp);
                                fstWriterFseeko(xc, fp, 1, SEEK_SET);
                                fstWriterUint64(fp, offpnt - 1);
                                fclose(fp);
                                fclose(xc->handle); xc->handle = NULL;

                                unlink(xc->filename);
                                rename(hf, xc->filename);
                                }
                                else
                                {
                                xc->repack_on_close = 0;
                                fclose(xc->handle); xc->handle = NULL;
                                }

                        free(hf);
                        }
                        else
                        {
                        fclose(xc->handle); xc->handle = NULL;
                        }
                }

#ifdef __MINGW32__
        {
        int flen = strlen(xc->filename);
        char *hf = (char *)calloc(1, flen + 6);
        strcpy(hf, xc->filename);

        if(xc->compress_hier)
                {
                strcpy(hf + flen, ".hier");
                unlink(hf); /* no longer needed as a section now exists for this */
                }

        free(hf);
        }
#endif

#ifdef FST_WRITER_PARALLEL
        pthread_mutex_destroy(&xc->mutex);
        pthread_attr_destroy(&xc->thread_attr);
#endif

        if(xc->path_array)
                {
#ifndef _WAVE_HAVE_JUDY
                const uint32_t hashmask = FST_PATH_HASHMASK;
#endif
                JudyHSFreeArray(&(xc->path_array), NULL);
                }

        free(xc->filename); xc->filename = NULL;
        free(xc);
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8150, %rsp           # imm = 0x8150
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5e41
movq -0x10(%rbp), %rax
cmpb $0x0, 0xeb(%rax)
jne 0x5e41
movq -0x10(%rbp), %rax
cmpb $0x0, 0xea(%rax)
jne 0x5e41
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movb $0x1, 0xeb(%rax)
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %al
shrb $0x4, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x4fa6
movq -0x10(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x4fa6
movq -0x10(%rbp), %rax
cmpl $0x1, 0xa0(%rax)
ja 0x4fa6
movq -0x10(%rbp), %rax
movb 0x74(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x4fa6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2270
movl %eax, %edi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x5e50
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %cl
andb $-0x11, %cl
orb $0x0, %cl
movb %cl, 0xe9(%rax)
jmp 0x5061
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %cl
andb $-0x5, %cl
orb $0x4, %cl
movb %cl, 0xe9(%rax)
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x505f
movq -0x10(%rbp), %rax
movb 0x74(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5056
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5ed0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jae 0x5054
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
addl $0x1, %esi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x34(%rbp), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
addq %rax, %rdx
callq 0x6100
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5010
jmp 0x5056
movq -0x10(%rbp), %rdi
callq 0x6350
jmp 0x5061
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x7740
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x509e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x20a0
movq %rax, -0x28(%rbp)
callq 0x2060
movl $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x5126
movq -0x28(%rbp), %rax
movq %rax, -0x8128(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2270
movq -0x8128(%rbp), %rsi
movl %eax, %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x3, %edx
movl $0x1, %ecx
movq %r9, %rdi
callq 0x2140
movq %rax, %rdi
movq %rdi, -0x18(%rbp)
leaq 0x25e0f(%rip), %rsi     # 0x2af24
movl $0x7bf, %edx            # imm = 0x7BF
leaq 0x25e14(%rip), %rcx     # 0x2af35
callq 0x77c0
cmpq $0x0, -0x18(%rbp)
je 0x5293
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x22a0
movq %rax, %rdi
callq 0x2280
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x40(%rbp), %rsi
movl $0x9, %r8d
callq 0x2300
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0x517c
movq -0x40(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x5184
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0xff, %edi
callq 0x21c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rsi
addq $0x18, %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, %esi
callq 0x7840
movq -0x40(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x51f5
movq -0x48(%rbp), %rax
movq %rax, -0x8130(%rbp)
jmp 0x5200
movq -0x18(%rbp), %rax
movq %rax, -0x8130(%rbp)
movq -0x8130(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %edx
callq 0x78b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x3, %edi
callq 0x21c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x48(%rbp), %rdi
callq 0x2040
cmpq $0x0, -0x18(%rbp)
je 0x5291
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x22d0
jmp 0x5293
movq -0x10(%rbp), %rax
cmpl $0x0, 0xd8(%rax)
je 0x544b
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0xff, %edi
callq 0x21c0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0xd8(%rax), %eax
movl %eax, %esi
callq 0x78f0
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xd8(%rcx), %eax
jae 0x53b9
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movb 0x10(%rax), %al
andb $0x1, %al
movzbl %al, %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x8(%rax), %rsi
subq -0x58(%rbp), %rsi
callq 0x78f0
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xc8(%rax)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x5308
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x60(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x68(%rbp), %rsi
subq -0x60(%rbp), %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x2, %edi
callq 0x21c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5959
movl $0x0, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2130
movq %rax, %rdi
addq $0x5, %rdi
addq $0x1, %rdi
callq 0x2280
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0xff, %edi
callq 0x21c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movb 0x74(%rax), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5645
movl $0x8000, %edi           # imm = 0x8000
callq 0x2280
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2270
movl %eax, %edi
callq 0x2180
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movl -0x8c(%rbp), %edi
leaq 0x259f9(%rip), %rsi     # 0x2af3a
callq 0x2100
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x5629
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x5e80
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jge 0x561b
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
subq -0x78(%rbp), %rax
cmpq $0x8000, %rax           # imm = 0x8000
jle 0x55ae
movl $0x8000, %eax           # imm = 0x8000
movq %rax, -0x8138(%rbp)
jmp 0x55c1
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
subq -0x78(%rbp), %rax
movq %rax, -0x8138(%rbp)
movq -0x8138(%rbp), %rax
movl %eax, -0xa4(%rbp)
movq -0xa0(%rbp), %rdi
movl -0xa4(%rbp), %eax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movl $0x1, %edx
callq 0x7990
movq -0x88(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl -0xa4(%rbp), %edx
callq 0x22b0
movq -0x78(%rbp), %rax
addq $0x8000, %rax           # imm = 0x8000
movq %rax, -0x78(%rbp)
jmp 0x557a
movq -0x88(%rbp), %rdi
callq 0x2030
jmp 0x5634
movl -0x8c(%rbp), %edi
callq 0x21b0
movq -0xa0(%rbp), %rdi
callq 0x2040
jmp 0x5839
movq $0x0, -0xb8(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %edi
callq 0x12ed0
movl %eax, -0xa8(%rbp)
movslq -0xa8(%rbp), %rdi
callq 0x2280
movq %rax, -0xb0(%rbp)
callq 0x2060
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x56f9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x8140(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2270
movq -0x8140(%rbp), %rsi
movl %eax, %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x3, %edx
movl $0x1, %ecx
movq %r9, %rdi
callq 0x2140
movq %rax, %rdi
movq %rdi, -0xb8(%rbp)
leaq 0x2583c(%rip), %rsi     # 0x2af24
movl $0x837, %edx            # imm = 0x837
leaq 0x2584a(%rip), %rcx     # 0x2af3e
callq 0x77c0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %edx
callq 0x26c70
movl %eax, -0xbc(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x573a
movq -0xb8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x22d0
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x8141(%rbp)
jne 0x576d
movq -0x10(%rbp), %rax
cmpq $0x400000, 0x38(%rax)   # imm = 0x400000
setg %al
movb %al, -0x8141(%rbp)
movb -0x8141(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
je 0x580e
movl -0xbc(%rbp), %edi
callq 0x12ed0
movl %eax, -0xcc(%rbp)
movslq -0xcc(%rbp), %rdi
callq 0x2280
movq %rax, -0xc8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movl -0xbc(%rbp), %edx
callq 0x26c70
movl %eax, -0xd0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movslq -0xbc(%rbp), %rsi
callq 0x78f0
movq -0xc8(%rbp), %rdi
movslq -0xd0(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %edx
callq 0x78b0
movq -0xc8(%rbp), %rdi
callq 0x2040
jmp 0x582d
movq -0xb0(%rbp), %rdi
movslq -0xbc(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %edx
callq 0x78b0
movq -0xb0(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x80(%rbp), %rsi
subq -0x30(%rbp), %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movb 0x74(%rax), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x58e0
movl -0x90(%rbp), %edx
movl $0x6, %eax
movl $0x7, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x8148(%rbp)
jmp 0x58ed
movl $0x4, %eax
movl %eax, -0x8148(%rbp)
jmp 0x58ed
movl -0x8148(%rbp), %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x98(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdx
leaq 0x25609(%rip), %rsi     # 0x2af43
movb $0x0, %al
callq 0x2370
movq -0x98(%rbp), %rdi
callq 0x2070
movq -0x98(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x9, %edx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rsi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rsi
callq 0x7840
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x29, %edx
xorl %ecx, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x6c(%rax), %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0xa8(%rax), %eax
movl %eax, %esi
callq 0x7840
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rsi
addq $0x148, %rsi            # imm = 0x148
callq 0x4df0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x140, %rsi            # imm = 0x140
callq 0x4df0
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
addq $0x138, %rsi            # imm = 0x138
callq 0x4df0
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
addq $0x130, %rsi            # imm = 0x130
callq 0x4df0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5ab8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2110
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x5df2
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5dd9
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2130
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
addl $0x5, %eax
movslq %eax, %rsi
movl $0x1, %edi
callq 0x21f0
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
callq 0x2090
movq -0xf8(%rbp), %rdi
movslq -0xec(%rbp), %rax
addq %rax, %rdi
leaq 0x2540f(%rip), %rsi     # 0x2af4b
callq 0x2090
movq -0xf8(%rbp), %rdi
leaq 0x25401(%rip), %rsi     # 0x2af50
callq 0x2330
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x5d9e
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20a0
movq %rax, -0xe8(%rbp)
movq -0xd8(%rbp), %rsi
movl $0xfe, %edi
callq 0x21c0
movq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7840
movq -0xd8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x7840
movq -0xd8(%rbp), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x5e80
movq -0xd8(%rbp), %rdi
callq 0x2270
movl %eax, %edi
callq 0x2180
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %edi
leaq 0x25329(%rip), %rsi     # 0x2af3a
callq 0x2100
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x100(%rbp)
je 0x5cf3
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jge 0x5ce5
movq -0xe8(%rbp), %rax
subq -0xe0(%rbp), %rax
cmpq $0x8000, %rax           # imm = 0x8000
jle 0x5c6e
movl $0x8000, %eax           # imm = 0x8000
movq %rax, -0x8150(%rbp)
jmp 0x5c83
movq -0xe8(%rbp), %rax
subq -0xe0(%rbp), %rax
movq %rax, -0x8150(%rbp)
movq -0x8150(%rbp), %rax
movq %rax, -0x8118(%rbp)
leaq -0x8110(%rbp), %rdi
movq -0x8118(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %edx
callq 0x7990
movq -0x100(%rbp), %rdi
leaq -0x8110(%rbp), %rsi
movq -0x8118(%rbp), %rax
movl %eax, %edx
callq 0x22b0
movq -0xe0(%rbp), %rax
addq $0x8000, %rax           # imm = 0x8000
movq %rax, -0xe0(%rbp)
jmp 0x5c36
movq -0x100(%rbp), %rdi
callq 0x2030
jmp 0x5cfe
movl -0x104(%rbp), %edi
callq 0x21b0
movq -0x10(%rbp), %rdi
movq -0xd8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x5e80
movq -0xd8(%rbp), %rdi
callq 0x20a0
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x5e80
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
subq $0x1, %rsi
callq 0x7840
movq -0xd8(%rbp), %rdi
callq 0x2110
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2110
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2070
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
callq 0x2350
jmp 0x5dcb
movq -0x10(%rbp), %rax
movb 0xe9(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0xe9(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2110
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0xf8(%rbp), %rdi
callq 0x2040
jmp 0x5df0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2110
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
jmp 0x5df2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x120(%rax)
je 0x5e1f
movl $0xffff, -0x811c(%rbp)  # imm = 0xFFFF
movq -0x10(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movl $0xffff, %esi           # imm = 0xFFFF
callq 0x79d0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x10(%rbp), %rdi
callq 0x2040
addq $0x8150, %rsp           # imm = 0x8150
popq %rbp
retq
nopw (%rax,%rax)