// File: /workspace/github_c_makefile_star2_O1/bluecmd[P]fst-example/gtkwave/fstapi.c
// Function: fstReaderInit
int fstReaderInit(struct fstReaderContext *xc)
{
off_t blkpos = 0;
off_t endfile;
uint64_t seclen;
int sectype;
uint64_t vc_section_count_actual = 0;
int hdr_incomplete = 0;
int hdr_seen = 0;
int gzread_pass_status = 1;

sectype = fgetc(xc->f);
if(sectype == FST_BL_ZWRAPPER)
        {
        FILE *fcomp;
        off_t offpnt, uclen;
        char gz_membuf[FST_GZIO_LEN];
        gzFile zhandle;
        int zfd;
        int flen = strlen(xc->filename);
        char *hf;

        seclen = fstReaderUint64(xc->f);
        uclen = fstReaderUint64(xc->f);

        if(!seclen) return(0); /* not finished compressing, this is a failed read */

        hf = (char *)calloc(1, flen + 16 + 32 + 1);

        sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
        fcomp = fopen(hf, "w+b");
        if(!fcomp)
                {
                fcomp = tmpfile_open(&xc->f_nam);
                free(hf); hf = NULL;
                if(!fcomp) { tmpfile_close(&fcomp, &xc->f_nam); return(0); }
                }

#if defined(FST_MACOSX)
        setvbuf(fcomp, (char *)NULL, _IONBF, 0);   /* keeps gzip from acting weird in tandem with fopen */
#endif

#ifdef __MINGW32__
        setvbuf(fcomp, (char *)NULL, _IONBF, 0);   /* keeps gzip from acting weird in tandem with fopen */
        xc->filename_unpacked = hf;
#else
        if(hf)
                {
                unlink(hf);
                free(hf);
                }
#endif

        fstReaderFseeko(xc, xc->f, 1+8+8, SEEK_SET);
#ifndef __MINGW32__
        fflush(xc->f);
#endif

        zfd = dup(fileno(xc->f));
        zhandle = gzdopen(zfd, "rb");
        if(zhandle)
                {
                for(offpnt = 0; offpnt < uclen; offpnt += FST_GZIO_LEN)
                        {
                        size_t this_len = ((uclen - offpnt) > FST_GZIO_LEN) ? FST_GZIO_LEN : (uclen - offpnt);
                        size_t gzreadlen = gzread(zhandle, gz_membuf, this_len);
                        size_t fwlen;

                        if(gzreadlen != this_len)
                                {
                                gzread_pass_status = 0;
                                break;
                                }
                        fwlen = fstFwrite(gz_membuf, this_len, 1, fcomp);
                        if(fwlen != 1)
                                {
                                gzread_pass_status = 0;
                                break;
                                }
                        }
                gzclose(zhandle);
                }
                else
                {
                close(zfd);
                }
        fflush(fcomp);
        fclose(xc->f);
        xc->f = fcomp;
        }

if(gzread_pass_status)
        {
        fstReaderFseeko(xc, xc->f, 0, SEEK_END);
        endfile = ftello(xc->f);

        while(blkpos < endfile)
                {
                fstReaderFseeko(xc, xc->f, blkpos, SEEK_SET);

                sectype = fgetc(xc->f);
                seclen = fstReaderUint64(xc->f);

                if(sectype == EOF)
                        {
                        break;
                        }

                if((hdr_incomplete) && (!seclen))
                        {
                        break;
                        }

                if(!hdr_seen && (sectype != FST_BL_HDR))
                        {
                        break;
                        }

                blkpos++;
                if(sectype == FST_BL_HDR)
                        {
                        if(!hdr_seen)
                                {
                                int ch;
                                double dcheck;

                                xc->start_time = fstReaderUint64(xc->f);
                                xc->end_time = fstReaderUint64(xc->f);

                                hdr_incomplete = (xc->start_time == 0) && (xc->end_time == 0);

                                fstFread(&dcheck, 8, 1, xc->f);
                                xc->double_endian_match = (dcheck == FST_DOUBLE_ENDTEST);
                                if(!xc->double_endian_match)
                                        {
                                        union   {
                                                unsigned char rvs_buf[8];
                                                double d;
                                                } vu;

                                        unsigned char *dcheck_alias = (unsigned char *)&dcheck;
                                        int rvs_idx;

                                        for(rvs_idx=0;rvs_idx<8;rvs_idx++)
                                                {
                                                vu.rvs_buf[rvs_idx] = dcheck_alias[7-rvs_idx];
                                                }
                                        if(vu.d != FST_DOUBLE_ENDTEST)
                                                {
                                                break; /* either corrupt file or wrong architecture (offset +33 also functions as matchword) */
                                                }
                                        }

                                hdr_seen = 1;

                                xc->mem_used_by_writer = fstReaderUint64(xc->f);
                                xc->scope_count = fstReaderUint64(xc->f);
                                xc->var_count = fstReaderUint64(xc->f);
                                xc->maxhandle = fstReaderUint64(xc->f);
                                xc->num_alias = xc->var_count - xc->maxhandle;
                                xc->vc_section_count = fstReaderUint64(xc->f);
                                ch = fgetc(xc->f);
                                xc->timescale = (signed char)ch;
                                fstFread(xc->version, FST_HDR_SIM_VERSION_SIZE, 1, xc->f);
                                xc->version[FST_HDR_SIM_VERSION_SIZE] = 0;
                                fstFread(xc->date, FST_HDR_DATE_SIZE, 1, xc->f);
                                xc->date[FST_HDR_DATE_SIZE] = 0;
                                ch = fgetc(xc->f);
                                xc->filetype = (unsigned char)ch;
                                xc->timezero = fstReaderUint64(xc->f);
                                }
                        }
                else if((sectype == FST_BL_VCDATA) || (sectype == FST_BL_VCDATA_DYN_ALIAS) || (sectype == FST_BL_VCDATA_DYN_ALIAS2))
                        {
                        if(hdr_incomplete)
                                {
                                uint64_t bt = fstReaderUint64(xc->f);
                                xc->end_time = fstReaderUint64(xc->f);

                                if(!vc_section_count_actual) { xc->start_time = bt; }
                                }

                        vc_section_count_actual++;
                        }
                else if(sectype == FST_BL_GEOM)
                        {
                        if(!hdr_incomplete)
                                {
                                uint64_t clen = seclen - 24;
                                uint64_t uclen = fstReaderUint64(xc->f);
                                unsigned char *ucdata = (unsigned char *)malloc(uclen);
                                unsigned char *pnt = ucdata;
                                unsigned int i;

                                xc->contains_geom_section = 1;
                                xc->maxhandle = fstReaderUint64(xc->f);
                                xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */

                                free(xc->process_mask);
                                xc->process_mask = (unsigned char *)calloc(1, (xc->maxhandle+7)/8);

                                if(clen != uclen)
                                        {
                                        unsigned char *cdata = (unsigned char *)malloc(clen);
                                        unsigned long destlen = uclen;
                                        unsigned long sourcelen = clen;
                                        int rc;

                                        fstFread(cdata, clen, 1, xc->f);
                                        rc = uncompress(ucdata, &destlen, cdata, sourcelen);

                                        if(rc != Z_OK)
                                                {
                                                fprintf(stderr, FST_APIMESS "fstReaderInit(), geom uncompress rc = %d, exiting.\n", rc);
                                                exit(255);
                                                }

                                        free(cdata);
                                        }
                                        else
                                        {
                                        fstFread(ucdata, uclen, 1, xc->f);
                                        }

                                free(xc->signal_lens);
                                xc->signal_lens = (uint32_t *)malloc(sizeof(uint32_t) * xc->maxhandle);
                                free(xc->signal_typs);
                                xc->signal_typs = (unsigned char *)malloc(sizeof(unsigned char) * xc->maxhandle);

                                for(i=0;i<xc->maxhandle;i++)
                                        {
                                        int skiplen;
                                        uint64_t val = fstGetVarint32(pnt, &skiplen);

                                        pnt += skiplen;

                                        if(val)
                                                {
                                                xc->signal_lens[i] = (val != 0xFFFFFFFF) ? val : 0;
                                                xc->signal_typs[i] = FST_VT_VCD_WIRE;
                                                if(xc->signal_lens[i] > xc->longest_signal_value_len)
                                                        {
                                                        xc->longest_signal_value_len = xc->signal_lens[i];
                                                        }
                                                }
                                                else
                                                {
                                                xc->signal_lens[i] = 8; /* backpatch in real */
                                                xc->signal_typs[i] = FST_VT_VCD_REAL;
                                                /* xc->longest_signal_value_len handled above by overly large init size */
                                                }
                                        }

                                free(xc->temp_signal_value_buf);
                                xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);

                                free(ucdata);
                                }
                        }
                else if(sectype == FST_BL_HIER)
                        {
                        xc->contains_hier_section = 1;
                        xc->hier_pos = ftello(xc->f);
                        }
                else if(sectype == FST_BL_HIER_LZ4DUO)
                        {
                        xc->contains_hier_section_lz4    = 1;
                        xc->contains_hier_section_lz4duo = 1;
                        xc->hier_pos = ftello(xc->f);
                        }
                else if(sectype == FST_BL_HIER_LZ4)
                        {
                        xc->contains_hier_section_lz4 = 1;
                        xc->hier_pos = ftello(xc->f);
                        }
                else if(sectype == FST_BL_BLACKOUT)
                        {
                        uint32_t i;
                        uint64_t cur_bl = 0;
                        uint64_t delta;

                        xc->num_blackouts = fstReaderVarint32(xc->f);
                        free(xc->blackout_times);
                        xc->blackout_times = (uint64_t *)calloc(xc->num_blackouts, sizeof(uint64_t));
                        free(xc->blackout_activity);
                        xc->blackout_activity = (unsigned char *)calloc(xc->num_blackouts, sizeof(unsigned char));

                        for(i=0;i<xc->num_blackouts;i++)
                                {
                                xc->blackout_activity[i] = fgetc(xc->f) != 0;
                                delta = fstReaderVarint64(xc->f);
                                cur_bl += delta;
                                xc->blackout_times[i] = cur_bl;
                                }
                        }

                blkpos += seclen;
                if(!hdr_seen) break;
                }

        if(hdr_seen)
                {
                if(xc->vc_section_count != vc_section_count_actual)
                        {
                        xc->vc_section_count = vc_section_count_actual;
                        }

                if(!xc->contains_geom_section)
                        {
                        fstReaderProcessHier(xc, NULL); /* recreate signal_lens/signal_typs info */
                        }
                }
        }

