// File: /workspace/github_c_makefile_star2_O0/hiperiondev[P]hpsdrsim/src/hpsdr_newprotocol.c
// Function: rx_thread
void* rx_thread(void *data) {
    int sock;
    struct sockaddr_in addr;
    // One instance of this thread is started for each DDC
    unsigned long seqnum;
    unsigned char buffer[1444];
    int yes = 1;
    int i;
    long wait;
    double i0sample, q0sample;
    double i1sample, q1sample;
    double irsample, qrsample;
    double fac;
    int sample;
    unsigned char *p;
    int noisept, tonept;
    int myddc;
    int sync, size;
    int myadc, syncadc;
    int rxptr;
    int divptr;
    int decimation;
    unsigned int seed;

    struct timespec delay;

    syncadc = 0;

    myddc = (int) (uintptr_t) data;
    if (myddc < 0 || myddc >= NUMRECEIVERS)
        return NULL;

    dbg_printf(1, "-- Start rx_thread %d port: %d\n", myddc, ddc0_port + myddc);

    seqnum = 0;
    // unique seed value for random number generator
    seed = ((uintptr_t) &seed) & 0xffffff;

    sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (sock < 0) {
        dbg_printf(1, "***** ERROR: RXthread: socket\n");
        return NULL;
    }

    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &yes, sizeof(yes));
    setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void*) &yes, sizeof(yes));

    memset(&addr, 0, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = htonl(INADDR_ANY);
    addr.sin_port = htons(ddc0_port + myddc);

    if (bind(sock, (struct sockaddr*) &addr, sizeof(addr)) < 0) {
        dbg_printf(1, "***** ERROR: RXthread: bind\n");
        close(sock);
        return NULL;
    }

    tonept = noisept = 0;
    clock_gettime(CLOCK_MONOTONIC, &delay);
    dbg_printf(1, "RX thread %d, enabled=%d\n", myddc, ddcenable[myddc]);
    rxptr = txptr - 4096;
    if (rxptr < 0)
        rxptr += NEWRTXLEN;
    divptr = 0;

    while (run) {
        if (ddcenable[myddc] <= 0 || rxrate[myddc] == 0 || rxfreq[myddc] == 0) {
            usleep(5000);
            clock_gettime(CLOCK_MONOTONIC, &delay);
            rxptr = txptr - 4096;
            if (rxptr < 0)
                rxptr += NEWRTXLEN;
            continue;
        }
        decimation = 1536 / rxrate[myddc];
        myadc = adcmap[myddc];
        // for simplicity, we only allow for a single "synchronized" DDC,
        // this well covers the PURESIGNAL and DIVERSITY cases
        sync = 0;
        i = syncddc[myddc];
        while (i) {
            sync++;
            i = i >> 1;
        }
        // sync == 0 means no synchronizatsion
        // sync == 1,2,3  means synchronization with DDC0,1,2
        // Usually we send 238 samples per buffer, but with synchronization
        // we send 119 sample *pairs*.
        if (sync) {
            size = 119;
            wait = 119000000L / rxrate[myddc]; // time for these samples in nano-secs
            syncadc = adcmap[sync - 1];
        } else {
            size = 238;
            wait = 238000000L / rxrate[myddc]; // time for these samples in nano-secs
        }

        // ADC0 RX: noise + 800Hz signal at -73 dBm
        // ADC0 TX: noise + distorted TX signal
        // ADC1 RX: noise
        // ADC1 TX: HERMES only: original TX signal
        // ADC2   : original TX signal
        p = buffer;
        *p++ = (seqnum >> 24) & 0xFF;
        *p++ = (seqnum >> 16) & 0xFF;
        *p++ = (seqnum >> 8) & 0xFF;
        *p++ = (seqnum >> 0) & 0xFF;
        seqnum += 1;
        // do not use time stamps
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        *p++ = 0;
        // 24 bits per sample *ALWAYS*
        *p++ = 0;
        *p++ = 24;
        *p++ = 0;
        *p++ = sync ? 2 * size : size;  // should be 238 in either case
        for (i = 0; i < size; i++) {
            // produce noise depending on the ADC
            i1sample = i0sample = noiseItab[noisept];
            q1sample = q0sample = noiseQtab[noisept++];
            if (noisept == LENNOISE)
                noisept = rand_r(&seed) / NOISEDIV;
            // PS: produce sample PAIRS,
            // a) distorted TX data (with Drive and Attenuation)
            // b) original TX data (normalized)
            //
            // DIV: produce sample PAIRS,
            // a) add man-made-noise on I-sample of RX channel
            // b) add man-made-noise on Q-sample of "synced" channel
            if (sync && (rxrate[myadc] == 192) && ptt && (syncadc == adc)) {
                irsample = isample[rxptr];
                qrsample = qsample[rxptr++];
                if (rxptr >= NEWRTXLEN)
                    rxptr = 0;
                fac = txatt_dbl * txdrv_dbl * (IM3a + IM3b * (irsample * irsample + qrsample * qrsample) * txdrv_dbl * txdrv_dbl);
                if (myadc == 0) {
                    i0sample += irsample * fac;
                    q0sample += qrsample * fac;
                }
                i1sample = irsample * 0.2899;
                q1sample = qrsample * 0.2899;
            } else if (myadc == 0) {
                i0sample += toneItab[tonept] * 0.0002239 * rxatt0_dbl;
                q0sample += toneQtab[tonept] * 0.0002239 * rxatt0_dbl;
                tonept += decimation;
                if (tonept >= LENTONE)
                    tonept = 0;
            }
            if (diversity && !sync && myadc == 0) {
                i0sample += 0.0001 * rxatt0_dbl * divtab[divptr];
                divptr += decimation;
                if (divptr >= LENDIV)
                    divptr = 0;
            }
            if (diversity && !sync && myadc == 1) {
                q0sample += 0.0002 * rxatt1_dbl * divtab[divptr];
                divptr += decimation;
                if (divptr >= LENDIV)
                    divptr = 0;
            }
            if (diversity && sync && !ptt) {
                if (myadc == 0)
                    i0sample += 0.0001 * rxatt0_dbl * divtab[divptr];
                if (syncadc == 1)
                    q1sample += 0.0002 * rxatt1_dbl * divtab[divptr];
                divptr += decimation;
                if (divptr >= LENDIV)
                    divptr = 0;
            }
            if (sync) {
                sample = i0sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
                sample = q0sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
                sample = i1sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
                sample = q1sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
            } else {
                sample = i0sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
                sample = q0sample * 8388607.0;
                *p++ = (sample >> 16) & 0xFF;
                *p++ = (sample >> 8) & 0xFF;
                *p++ = (sample >> 0) & 0xFF;
            }
        }
        delay.tv_nsec += wait;
        while (delay.tv_nsec >= 1000000000) {
            delay.tv_nsec -= 1000000000;
            delay.tv_sec++;
        }

        clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &delay, NULL);

        if (sendto(sock, buffer, 1444, 0, (struct sockaddr*) &addr_new, sizeof(addr_new)) < 0) {
            dbg_printf(1, "***** ERROR: RX thread sendto\n");
            break;
        }
    }
    close(sock);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x680, %rsp            # imm = 0x680
