// File: /workspace/github_c_makefile_star2_O1/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 0x9eb7(%rip), %edx      # 0xc2f8
leaq 0x6430(%rip), %rsi      # 0x8878
movl $0x1, %edi
xorl %eax, %eax
callq 0x13aa
movl $0x10, 0x4(%rsp)
movl $0x1, (%rsp)
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1200
testl %eax, %eax
js 0x2cad
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
leaq 0x20(%rsp), %rcx
movq $0x0, (%rcx)
movq $0x2710, 0x8(%rcx)      # imm = 0x2710
movl %ebx, %edi
movl $0x1, %esi
movl $0x14, %edx
movl $0x10, %r8d
callq 0x1070
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movapd %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
movzwl 0x9df8(%rip), %eax      # 0xc2f8
rolw $0x8, %ax
movw %ax, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x1150
testl %eax, %eax
js 0x2ccb
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x4(%rsp), %r13
leaq 0x65b2(%rip), %rbp      # 0x8ae4
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 0x255f
callq 0x1030
cmpl $0xb, (%rax)
je 0x2535
jmp 0x2cc2
cmpl $0x5a4, %eax            # imm = 0x5A4
jne 0x2cf9
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 0x25b8
movl $0x1, %edi
leaq 0x6379(%rip), %rsi      # 0x8922
movq %r14, %rdx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x13aa
movzbl 0x34(%rsp), %edx
andl $0x1, %edx
cmpl %edx, 0x9d1a(%rip)      # 0xc2e0
je 0x27b6
movl %edx, 0x9d0e(%rip)      # 0xc2e0
movl $0x1, %edi
leaq 0x6364(%rip), %rsi      # 0x8942
xorl %eax, %eax
callq 0x13aa
cmpl $0x0, 0x9cf4(%rip)      # 0xc2e0
je 0x2d02
leaq 0x9f4f(%rip), %rdi      # 0xc548
xorl %esi, %esi
leaq 0x78a(%rip), %rdx       # 0x2d8c
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x2620
movl $0x1, %edi
leaq 0x6335(%rip), %rsi      # 0x894e
xorl %eax, %eax
callq 0x13aa
leaq 0x9f29(%rip), %rdi      # 0xc550
xorl %esi, %esi
leaq 0xbc4(%rip), %rdx       # 0x31f4
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x264e
movl $0x1, %edi
leaq 0x6330(%rip), %rsi      # 0x8977
xorl %eax, %eax
callq 0x13aa
leaq 0x9f0b(%rip), %r14      # 0xc560
leaq 0x9f24(%rip), %rbp      # 0xc580
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
leaq 0xfc0(%rip), %rdx       # 0x362b
movq %r15, %rcx
callq 0x1160
testl %eax, %eax
jns 0x268a
movl $0x1, %edi
leaq 0x631d(%rip), %rsi      # 0x89a0
xorl %eax, %eax
callq 0x13aa
movq %rbp, %rdi
xorl %esi, %esi
leaq 0x167b(%rip), %rdx      # 0x3d11
movq %r15, %rcx
callq 0x1160
testl %eax, %eax
jns 0x26b8
movl $0x1, %edi
leaq 0x6311(%rip), %rsi      # 0x89bf
movl %r15d, %edx
xorl %eax, %eax
callq 0x13aa
incq %r15
addq $0x8, %rbp
addq $0x8, %r14
cmpq $0x4, %r15
jne 0x265f
leaq 0x9ed0(%rip), %rdi      # 0xc5a0
xorl %esi, %esi
leaq 0x165b(%rip), %rdx      # 0x3d34
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x26f7
movl $0x1, %edi
leaq 0x62fa(%rip), %rsi      # 0x89ea
xorl %eax, %eax
callq 0x13aa
leaq 0x9eaa(%rip), %rdi      # 0xc5a8
xorl %esi, %esi
leaq 0x190c(%rip), %rdx      # 0x4013
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
leaq 0x63cd(%rip), %rbp      # 0x8ae4
jns 0x272c
movl $0x1, %edi
leaq 0x62e4(%rip), %rsi      # 0x8a09
xorl %eax, %eax
callq 0x13aa
leaq 0x9e7d(%rip), %rdi      # 0xc5b0
xorl %esi, %esi
leaq 0x18f7(%rip), %rdx      # 0x4033
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x275a
movl $0x1, %edi
leaq 0x62de(%rip), %rsi      # 0x8a31
xorl %eax, %eax
callq 0x13aa
leaq 0x9e57(%rip), %rdi      # 0xc5b8
xorl %esi, %esi
leaq 0x1ae2(%rip), %rdx      # 0x424c
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x2788
movl $0x1, %edi
leaq 0x62d9(%rip), %rsi      # 0x8a5a
xorl %eax, %eax
callq 0x13aa
leaq 0x9e31(%rip), %rdi      # 0xc5c0
xorl %esi, %esi
leaq 0x1cad(%rip), %rdx      # 0x4445
xorl %ecx, %ecx
callq 0x1160
testl %eax, %eax
jns 0x27b6
movl $0x1, %edi
leaq 0x62cb(%rip), %rsi      # 0x8a7a
xorl %eax, %eax
callq 0x13aa
movl 0x34(%rsp), %edx
shrl %edx
andl $0x1, %edx
cmpl %edx, 0x9e03(%rip)      # 0xc5c8
je 0x280f
movl %edx, 0x9dfb(%rip)      # 0xc5c8
movl $0x1, %edi
leaq 0x62da(%rip), %rsi      # 0x8ab3
xorl %eax, %eax
callq 0x13aa
cmpl $0x0, 0x9de1(%rip)      # 0xc5c8
jne 0x280f
movl $0x3ed00, %edx          # imm = 0x3ED00
leaq 0x17d523b(%rip), %rdi   # 0x17d7a30
xorl %esi, %esi
callq 0x10d0
movl $0x3ed00, %edx          # imm = 0x3ED00
leaq 0x1853228(%rip), %rdi   # 0x1855a30
xorl %esi, %esi
callq 0x10d0
movzbl 0x35(%rsp), %edx
andl $0x1, %edx
cmpl %edx, 0x9daf(%rip)      # 0xc5cc
je 0x2838
movl %edx, 0x9da7(%rip)      # 0xc5cc
movl $0x1, %edi
leaq 0x628e(%rip), %rsi      # 0x8abf
xorl %eax, %eax
callq 0x13aa
movzbl 0x35(%rsp), %edx
shrl %edx
andl $0x1, %edx
cmpl %edx, 0x9d88(%rip)      # 0xc5d0
je 0x2863
movl %edx, 0x9d80(%rip)      # 0xc5d0
movl $0x1, %edi
leaq 0x626f(%rip), %rsi      # 0x8acb
xorl %eax, %eax
callq 0x13aa
movzbl 0x35(%rsp), %edx
shrl $0x2, %edx
andl $0x1, %edx
cmpl %edx, 0x9d60(%rip)      # 0xc5d4
je 0x288f
movl %edx, 0x9d58(%rip)      # 0xc5d4
movl $0x1, %edi
leaq 0x624f(%rip), %rsi      # 0x8ad7
xorl %eax, %eax
callq 0x13aa
leaq 0x9b3a(%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, 0x9a6c(%rip)      # 0xc338
je 0x2923
movq %rcx, %xmm1
punpckldq 0x5755(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x575d(%rip), %xmm1     # 0x8040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x5759(%rip), %xmm0     # 0x8050
mulsd 0x5759(%rip), %xmm0     # 0x8058
callq 0x1040
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
subsd 0x5748(%rip), %xmm0     # 0x8060
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rax, %rcx
cmpq (%r15), %rcx
je 0x293d
movq %rcx, (%r15)
movl $0x1, %edi
movq %rbp, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x13aa
incq %r14
addq $0x8, %r15
cmpq $0x4, %r14
jne 0x2899
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, 0x99af(%rip)      # 0xc338
je 0x29e0
movq %rdx, %xmm1
punpckldq 0x5698(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x56a0(%rip), %xmm1     # 0x8040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x569c(%rip), %xmm0     # 0x8050
mulsd 0x569c(%rip), %xmm0     # 0x8058
callq 0x1040
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x568b(%rip), %xmm0     # 0x8060
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
cmpq 0x9bf1(%rip), %rdx      # 0xc5d8
je 0x2a03
movq %rdx, 0x9be8(%rip)      # 0xc5d8
movl $0x1, %edi
leaq 0x60fd(%rip), %rsi      # 0x8af9
xorl %eax, %eax
callq 0x13aa
movzbl 0x189(%rsp), %edx
cmpl %edx, 0x9bcf(%rip)      # 0xc5e0
je 0x2a43
movl %edx, 0x9bc7(%rip)      # 0xc5e0
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd 0x5640(%rip), %xmm0     # 0x8068
movsd %xmm0, 0x9bb8(%rip)     # 0xc5e8
movl $0x1, %edi
leaq 0x60d0(%rip), %rsi      # 0x8b0c
movb $0x1, %al
callq 0x13aa
movzbl 0x5a8(%rsp), %edx
cmpl %edx, 0x9b9f(%rip)      # 0xc5f0
je 0x2a6c
movl %edx, 0x9b97(%rip)      # 0xc5f0
movl $0x1, %edi
leaq 0x60be(%rip), %rsi      # 0x8b23
xorl %eax, %eax
callq 0x13aa
movzbl 0x5a9(%rsp), %edx
cmpl %edx, 0x9b7a(%rip)      # 0xc5f4
je 0x2a95
movl %edx, 0x9b72(%rip)      # 0xc5f4
movl $0x1, %edi
leaq 0x60af(%rip), %rsi      # 0x8b3d
xorl %eax, %eax
callq 0x13aa
movzbl 0x5aa(%rsp), %edx
cmpl %edx, 0x9b55(%rip)      # 0xc5f8
je 0x2abe
movl %edx, 0x9b4d(%rip)      # 0xc5f8
movl $0x1, %edi
leaq 0x6099(%rip), %rsi      # 0x8b50
xorl %eax, %eax
callq 0x13aa
movzbl 0x5ab(%rsp), %edx
cmpl %edx, 0x9b30(%rip)      # 0xc5fc
je 0x2ae7
movl %edx, 0x9b28(%rip)      # 0xc5fc
movl $0x1, %edi
leaq 0x6084(%rip), %rsi      # 0x8b64
xorl %eax, %eax
callq 0x13aa
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 0x994e(%rip), %rbp      # 0xc470
xorl %r14d, %r14d
xorl %ecx, %ecx
btq %r14, %r15
setb %cl
cmpl (%rbp), %ecx
je 0x2b4c
movl %ecx, (%rbp)
movl $0x1, %edi
leaq 0x6036(%rip), %rsi      # 0x8b78
movl %r14d, %edx
xorl %eax, %eax
callq 0x13aa
incq %r14
addq $0x4, %rbp
cmpq $0x20, %r14
jne 0x2b25
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 0x985c(%rip), %rbp      # 0xc3f0
xorl %r14d, %r14d
xorl %ecx, %ecx
btq %r14, %r15
setb %cl
cmpl (%rbp), %ecx
je 0x2bbe
movl %ecx, (%rbp)
movl $0x1, %edi
leaq 0x5fdf(%rip), %rsi      # 0x8b93
movl %r14d, %edx
xorl %eax, %eax
callq 0x13aa
incq %r14
addq $0x4, %rbp
cmpq $0x20, %r14
jne 0x2b97
movzbl 0x5d2(%rsp), %ebp
cmpl %ebp, 0x9a27(%rip)      # 0xc600
je 0x2c17
movl %ebp, 0x9a1f(%rip)      # 0xc600
cvtsi2sd %ebp, %xmm1
mulsd 0x5483(%rip), %xmm1     # 0x8070
movsd 0x5483(%rip), %xmm0     # 0x8078
callq 0x10a0
movsd %xmm0, 0x952e(%rip)     # 0xc130
movl $0x1, %edi
leaq 0x5fa0(%rip), %rsi      # 0x8bae
movl %ebp, %edx
xorl %eax, %eax
callq 0x13aa
movzbl 0x5d3(%rsp), %edx
cmpl %edx, 0x99df(%rip)      # 0xc604
leaq 0x30(%rsp), %r15
je 0x2c45
movl %edx, 0x99d2(%rip)      # 0xc604
movl $0x1, %edi
leaq 0x5f83(%rip), %rsi      # 0x8bc1
xorl %eax, %eax
callq 0x13aa
leaq 0x99cc(%rip), %rax      # 0xc618
cmpl $0x5, (%rax)
movl 0x99af(%rip), %eax      # 0xc604
leaq 0x5e88(%rip), %rbp      # 0x8ae4
jne 0x2c67
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
jmp 0x2c86
movl 0x97bb(%rip), %ecx      # 0xc428
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %eax
movl 0x97ab(%rip), %ecx      # 0xc424
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,4), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x53e2(%rip), %xmm1     # 0x8070
movsd 0x53e2(%rip), %xmm0     # 0x8078
callq 0x10a0
movsd %xmm0, 0x9495(%rip)     # 0xc138
movq 0x8(%rsp), %r14
jmp 0x2535
leaq 0x5be7(%rip), %rsi      # 0x889b
movl $0x1, %edi
xorl %eax, %eax
callq 0x13aa
jmp 0x2ce5
leaq 0x5c02(%rip), %rsi      # 0x88cb
jmp 0x2cd2
leaq 0x5be2(%rip), %rsi      # 0x88b4
movl $0x1, %edi
xorl %eax, %eax
callq 0x13aa
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 0x5bf2(%rip), %rsi      # 0x88f2
jmp 0x2cd2
movq 0x983f(%rip), %rdi      # 0xc548
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x11d0
movq 0x9836(%rip), %rdi      # 0xc550
xorl %esi, %esi
callq 0x11d0
leaq 0x9838(%rip), %r15      # 0xc560
movq (%r14,%r15), %rdi
xorl %esi, %esi
callq 0x11d0
addq $0x8, %r14
cmpq $0x20, %r14
jne 0x2d28
movq 0x986c(%rip), %rdi      # 0xc5b0
xorl %esi, %esi
callq 0x11d0
movq 0x984e(%rip), %rdi      # 0xc5a0
xorl %esi, %esi
callq 0x11d0
movq 0x9858(%rip), %rdi      # 0xc5b8
xorl %esi, %esi
callq 0x11d0
movq 0x9852(%rip), %rdi      # 0xc5c0
xorl %esi, %esi
callq 0x11d0
movq $0x0, 0x95d0(%rip) # 0xc350
leaq 0x5d15(%rip), %rsi      # 0x8a9c
jmp 0x2cd2