return(hdr_seen);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8048, %rsp           # imm = 0x8048
movq %rdi, %r12
movq (%rdi), %rdi
callq 0x21a0
movl $0x1, %ebx
cmpl $0xfe, %eax
jne 0x8e25
movq 0x180(%r12), %rdi
callq 0x2130
movq %rax, %r14
movq (%r12), %rdi
callq 0x948d
movq %r12, %r15
movq %rax, %r12
movq (%r15), %rdi
callq 0x948d
xorl %r13d, %r13d
testq %r12, %r12
je 0x8e18
movq %rax, -0x30(%rbp)
addl $0x31, %r14d
movslq %r14d, %rsi
movl $0x1, %edi
callq 0x21e0
movq %rax, %r12
movq 0x180(%r15), %r14
callq 0x20f0
leaq 0xc98c(%rip), %rsi      # 0x155fa
movq %r12, %rdi
movq %r14, %rdx
movl %eax, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x2370
leaq 0xc681(%rip), %rsi      # 0x15308
movq %r12, %rdi
callq 0x2330
movq %rax, -0x40(%rbp)
testq %rax, %rax
jne 0x8cc3
callq 0x21f0
movq %rax, %r14
movq $0x0, 0x106a0(%r15)
movq %rax, -0x40(%rbp)
movq %r12, %rdi
callq 0x2050
testq %r14, %r14
je 0x8e08
xorl %r12d, %r12d
testq %r12, %r12
je 0x8cd8
movq %r12, %rdi
callq 0x2080
movq %r12, %rdi
callq 0x2050
movq %r15, %r12
movq (%r15), %rdi
movl $0x11, %esi
xorl %edx, %edx
callq 0x2320
testl %eax, %eax
jns 0x8cf7
orb $0x1, 0x697(%r12)
movq (%r12), %rdi
callq 0x2280
movq (%r12), %rdi
callq 0x2260
movl %eax, %edi
callq 0x2180
movl %eax, %r14d
leaq 0xc8ed(%rip), %rsi      # 0x15607
movl %eax, %edi
callq 0x2100
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x8de2
movq %r12, -0x58(%rbp)
movq -0x30(%rbp), %r13
testq %r13, %r13
jle 0x8dd0
movl $0x1, %r15d
movl $0x8000, %r12d          # imm = 0x8000
movl $0x8000, %eax           # imm = 0x8000
cmpq %rax, %r13
movl $0x8000, %r14d          # imm = 0x8000
cmovlq %r13, %r14
movq -0x38(%rbp), %rdi
leaq -0x8070(%rbp), %rsi
movl %r14d, %edx
callq 0x2200
movslq %eax, %rcx
movl $0x0, %eax
movl $0x0, %ebx
cmpq %rcx, %r14
jne 0x8dad
movq -0x40(%rbp), %rcx
movl $0x1, %edx
leaq -0x8070(%rbp), %rdi
movq %r14, %rsi
callq 0x2390
cmpq $0x1, %rax
sete %al
movl $0x0, %ecx
cmovnel %ecx, %r15d
movl %r15d, %ebx
testb %al, %al
je 0x8dd0
leaq 0x8000(%r12), %rax
addq $-0x8000, %r13          # imm = 0x8000
movl %ebx, %r15d
cmpq -0x30(%rbp), %r12
movq %rax, %r12
jl 0x8d4b
movq -0x38(%rbp), %rdi
callq 0x2040
movq -0x58(%rbp), %r12
xorl %r13d, %r13d
jmp 0x8dea
movl %r14d, %edi
callq 0x21b0
movq -0x40(%rbp), %rdi
callq 0x2280
movq (%r12), %rdi
callq 0x2110
movq -0x40(%rbp), %rax
movq %rax, (%r12)
movb $0x1, %al
jmp 0x8e1d
leaq 0x106a0(%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3ee0
xorl %eax, %eax
movq %r15, %r12
testb %al, %al
je 0x946c
testl %ebx, %ebx
je 0x9469
movq (%r12), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2320
testl %eax, %eax
jns 0x8e4a
orb $0x1, 0x697(%r12)
movq (%r12), %rdi
callq 0x20b0
movq %rax, -0x58(%rbp)
leaq 0x7b(%r12), %rax
movq %rax, -0x70(%rbp)
leaq 0xfc(%r12), %rax
movq %rax, -0x68(%rbp)
movb $0x1, %r14b
movabsq $0x100000000, %r15      # imm = 0x100000000
xorl %eax, %eax
movl $0x0, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
xorl %r13d, %r13d
cmpq -0x58(%rbp), %r13
jge 0x942f
movl %eax, -0x38(%rbp)
movq (%r12), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2320
testl %eax, %eax
jns 0x8eb5
orb $0x1, 0x697(%r12)
movq (%r12), %rdi
callq 0x21a0
movq %r12, %rcx
movl %eax, %r12d
movq %rcx, %rbx
movq (%rcx), %rdi
callq 0x948d
cmpl $-0x1, %r12d
je 0x9429
movq %rax, %rdx
cmpl $0x0, -0x30(%rbp)
sete %al
testq %rdx, %rdx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x9429
testl %r12d, %r12d
setne %al
testb %al, %r14b
jne 0x9434
cmpl $0x8, %r12d
ja 0x91ee
movl %r12d, %eax
leaq 0xc2b9(%rip), %rcx      # 0x151d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x30(%rbp)
movq %rbx, %r12
je 0x8f55
movq (%r12), %rdi
movq %rdx, %rbx
callq 0x948d
movq %rax, %r14
movq (%r12), %rdi
callq 0x948d
movq %rbx, %rdx
movq %rax, 0x18(%r12)
cmpq $0x0, -0x50(%rbp)
jne 0x8f55
movq %r14, 0x10(%r12)
incq -0x50(%rbp)
jmp 0x93e6
movq %rbx, %r12
orb $0x40, 0x7a(%rbx)
jmp 0x8f90
cmpl $0x0, -0x30(%rbp)
movq %rbx, %r12
je 0x91f6
movl $0x1, -0x30(%rbp)
jmp 0x93e6
movq %rbx, %r12
orb $0x10, 0x7a(%rbx)
jmp 0x8f90
movq %rbx, %r12
orb $0x60, 0x7a(%rbx)
movq (%rbx), %rdi
movq %rdx, %rbx
callq 0x20b0
movq %rbx, %rdx
movq %rax, 0x190(%r12)
jmp 0x93e6
movq %rdx, -0x48(%rbp)
movq %rbx, %r12
movq (%rbx), %rdi
callq 0x83cd
movl %eax, 0x198(%rbx)
movq 0x1a0(%rbx), %rdi
callq 0x2050
movl 0x198(%rbx), %edi
movl $0x8, %esi
callq 0x21e0
movq %rax, 0x1a0(%rbx)
movq 0x1a8(%rbx), %rdi
callq 0x2050
movl 0x198(%rbx), %r14d
movl $0x1, %esi
movq %r14, %rdi
callq 0x21e0
movq %rax, 0x1a8(%rbx)
testq %r14, %r14
je 0x93e2
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r12), %rdi
callq 0x21a0
testl %eax, %eax
movq 0x1a8(%r12), %rax
setne (%rax,%rbx)
movq (%r12), %rdi
callq 0x8385
addq %rax, %r14
movq 0x1a0(%r12), %rax
movq %r14, (%rax,%rbx,8)
incq %rbx
movl 0x198(%r12), %eax
cmpq %rax, %rbx
jb 0x9018
jmp 0x93e2
movl $0x1, %eax
testb $0x1, %r14b
movq %rbx, %r12
je 0x93e9
movq %rdx, -0x48(%rbp)
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x10(%r12)
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x18(%r12)
movl $0x0, -0x30(%rbp)
orq 0x10(%r12), %rax
sete %r14b
movq (%r12), %rcx
movl $0x8, %esi
movl $0x1, %edx
leaq -0x8070(%rbp), %rdi
callq 0x20c0
movsd -0x8070(%rbp), %xmm0
movsd 0xc238(%rip), %xmm1     # 0x15300
ucomisd %xmm1, %xmm0
setnp %al
sete %cl
andb %al, %cl
movb 0x7a(%r12), %al
addb %cl, %cl
andb $-0x3, %al
orb %cl, %al
ucomisd %xmm1, %xmm0
movb %al, 0x7a(%r12)
jne 0x90ec
jnp 0x9120
leaq -0x8069(%rbp), %rax
xorl %ecx, %ecx
movb (%rax), %dl
movb %dl, -0x40(%rbp,%rcx)
incq %rcx
decq %rax
cmpq $0x8, %rcx
jne 0x90f5
movsd -0x40(%rbp), %xmm0
ucomisd 0xc1ec(%rip), %xmm0     # 0x15300
jne 0x9401
jp 0x9401
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x20(%r12)
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x28(%r12)
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x30(%r12)
movq (%r12), %rdi
callq 0x948d
movl %eax, 0x38(%r12)
movq (%r12), %rdi
movq 0x30(%r12), %rcx
movl %eax, %eax
subq %rax, %rcx
movq %rcx, 0x40(%r12)
callq 0x948d
movq %rax, 0x48(%r12)
movq (%r12), %rdi
callq 0x21a0
movb %al, 0x78(%r12)
movq (%r12), %rcx
movl $0x80, %esi
movl $0x1, %edx
movq -0x70(%rbp), %rdi
callq 0x20c0
xorl %ebx, %ebx
movb %bl, 0xfb(%r12)
movq (%r12), %rcx
movl $0x77, %esi
movl $0x1, %edx
movq -0x68(%rbp), %rdi
callq 0x20c0
movb %bl, 0x173(%r12)
movq (%r12), %rdi
callq 0x21a0
movb %al, 0x79(%r12)
movq (%r12), %rdi
callq 0x948d
movq %rax, 0x178(%r12)
movl $0x1, %ecx
movb $0x1, %al
jmp 0x9414
movq %rbx, %r12
jmp 0x93e6
movq %rdx, -0x48(%rbp)
leaq -0x18(%rdx), %r14
movq (%r12), %rdi
callq 0x948d
movq %r12, %rbx
movq %rax, %r12
movq %rax, %rdi
callq 0x2270
movq %rax, -0x30(%rbp)
orb $0x8, 0x7a(%rbx)
movq (%rbx), %rdi
callq 0x948d
movl %eax, 0x38(%rbx)
movl $0x20, 0x68(%rbx)
movq 0x60(%rbx), %rdi
callq 0x2050
movl 0x38(%rbx), %esi
addl $0x7, %esi
shrl $0x3, %esi
movl $0x1, %edi
callq 0x21e0
movq %rax, 0x60(%rbx)
cmpq %r12, %r14
jne 0x926d
movq (%rbx), %rcx
movl $0x1, %edx
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x20c0
movq %rbx, %r12
jmp 0x92c6
movq %r14, %rax
movq %r14, %rdi
movq %rax, -0x60(%rbp)
callq 0x2270
movq %rax, %r14
movq %r12, -0x8070(%rbp)
movq (%rbx), %rcx
movl $0x1, %edx
movq %rax, %rdi
movq -0x60(%rbp), %r12
movq %r12, %rsi
callq 0x20c0
movq -0x30(%rbp), %rdi
leaq -0x8070(%rbp), %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x2120
testl %eax, %eax
jne 0x9486
movq %rbx, %r12
movq %r14, %rdi
callq 0x2050
movq 0x50(%r12), %rdi
callq 0x2050
movl 0x38(%r12), %edi
shlq $0x2, %rdi
callq 0x2270
movq %rax, 0x50(%r12)
movq 0x58(%r12), %rdi
callq 0x2050
movl 0x38(%r12), %r14d
movq %r14, %rdi
callq 0x2270
movq %rax, 0x58(%r12)
testq %r14, %r14
movl $0x0, %r10d
movq -0x30(%rbp), %rbx
je 0x93b8
xorl %eax, %eax
movq %rbx, %rcx
leaq -0x1(%rcx), %rsi
movl $0x1, %r8d
xorl %edx, %edx
movq %rsi, %r9
addq %r15, %rdx
cmpb $0x0, 0x1(%r9)
movq %r8, %rdi
leaq 0x1(%r9), %r9
leaq 0x1(%r8), %r8
js 0x9326
xorl %r8d, %r8d
movl %r8d, %r9d
shll $0x7, %r9d
movzbl (%rsi,%rdi), %r8d
andl $0x7f, %r8d
orl %r9d, %r8d
decq %rdi
jne 0x933e
testl %r8d, %r8d
je 0x938b
cmpl $-0x1, %r8d
cmovel %r10d, %r8d
movq 0x50(%r12), %rsi
movl %r8d, (%rsi,%rax,4)
movq 0x58(%r12), %rsi
movb $0x10, (%rsi,%rax)
movq 0x50(%r12), %rsi
movl (%rsi,%rax,4), %esi
cmpl 0x68(%r12), %esi
jbe 0x93a0
movl %esi, 0x68(%r12)
jmp 0x93a0
movq 0x50(%r12), %rsi
movl $0x8, (%rsi,%rax,4)
movq 0x58(%r12), %rsi
movb $0x3, (%rsi,%rax)
sarq $0x20, %rdx
addq %rdx, %rcx
incq %rax
movl 0x38(%r12), %edx
cmpq %rdx, %rax
jb 0x9317
movq 0x70(%r12), %rdi
callq 0x2050
movl 0x68(%r12), %edi
incl %edi
callq 0x2270
movq %rax, 0x70(%r12)
movq %rbx, %rdi
callq 0x2050
movl $0x0, -0x30(%rbp)
movq -0x48(%rbp), %rdx
movl -0x38(%rbp), %eax
incq %r13
addq %rdx, %r13
xorl %r14d, %r14d
testl %eax, %eax
movl $0x1, %eax
jne 0x8e8d
jmp 0x943a
cmpeqsd 0xbef6(%rip), %xmm0     # 0x15300
movq %xmm0, %rax
andl $0x1, %eax
xorl %ecx, %ecx
testb %al, %al
movq -0x48(%rbp), %rdx
je 0x9481
movl -0x30(%rbp), %eax
movb %r14b, %al
movl %eax, -0x30(%rbp)
movl %ecx, %eax
jmp 0x93e9
movl -0x38(%rbp), %r14d
jmp 0x9437
movl %eax, %r14d
jmp 0x943a
xorl %r14d, %r14d
movq %rbx, %r12
testl %r14d, %r14d
je 0x9469
movq -0x50(%rbp), %rax
cmpq %rax, 0x48(%r12)
je 0x944f
movq %rax, 0x48(%r12)
movl $0x1, %r13d
testb $0x8, 0x7a(%r12)
jne 0x946c
movq %r12, %rdi
xorl %esi, %esi
callq 0x8412
jmp 0x946c
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8048, %rsp           # imm = 0x8048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %r14d
jmp 0x943a
movl %eax, %edi
callq 0x269b