// File: /workspace/github_c_makefile_star2_O3/hiperiondev[P]hpsdrsim/src/hpsdr_newprotocol.c
// Function: highprio_thread
void* highprio_thread(void *data) {
    dbg_printf(1, "-- Start highprio_thread port: %d\n", hp_port);
    int sock;
    struct sockaddr_in addr;
    socklen_t lenaddr = sizeof(addr);
    unsigned long seqnum, seqold;
    unsigned char buffer[2000];
    struct timeval tv;
    int yes = 1;
    int rc;
    unsigned long freq;
    int i;

    seqnum = 0;

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

    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &yes, sizeof(yes));
    setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (void*) &yes, sizeof(yes));
    tv.tv_sec = 0;
    tv.tv_usec = 10000;
    setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void*) &tv, sizeof(tv));

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

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

    while (1) {
        rc = recvfrom(sock, buffer, 1444, 0, (struct sockaddr*) &addr, &lenaddr);
        if (rc < 0 && errno != EAGAIN) {
            dbg_printf(1, "***** ERROR: HighPrio thread: recvmsg\n");
            break;
        }
        if (rc < 0)
            continue;
        if (rc != 1444) {
            dbg_printf(1, "Received HighPrio packet with incorrect length\n");
            break;
        }
        seqold = seqnum;
        seqnum = (buffer[0] >> 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3];
        if (seqnum != 0 && seqnum != seqold + 1) {
            dbg_printf(1, "HP: SEQ ERROR, old=%lu new=%lu\n", seqold, seqnum);
        }
        rc = (buffer[4] >> 0) & 0x01;
        if (rc != run) {
            run = rc;
            dbg_printf(1, "HP: Run=%d\n", rc);
            // if run=0, wait for threads to complete, otherwise spawn them off
            if (run) {
                if (pthread_create(&ddc_specific_thread_id, NULL, ddc_specific_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create DDC specific thread\n");
                }
                if (pthread_create(&duc_specific_thread_id, NULL, duc_specific_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create DUC specific thread\n");
                }
                for (i = 0; i < NUMRECEIVERS; i++) {
                    if (pthread_create(&rx_thread_id[i], NULL, rx_thread, (void*) (uintptr_t) i) < 0) {
                        dbg_printf(1, "***** ERROR: Create RX thread\n");
                    }
                    if (pthread_create(&rx_hardware_thread_id[i], NULL, rx_hardware_thread, (void*) (uintptr_t) i) < 0) {
                        dbg_printf(1, "***** ERROR: Create RX Hardware thread %d\n", i);
                    }
                }
                if (pthread_create(&tx_thread_id, NULL, tx_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create TX thread\n");
                }
                if (pthread_create(&tx_hardware_thread_id, NULL, tx_hardware_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create TX Hardware thread\n");
                }
                if (pthread_create(&send_highprio_thread_id, NULL, send_highprio_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create SendHighPrio thread\n");
                }
                if (pthread_create(&mic_thread_id, NULL, mic_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create Mic thread\n");
                }
                if (pthread_create(&audio_thread_id, NULL, audio_thread, NULL) < 0) {
                    dbg_printf(1, "***** ERROR: Create Audio thread\n");
                }
            } else {
                pthread_join(ddc_specific_thread_id, NULL);
                pthread_join(duc_specific_thread_id, NULL);
                for (i = 0; i < NUMRECEIVERS; i++) {
                    pthread_join(rx_thread_id[i], NULL);
                }
                pthread_join(send_highprio_thread_id, NULL);
                pthread_join(tx_thread_id, NULL);
                pthread_join(mic_thread_id, NULL);
                pthread_join(audio_thread_id, NULL);
                highprio_thread_id = 0;
                dbg_printf(1, "HP thread terminated.\n");
                close(sock);
                return NULL;
            }
        }
        rc = (buffer[4] >> 1) & 0x01;
        if (rc != ptt) {
            ptt = rc;
            dbg_printf(1, "HP: PTT=%d\n", rc);
            if (ptt == 0) {
                memset(isample, 0, sizeof(float) * NEWRTXLEN);
                memset(qsample, 0, sizeof(float) * NEWRTXLEN);
            }
        }
        rc = (buffer[5] >> 0) & 0x01;
        if (rc != cwx) {
            cwx = rc;
            dbg_printf(1, "HP: CWX=%d\n", rc);
        }
        rc = (buffer[5] >> 1) & 0x01;
        if (rc != dot) {
            dot = rc;
            dbg_printf(1, "HP: DOT=%d\n", rc);
        }
        rc = (buffer[5] >> 2) & 0x01;
        if (rc != dash) {
            dash = rc;
            dbg_printf(1, "HP: DASH=%d\n", rc);
        }
        for (i = 0; i < NUMRECEIVERS; i++) {
            freq = (buffer[9 + 4 * i] << 24) + (buffer[10 + 4 * i] << 16) + (buffer[11 + 4 * i] << 8) + buffer[12 + 4 * i];
            if (bits & 0x08) {
                freq = round(122880000.0 * (double) freq / 4294967296.0);
            }
            if (freq != rxfreq[i]) {
                rxfreq[i] = freq;
                dbg_printf(1, "HP: DDC%d freq: %lu\n", i, freq);
            }
        }
        freq = (buffer[329] << 24) + (buffer[330] << 16) + (buffer[331] << 8) + buffer[332];
        if (bits & 0x08) {
            freq = round(122880000.0 * (double) freq / 4294967296.0);
        }
        if (freq != txfreq) {
            txfreq = freq;
            dbg_printf(1, "HP: DUC freq: %lu\n", freq);
        }
        rc = buffer[345];
        if (rc != txdrive) {
            txdrive = rc;
            txdrv_dbl = (double) txdrive * 0.003921568627;
            dbg_printf(1, "HP: TX drive= %d (%f)\n", txdrive, txdrv_dbl);
        }
        rc = buffer[1400];
        if (rc != w1400) {
            w1400 = rc;
            dbg_printf(1, "HP: Xvtr/Audio enable=%x\n", rc);
        }
        rc = buffer[1401];
        if (rc != ocout) {
            ocout = rc;
            dbg_printf(1, "HP: OC outputs=%x\n", rc);
        }
        rc = buffer[1402];
        if (rc != db9) {
            db9 = rc;
            dbg_printf(1, "HP: Outputs DB9=%x\n", rc);
        }
        rc = buffer[1403];
        if (rc != mercury_atts) {
            mercury_atts = rc;
            dbg_printf(1, "HP: MercuryAtts=%x\n", rc);
        }
        // Store Alex0 and Alex1 bits in separate ints
        freq = (buffer[1428] << 24) + (buffer[1429] << 16) + (buffer[1430] << 8) + buffer[1431];
        for (i = 0; i < 32; i++) {
            rc = (freq >> i) & 0x01;
            if (rc != alex1[i]) {
                alex1[i] = rc;
                dbg_printf(1, "HP: ALEX1 bit%d set to %d\n", i, rc);
            }
        }
        freq = (buffer[1432] << 24) + (buffer[1433] << 16) + (buffer[1434] << 8) + buffer[1435];
        for (i = 0; i < 32; i++) {
            rc = (freq >> i) & 0x01;
            if (rc != alex0[i]) {
                alex0[i] = rc;
                dbg_printf(1, "HP: ALEX0 bit%d set to %d\n", i, rc);
            }
        }
        rc = buffer[1442];
        if (rc != stepatt1) {
            stepatt1 = rc;
            rxatt1_dbl = pow(10.0, -0.05 * stepatt1);
            dbg_printf(1, "HP: StepAtt1 = %d\n", rc);
        }
        rc = buffer[1443];
        if (rc != stepatt0) {
            stepatt0 = rc;
            dbg_printf(1, "HP: StepAtt0 = %d\n", stepatt0);
        }
        // rxatt0 depends both on ALEX att and Step Att, so re-calc. it each time
        if (NEWDEVICE == NEW_DEVICE_ORION2) {
            // There is no step attenuator on ANAN7000
            rxatt0_dbl = pow(10.0, -0.05 * stepatt0);
        } else {
            rxatt0_dbl = pow(10.0, -0.05 * (stepatt0 + 10 * alex0[14] + 20 * alex0[13]));
        }
    }
    close(sock);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl 0x9e0c(%rip), %edx      # 0xc2f8
leaq 0x6385(%rip), %rsi      # 0x8878
movl $0x1, %edi
xorl %eax, %eax
callq 0x13ba
movl $0x10, 0x4(%rsp)
movl $0x1, (%rsp)
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1200
testl %eax, %eax
js 0x2d4f
movl %eax, %ebx
movq %rsp, %r14
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x1070
movl %ebx, %edi
movl $0x1, %esi
movl $0xf, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x1070
xorl %r14d, %r14d
leaq 0x20(%rsp), %rcx
movq %r14, (%rcx)
movq $0x2710, 0x8(%rcx)      # imm = 0x2710
movl %ebx, %edi
movl $0x1, %esi
movl $0x14, %edx
movl $0x10, %r8d
callq 0x1070
leaq 0x10(%rsp), %rsi
movq %r14, 0x8(%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
movzwl 0x9d52(%rip), %eax      # 0xc2f8
rolw $0x8, %ax
movw %ax, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x1150
testl %eax, %eax
js 0x2d6d
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x4(%rsp), %r13
xorl %r14d, %r14d
movl $0x5a4, %edx            # imm = 0x5A4
movl %ebx, %edi
movq %r15, %rsi
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
callq 0x1140
testl %eax, %eax
jns 0x25fe
callq 0x1030
cmpl $0xb, (%rax)
je 0x25d4
jmp 0x2d64
cmpl $0x5a4, %eax            # imm = 0x5A4
jne 0x2d9b
movzbl 0x31(%rsp), %eax
shll $0x10, %eax
movzbl 0x32(%rsp), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0x33(%rsp), %edx
orq %rcx, %rdx
testq %rdx, %rdx
sete %al
leaq 0x1(%r14), %rcx
movq %rdx, 0x8(%rsp)
cmpq %rcx, %rdx
sete %cl
orb %al, %cl
jne 0x2657
movl $0x1, %edi
leaq 0x62da(%rip), %rsi      # 0x8922
movq %r14, %rdx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x13ba
movzbl 0x34(%rsp), %edx
andl $0x1, %edx
cmpl %edx, 0x9c7b(%rip)      # 0xc2e0
je 0x284e
movl %edx, 0x9c6f(%rip)      # 0xc2e0
movl $0x1, %edi
leaq 0x62c5(%rip), %rsi      # 0x8942
xorl %eax, %eax
callq 0x13ba
cmpl $0x0, 0x9c55(%rip)      # 0xc2e0
je 0x2da4
leaq 0x9eb0(%rip), %rdi      # 0xc548
xorl %esi, %esi
leaq 0x78d(%rip), %rdx       # 0x2e2e
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x26bf
movl $0x1, %edi
leaq 0x6296(%rip), %rsi      # 0x894e
xorl %eax, %eax
callq 0x13ba
leaq 0x9e8a(%rip), %rdi      # 0xc550
xorl %esi, %esi
leaq 0xbaa(%rip), %rdx       # 0x3279
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x26ed
movl $0x1, %edi
leaq 0x6291(%rip), %rsi      # 0x8977
xorl %eax, %eax
callq 0x13ba
leaq 0x9e6c(%rip), %r14      # 0xc560
leaq 0x9e85(%rip), %rbp      # 0xc580
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
leaq 0xf9b(%rip), %rdx       # 0x36a5
movq %r15, %rcx
callq 0x1160
testl %eax, %eax
jns 0x2729
movl $0x1, %edi
leaq 0x627e(%rip), %rsi      # 0x89a0
xorl %eax, %eax
callq 0x13ba
movq %rbp, %rdi
xorl %esi, %esi
leaq 0x175f(%rip), %rdx      # 0x3e94
movq %r15, %rcx
callq 0x1160
testl %eax, %eax
jns 0x2757
movl $0x1, %edi
leaq 0x6272(%rip), %rsi      # 0x89bf
movl %r15d, %edx
xorl %eax, %eax
callq 0x13ba
incq %r15
addq $0x8, %rbp
addq $0x8, %r14
cmpq $0x4, %r15
jne 0x26fe
leaq 0x9e31(%rip), %rdi      # 0xc5a0
xorl %esi, %esi
leaq 0x173f(%rip), %rdx      # 0x3eb7
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x2796
movl $0x1, %edi
leaq 0x625b(%rip), %rsi      # 0x89ea
xorl %eax, %eax
callq 0x13ba
leaq 0x9e0b(%rip), %rdi      # 0xc5a8
xorl %esi, %esi
leaq 0x19e5(%rip), %rdx      # 0x418b
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x27c4
movl $0x1, %edi
leaq 0x624c(%rip), %rsi      # 0x8a09
xorl %eax, %eax
callq 0x13ba
leaq 0x9de5(%rip), %rdi      # 0xc5b0
xorl %esi, %esi
leaq 0x19d7(%rip), %rdx      # 0x41ab
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x27f2
movl $0x1, %edi
leaq 0x6246(%rip), %rsi      # 0x8a31
xorl %eax, %eax
callq 0x13ba
leaq 0x9dbf(%rip), %rdi      # 0xc5b8
xorl %esi, %esi
leaq 0x1bb6(%rip), %rdx      # 0x43b8
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x2820
movl $0x1, %edi
leaq 0x6241(%rip), %rsi      # 0x8a5a
xorl %eax, %eax
callq 0x13ba
leaq 0x9d99(%rip), %rdi      # 0xc5c0
xorl %esi, %esi
leaq 0x1d83(%rip), %rdx      # 0x45b3
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x284e
movl $0x1, %edi
leaq 0x6233(%rip), %rsi      # 0x8a7a
xorl %eax, %eax
callq 0x13ba
movl 0x34(%rsp), %edx
shrl %edx
andl $0x1, %edx
cmpl %edx, 0x9d6b(%rip)      # 0xc5c8
je 0x28a7
movl %edx, 0x9d63(%rip)      # 0xc5c8
movl $0x1, %edi
leaq 0x6242(%rip), %rsi      # 0x8ab3
xorl %eax, %eax
callq 0x13ba
cmpl $0x0, 0x9d49(%rip)      # 0xc5c8
jne 0x28a7
movl $0x3ed00, %edx          # imm = 0x3ED00
leaq 0x17d51a3(%rip), %rdi   # 0x17d7a30
xorl %esi, %esi
callq 0x10d0
movl $0x3ed00, %edx          # imm = 0x3ED00
leaq 0x1853190(%rip), %rdi   # 0x1855a30
xorl %esi, %esi
callq 0x10d0
movzbl 0x35(%rsp), %eax
movl %eax, %edx
andl $0x1, %edx
cmpl %edx, 0x9d15(%rip)      # 0xc5cc
je 0x28d6
movl %edx, 0x9d0d(%rip)      # 0xc5cc
movl $0x1, %edi
leaq 0x61f4(%rip), %rsi      # 0x8abf
xorl %eax, %eax
callq 0x13ba
movb 0x35(%rsp), %al
movl %eax, %ecx
shrb %cl
andb $0x1, %cl
movzbl %cl, %edx
cmpl %edx, 0x9cea(%rip)      # 0xc5d0
je 0x2905
movl %edx, 0x9ce2(%rip)      # 0xc5d0
movl $0x1, %edi
leaq 0x61d1(%rip), %rsi      # 0x8acb
xorl %eax, %eax
callq 0x13ba
movb 0x35(%rsp), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %edx
cmpl %edx, 0x9cc1(%rip)      # 0xc5d4
je 0x292e
movl %edx, 0x9cb9(%rip)      # 0xc5d4
movl $0x1, %edi
leaq 0x61b0(%rip), %rsi      # 0x8ad7
xorl %eax, %eax
callq 0x13ba
movl 0x9a04(%rip), %ebp      # 0xc338
leaq 0x9a95(%rip), %r15      # 0xc3d0
xorl %r14d, %r14d
movzbl 0x39(%rsp,%r14,4), %eax
shll $0x18, %eax
movzbl 0x3a(%rsp,%r14,4), %ecx
shll $0x10, %ecx
cltq
orq %rcx, %rax
movzbl 0x3b(%rsp,%r14,4), %edx
shll $0x8, %edx
orq %rax, %rdx
movzbl 0x3c(%rsp,%r14,4), %ecx
orq %rdx, %rcx
testb $0x8, %bpl
je 0x29c5
movq %rcx, %xmm1
punpckldq 0x56b3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x56bb(%rip), %xmm1     # 0x8040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x56b7(%rip), %xmm0     # 0x8050
mulsd 0x56b7(%rip), %xmm0     # 0x8058
callq 0x1040
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
subsd 0x56a6(%rip), %xmm0     # 0x8060
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rax, %rcx
cmpq (%r15), %rcx
je 0x29e9
movq %rcx, (%r15)
movl $0x1, %edi
leaq 0x610b(%rip), %rsi      # 0x8ae4
movl %r14d, %edx
xorl %eax, %eax
callq 0x13ba
movl 0x994f(%rip), %ebp      # 0xc338
incq %r14
addq $0x8, %r15
cmpq $0x4, %r14
jne 0x293e
movzbl 0x179(%rsp), %eax
shll $0x18, %eax
movzbl 0x17a(%rsp), %ecx
shll $0x10, %ecx
cltq
orq %rcx, %rax
movzbl 0x17b(%rsp), %ecx
shll $0x8, %ecx
orq %rax, %rcx
movzbl 0x17c(%rsp), %edx
orq %rcx, %rdx
testb $0x8, %bpl
je 0x2a89
movq %rdx, %xmm1
punpckldq 0x55ef(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x55f7(%rip), %xmm1     # 0x8040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x55f3(%rip), %xmm0     # 0x8050
mulsd 0x55f3(%rip), %xmm0     # 0x8058
callq 0x1040
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x55e2(%rip), %xmm0     # 0x8060
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
cmpq 0x9b48(%rip), %rdx      # 0xc5d8
je 0x2aac
movq %rdx, 0x9b3f(%rip)      # 0xc5d8
movl $0x1, %edi
leaq 0x6054(%rip), %rsi      # 0x8af9
xorl %eax, %eax
callq 0x13ba
movzbl 0x189(%rsp), %edx
cmpl %edx, 0x9b26(%rip)      # 0xc5e0
je 0x2aec
movl %edx, 0x9b1e(%rip)      # 0xc5e0
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd 0x5597(%rip), %xmm0     # 0x8068
movsd %xmm0, 0x9b0f(%rip)     # 0xc5e8
movl $0x1, %edi
leaq 0x6027(%rip), %rsi      # 0x8b0c
movb $0x1, %al
callq 0x13ba
movzbl 0x5a8(%rsp), %edx
cmpl %edx, 0x9af6(%rip)      # 0xc5f0
je 0x2b15
movl %edx, 0x9aee(%rip)      # 0xc5f0
movl $0x1, %edi
leaq 0x6015(%rip), %rsi      # 0x8b23
xorl %eax, %eax
callq 0x13ba
movzbl 0x5a9(%rsp), %edx
cmpl %edx, 0x9ad1(%rip)      # 0xc5f4
je 0x2b3e
movl %edx, 0x9ac9(%rip)      # 0xc5f4
movl $0x1, %edi
leaq 0x6006(%rip), %rsi      # 0x8b3d
xorl %eax, %eax
callq 0x13ba
movzbl 0x5aa(%rsp), %edx
cmpl %edx, 0x9aac(%rip)      # 0xc5f8
je 0x2b67
movl %edx, 0x9aa4(%rip)      # 0xc5f8
movl $0x1, %edi
leaq 0x5ff0(%rip), %rsi      # 0x8b50
xorl %eax, %eax
callq 0x13ba
movzbl 0x5ab(%rsp), %edx
cmpl %edx, 0x9a87(%rip)      # 0xc5fc
je 0x2b90
movl %edx, 0x9a7f(%rip)      # 0xc5fc
movl $0x1, %edi
leaq 0x5fdb(%rip), %rsi      # 0x8b64
xorl %eax, %eax
callq 0x13ba
movl 0x5c4(%rsp), %eax
shll $0x18, %eax
movzbl 0x5c5(%rsp), %ecx
shll $0x10, %ecx
cltq
orq %rcx, %rax
movzbl 0x5c6(%rsp), %ecx
shll $0x8, %ecx
orq %rax, %rcx
movzbl 0x5c7(%rsp), %r15d
orq %rcx, %r15
leaq 0x98a5(%rip), %rbp      # 0xc470
xorl %r14d, %r14d
xorl %ecx, %ecx
btq %r14, %r15
setb %cl
cmpl (%rbp), %ecx
je 0x2bf5
movl %ecx, (%rbp)
movl $0x1, %edi
leaq 0x5f8d(%rip), %rsi      # 0x8b78
movl %r14d, %edx
xorl %eax, %eax
callq 0x13ba
incq %r14
addq $0x4, %rbp
cmpq $0x20, %r14
jne 0x2bce
movl 0x5c8(%rsp), %eax
shll $0x18, %eax
movzbl 0x5c9(%rsp), %ecx
shll $0x10, %ecx
cltq
orq %rcx, %rax
movzbl 0x5ca(%rsp), %ecx
shll $0x8, %ecx
orq %rax, %rcx
movzbl 0x5cb(%rsp), %r15d
orq %rcx, %r15
leaq 0x97b3(%rip), %rbp      # 0xc3f0
xorl %r14d, %r14d
xorl %ecx, %ecx
btq %r14, %r15
setb %cl
cmpl (%rbp), %ecx
je 0x2c67
movl %ecx, (%rbp)
movl $0x1, %edi
leaq 0x5f36(%rip), %rsi      # 0x8b93
movl %r14d, %edx
xorl %eax, %eax
callq 0x13ba
incq %r14
addq $0x4, %rbp
cmpq $0x20, %r14
jne 0x2c40
movzbl 0x5d2(%rsp), %ebp
cmpl %ebp, 0x997e(%rip)      # 0xc600
je 0x2cc0
movl %ebp, 0x9976(%rip)      # 0xc600
cvtsi2sd %ebp, %xmm1
mulsd 0x53da(%rip), %xmm1     # 0x8070
movsd 0x53da(%rip), %xmm0     # 0x8078
callq 0x10a0
movsd %xmm0, 0x9485(%rip)     # 0xc130
movl $0x1, %edi
leaq 0x5ef7(%rip), %rsi      # 0x8bae
movl %ebp, %edx
xorl %eax, %eax
callq 0x13ba
movzbl 0x5d3(%rsp), %edx
cmpl %edx, 0x9936(%rip)      # 0xc604
leaq 0x30(%rsp), %r15
je 0x2cee
movl %edx, 0x9929(%rip)      # 0xc604
movl $0x1, %edi
leaq 0x5eda(%rip), %rsi      # 0x8bc1
xorl %eax, %eax
callq 0x13ba
leaq 0x9923(%rip), %rax      # 0xc618
cmpl $0x5, (%rax)
movl 0x9906(%rip), %eax      # 0xc604
jne 0x2d09
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
jmp 0x2d28
movl 0x9719(%rip), %ecx      # 0xc428
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %eax
movl 0x9709(%rip), %ecx      # 0xc424
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,4), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x5340(%rip), %xmm1     # 0x8070
movsd 0x5340(%rip), %xmm0     # 0x8078
callq 0x10a0
movsd %xmm0, 0x93f3(%rip)     # 0xc138
movq 0x8(%rsp), %r14
jmp 0x25d4
leaq 0x5b45(%rip), %rsi      # 0x889b
movl $0x1, %edi
xorl %eax, %eax
callq 0x13ba
jmp 0x2d87
leaq 0x5b60(%rip), %rsi      # 0x88cb
jmp 0x2d74
leaq 0x5b40(%rip), %rsi      # 0x88b4
movl $0x1, %edi
xorl %eax, %eax
callq 0x13ba
movl %ebx, %edi
callq 0x10f0
xorl %eax, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5b50(%rip), %rsi      # 0x88f2
jmp 0x2d74
movq 0x979d(%rip), %rdi      # 0xc548
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x11d0
movq 0x9794(%rip), %rdi      # 0xc550
xorl %esi, %esi
callq 0x11d0
leaq 0x9796(%rip), %r15      # 0xc560
movq (%r14,%r15), %rdi
xorl %esi, %esi
callq 0x11d0
addq $0x8, %r14
cmpq $0x20, %r14
jne 0x2dca
movq 0x97ca(%rip), %rdi      # 0xc5b0
xorl %esi, %esi
callq 0x11d0
movq 0x97ac(%rip), %rdi      # 0xc5a0
xorl %esi, %esi
callq 0x11d0
movq 0x97b6(%rip), %rdi      # 0xc5b8
xorl %esi, %esi
callq 0x11d0
movq 0x97b0(%rip), %rdi      # 0xc5c0
xorl %esi, %esi
callq 0x11d0
movq $0x0, 0x952e(%rip) # 0xc350
leaq 0x5c73(%rip), %rsi      # 0x8a9c
jmp 0x2d74