movq %rdi, -0x10(%rbp)
movl $0x1, -0x5e4(%rbp)
movl $0x0, -0x654(%rbp)
movq -0x10(%rbp), %rax
movl %eax, -0x644(%rbp)
cmpl $0x0, -0x644(%rbp)
jl 0x503f
cmpl $0x4, -0x644(%rbp)
jl 0x504c
movq $0x0, -0x8(%rbp)
jmp 0x5e8a
movl -0x644(%rbp), %edx
movl 0xb2c0(%rip), %ecx      # 0x10318
addl -0x644(%rbp), %ecx
movl $0x1, %edi
leaq 0x7b62(%rip), %rsi      # 0xcbcc
movb $0x0, %al
callq 0x1370
movq $0x0, -0x30(%rbp)
leaq -0x664(%rbp), %rax
andq $0xffffff, %rax         # imm = 0xFFFFFF
movl %eax, -0x664(%rbp)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x1230
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x50c3
movl $0x1, %edi
leaq 0x7b3d(%rip), %rsi      # 0xcbec
movb $0x0, %al
callq 0x1370
movq $0x0, -0x8(%rbp)
jmp 0x5e8a
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x5e4(%rbp), %rcx
movl $0x4, %r8d
callq 0x1060
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0xf, %edx
leaq -0x5e4(%rbp), %rcx
movl $0x4, %r8d
callq 0x1060
leaq -0x24(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x10f0
movw $0x2, -0x24(%rbp)
xorl %edi, %edi
callq 0x10e0
movl %eax, -0x20(%rbp)
movl 0xb1f1(%rip), %eax      # 0x10318
addl -0x644(%rbp), %eax
movzwl %ax, %edi
callq 0x10b0
movw %ax, -0x22(%rbp)
movl -0x14(%rbp), %edi
leaq -0x24(%rbp), %rsi
movl $0x10, %edx
callq 0x1180
cmpl $0x0, %eax
jge 0x5177
movl $0x1, %edi
leaq 0x7ab0(%rip), %rsi      # 0xcc0b
movb $0x0, %al
callq 0x1370
movl -0x14(%rbp), %edi
callq 0x1110
movq $0x0, -0x8(%rbp)
jmp 0x5e8a
movl $0x0, -0x63c(%rbp)
movl $0x0, -0x640(%rbp)
movl $0x1, %edi
leaq -0x678(%rbp), %rsi
callq 0x1080
movl -0x644(%rbp), %edx
movslq -0x644(%rbp), %rcx
leaq 0xb200(%rip), %rax      # 0x103b0
movl (%rax,%rcx,4), %ecx
movl $0x1, %edi
leaq 0x7a69(%rip), %rsi      # 0xcc28
movb $0x0, %al
callq 0x1370
movl 0xaf84(%rip), %eax      # 0x10150
subl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x658(%rbp)
cmpl $0x0, -0x658(%rbp)
jge 0x51f1
movl -0x658(%rbp), %eax
addl $0xfb40, %eax           # imm = 0xFB40
movl %eax, -0x658(%rbp)
movl $0x0, -0x65c(%rbp)
cmpl $0x0, 0xb0ee(%rip)      # 0x102f0
je 0x5e7a
movslq -0x644(%rbp), %rcx
leaq 0xb19a(%rip), %rax      # 0x103b0
cmpl $0x0, (%rax,%rcx,4)
jle 0x5245
movslq -0x644(%rbp), %rcx
leaq 0xb2e6(%rip), %rax      # 0x10510
cmpl $0x0, (%rax,%rcx,4)
je 0x5245
movslq -0x644(%rbp), %rcx
leaq 0xb1a2(%rip), %rax      # 0x103e0
cmpq $0x0, (%rax,%rcx,8)
jne 0x5290
movl $0x1388, %edi           # imm = 0x1388
callq 0x1220
movl $0x1, %edi
leaq -0x678(%rbp), %rsi
callq 0x1080
movl 0xaeea(%rip), %eax      # 0x10150
subl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x658(%rbp)
cmpl $0x0, -0x658(%rbp)
jge 0x528b
movl -0x658(%rbp), %eax
addl $0xfb40, %eax           # imm = 0xFB40
movl %eax, -0x658(%rbp)
jmp 0x51fb
movslq -0x644(%rbp), %rsi
movl $0x600, %eax            # imm = 0x600
leaq 0xb26d(%rip), %rcx      # 0x10510
cltd
idivl (%rcx,%rsi,4)
movl %eax, -0x660(%rbp)
movslq -0x644(%rbp), %rcx
leaq 0xb105(%rip), %rax      # 0x103c0
movl (%rax,%rcx,4), %eax
movl %eax, -0x650(%rbp)
movl $0x0, -0x648(%rbp)
movslq -0x644(%rbp), %rcx
leaq 0xb0f4(%rip), %rax      # 0x103d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x5e8(%rbp)
cmpl $0x0, -0x5e8(%rbp)
je 0x530d
movl -0x648(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x648(%rbp)
movl -0x5e8(%rbp), %eax
sarl %eax
movl %eax, -0x5e8(%rbp)
jmp 0x52e5
cmpl $0x0, -0x648(%rbp)
je 0x5361
movl $0x77, -0x64c(%rbp)
movslq -0x644(%rbp), %rcx
leaq 0xb1e2(%rip), %rax      # 0x10510
movslq (%rax,%rcx,4), %rcx
movl $0x717cbc0, %eax        # imm = 0x717CBC0
cqto
idivq %rcx
movq %rax, -0x5f0(%rbp)
movl -0x648(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xb06a(%rip), %rax      # 0x103c0
movl (%rax,%rcx,4), %eax
movl %eax, -0x654(%rbp)
jmp 0x538e
movl $0xee, -0x64c(%rbp)
movslq -0x644(%rbp), %rcx
leaq 0xb197(%rip), %rax      # 0x10510
movslq (%rax,%rcx,4), %rcx
movl $0xe2f9780, %eax        # imm = 0xE2F9780
cqto
idivq %rcx
movq %rax, -0x5f0(%rbp)
leaq -0x5e0(%rbp), %rax
movq %rax, -0x638(%rbp)
movq -0x30(%rbp), %rax
shrq $0x18, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movq -0x30(%rbp), %rax
shrq $0x10, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movq -0x30(%rbp), %rax
shrq $0x8, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movq -0x30(%rbp), %rax
shrq $0x0, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x18, (%rax)
movq -0x638(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x638(%rbp)
movb $0x0, (%rax)
cmpl $0x0, -0x648(%rbp)
je 0x5565
movl -0x64c(%rbp), %eax
shll %eax
movl %eax, -0x67c(%rbp)
jmp 0x5571
movl -0x64c(%rbp), %eax
movl %eax, -0x67c(%rbp)
movl -0x67c(%rbp), %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl $0x0, -0x5e8(%rbp)
movl -0x5e8(%rbp), %eax
cmpl -0x64c(%rbp), %eax
jge 0x5dd6
movslq -0x63c(%rbp), %rcx
leaq 0xb096(%rip), %rax      # 0x10650
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x5f8(%rbp)
movsd %xmm0, -0x608(%rbp)
movl -0x63c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x63c(%rbp)
movslq %eax, %rcx
leaq 0xbc3066(%rip), %rax    # 0xbc8650
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x600(%rbp)
movsd %xmm0, -0x610(%rbp)
cmpl $0x177000, -0x63c(%rbp) # imm = 0x177000
jne 0x5625
leaq -0x664(%rbp), %rdi
callq 0x10a0
movl $0xaec, %ecx            # imm = 0xAEC
cltd
idivl %ecx
movl %eax, -0x63c(%rbp)
cmpl $0x0, -0x648(%rbp)
je 0x57c3
movslq -0x650(%rbp), %rcx
leaq 0xaed0(%rip), %rax      # 0x10510
cmpl $0xc0, (%rax,%rcx,4)
jne 0x57c3
cmpl $0x0, 0xaf84(%rip)      # 0x105d8
je 0x57c3
movl -0x654(%rbp), %eax
cmpl 0xae9a(%rip), %eax      # 0x10500
jne 0x57c3
movslq -0x658(%rbp), %rcx
leaq 0x17d63d6(%rip), %rax   # 0x17dba50
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x618(%rbp)
movl -0x658(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x658(%rbp)
movslq %eax, %rcx
leaq 0x18543ae(%rip), %rax   # 0x1859a50
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x620(%rbp)
cmpl $0xfb40, -0x658(%rbp)   # imm = 0xFB40
jl 0x56c5
movl $0x0, -0x658(%rbp)
movsd 0xaa6b(%rip), %xmm0     # 0x10138
mulsd 0xaf23(%rip), %xmm0     # 0x105f8
movsd -0x618(%rbp), %xmm2
movsd -0x618(%rbp), %xmm3
movsd -0x620(%rbp), %xmm1
mulsd -0x620(%rbp), %xmm1
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movsd 0x699b(%rip), %xmm1     # 0xc0a0
mulsd %xmm2, %xmm1
mulsd 0xaee7(%rip), %xmm1     # 0x105f8
movsd 0xaedf(%rip), %xmm2     # 0x105f8
mulsd %xmm2, %xmm1
movsd 0x6973(%rip), %xmm2     # 0xc098
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x628(%rbp)
cmpl $0x0, -0x650(%rbp)
jne 0x578e
movsd -0x618(%rbp), %xmm0
movsd -0x628(%rbp), %xmm2
movsd -0x5f8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x5f8(%rbp)
movsd -0x620(%rbp), %xmm0
movsd -0x628(%rbp), %xmm2
movsd -0x600(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x600(%rbp)
movsd 0x6912(%rip), %xmm0     # 0xc0a8
mulsd -0x618(%rbp), %xmm0
movsd %xmm0, -0x608(%rbp)
movsd 0x68fa(%rip), %xmm0     # 0xc0a8
mulsd -0x620(%rbp), %xmm0
movsd %xmm0, -0x610(%rbp)
jmp 0x5872
cmpl $0x0, -0x650(%rbp)
jne 0x5870
movslq -0x640(%rbp), %rcx
movsd 0x68b1(%rip), %xmm0     # 0xc090
leaq 0x1798e6a(%rip), %rax   # 0x179e650
mulsd (%rax,%rcx,8), %xmm0
movsd 0xa955(%rip), %xmm2     # 0x10148
movsd -0x5f8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x5f8(%rbp)
movslq -0x640(%rbp), %rcx
movsd 0x6876(%rip), %xmm0     # 0xc090
leaq 0x177ae2f(%rip), %rax   # 0x1780650
mulsd (%rax,%rcx,8), %xmm0
movsd 0xa91a(%rip), %xmm2     # 0x10148
movsd -0x600(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x600(%rbp)
movl -0x660(%rbp), %eax
addl -0x640(%rbp), %eax
movl %eax, -0x640(%rbp)
cmpl $0x3c00, -0x640(%rbp)   # imm = 0x3C00
jl 0x586e
movl $0x0, -0x640(%rbp)
jmp 0x5870
jmp 0x5872
leaq 0xada7(%rip), %rax      # 0x10620
cmpl $0x0, (%rax)
je 0x58f5
cmpl $0x0, -0x648(%rbp)
jne 0x58f5
cmpl $0x0, -0x650(%rbp)
jne 0x58f5
movsd 0x6818(%rip), %xmm0     # 0xc0b0
mulsd 0xa8a8(%rip), %xmm0     # 0x10148
movslq -0x65c(%rbp), %rcx
leaq 0x17b6da2(%rip), %rax   # 0x17bc650
movsd (%rax,%rcx,8), %xmm2
movsd -0x5f8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x5f8(%rbp)
movl -0x660(%rbp), %eax
addl -0x65c(%rbp), %eax
movl %eax, -0x65c(%rbp)
cmpl $0x3e80, -0x65c(%rbp)   # imm = 0x3E80
jl 0x58f3
movl $0x0, -0x65c(%rbp)
jmp 0x58f5
leaq 0xad24(%rip), %rax      # 0x10620
cmpl $0x0, (%rax)
je 0x5978
cmpl $0x0, -0x648(%rbp)
jne 0x5978
cmpl $0x1, -0x650(%rbp)
jne 0x5978
movsd 0x679d(%rip), %xmm0     # 0xc0b8
mulsd 0xa81d(%rip), %xmm0     # 0x10140
movslq -0x65c(%rbp), %rcx
leaq 0x17b6d1f(%rip), %rax   # 0x17bc650
movsd (%rax,%rcx,8), %xmm2
movsd -0x600(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x600(%rbp)
movl -0x660(%rbp), %eax
addl -0x65c(%rbp), %eax
movl %eax, -0x65c(%rbp)
cmpl $0x3e80, -0x65c(%rbp)   # imm = 0x3E80
jl 0x5976
movl $0x0, -0x65c(%rbp)
jmp 0x5978
leaq 0xaca1(%rip), %rax      # 0x10620
cmpl $0x0, (%rax)
je 0x5a54
cmpl $0x0, -0x648(%rbp)
je 0x5a54
cmpl $0x0, 0xac3c(%rip)      # 0x105d8
jne 0x5a54
cmpl $0x0, -0x650(%rbp)
jne 0x59e6
movsd 0x66fd(%rip), %xmm0     # 0xc0b0
mulsd 0xa78d(%rip), %xmm0     # 0x10148
movslq -0x65c(%rbp), %rcx
leaq 0x17b6c87(%rip), %rax   # 0x17bc650
movsd (%rax,%rcx,8), %xmm2
movsd -0x5f8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x5f8(%rbp)
cmpl $0x1, -0x654(%rbp)
jne 0x5a2a
movsd 0x66c1(%rip), %xmm0     # 0xc0b8
mulsd 0xa741(%rip), %xmm0     # 0x10140
movslq -0x65c(%rbp), %rcx
leaq 0x17b6c43(%rip), %rax   # 0x17bc650
movsd (%rax,%rcx,8), %xmm2
movsd -0x610(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x610(%rbp)
movl -0x660(%rbp), %eax
addl -0x65c(%rbp), %eax
movl %eax, -0x65c(%rbp)
cmpl $0x3e80, -0x65c(%rbp)   # imm = 0x3E80
jl 0x5a52
movl $0x0, -0x65c(%rbp)
jmp 0x5a54
cmpl $0x0, -0x648(%rbp)
je 0x5ca2
movsd 0x6657(%rip), %xmm0     # 0xc0c0
mulsd -0x5f8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movsd 0x65c8(%rip), %xmm0     # 0xc0c0
mulsd -0x600(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movsd 0x6539(%rip), %xmm0     # 0xc0c0
mulsd -0x608(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movsd 0x64aa(%rip), %xmm0     # 0xc0c0
mulsd -0x610(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
jmp 0x5dc0
movsd 0x6416(%rip), %xmm0     # 0xc0c0
mulsd -0x5f8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movsd 0x6387(%rip), %xmm0     # 0xc0c0
mulsd -0x600(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
movl -0x62c(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x638(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x638(%rbp)
movb %cl, (%rax)
jmp 0x5dc2
movl -0x5e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5e8(%rbp)
jmp 0x559a
movq -0x5f0(%rbp), %rax
addq -0x670(%rbp), %rax
movq %rax, -0x670(%rbp)
cmpq $0x3b9aca00, -0x670(%rbp) # imm = 0x3B9ACA00
jl 0x5e20
movq -0x670(%rbp), %rax
subq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
movq %rax, -0x670(%rbp)
movq -0x678(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x678(%rbp)
jmp 0x5deb
movl $0x1, %esi
leaq -0x678(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
movl %esi, %edi
callq 0x11e0
movl -0x14(%rbp), %edi
leaq -0x5e0(%rbp), %rsi
movl $0x5a4, %edx            # imm = 0x5A4
xorl %ecx, %ecx
leaq 0x18d1c49(%rip), %r8    # 0x18d7a98
movl $0x10, %r9d
callq 0x1100
cmpq $0x0, %rax
jge 0x5e75
movl $0x1, %edi
leaq 0x6dd6(%rip), %rsi      # 0xcc42
movb $0x0, %al
callq 0x1370
jmp 0x5e7a
jmp 0x51fb
movl -0x14(%rbp), %edi
callq 0x1110
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x680, %rsp            # imm = 0x680
popq %rbp
retq
nopw (%rax,%rax)