// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x840, %rsp            # imm = 0x840
movq %rdi, -0x10(%rbp)
movl 0xcd43(%rip), %edx      # 0x10308
movl $0x1, %edi
leaq 0x929f(%rip), %rsi      # 0xc870
movb $0x0, %al
callq 0x1370
movl $0x10, -0x28(%rbp)
movl $0x1, -0x824(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x1230
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x3628
movl $0x1, %edi
leaq 0x927f(%rip), %rsi      # 0xc893
movb $0x0, %al
callq 0x1370
movq $0x0, -0x8(%rbp)
jmp 0x430d
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x824(%rbp), %rcx
movl $0x4, %r8d
callq 0x1060
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0xf, %edx
leaq -0x824(%rbp), %rcx
movl $0x4, %r8d
callq 0x1060
movq $0x0, -0x820(%rbp)
movq $0x2710, -0x818(%rbp) # imm = 0x2710
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0x14, %edx
leaq -0x820(%rbp), %rcx
movl $0x10, %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 0xcc47(%rip), %eax      # 0x10308
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 0x370b
movl $0x1, %edi
leaq 0x91bd(%rip), %rsi      # 0xc8ac
movb $0x0, %al
callq 0x1370
movl -0x14(%rbp), %edi
callq 0x1110
movq $0x0, -0x8(%rbp)
jmp 0x430d
jmp 0x370d
movl -0x14(%rbp), %edi
leaq -0x810(%rbp), %rsi
movl $0x5a4, %edx            # imm = 0x5A4
xorl %ecx, %ecx
leaq -0x24(%rbp), %r8
leaq -0x28(%rbp), %r9
callq 0x1170
movl %eax, -0x828(%rbp)
cmpl $0x0, -0x828(%rbp)
jge 0x375c
callq 0x1030
cmpl $0xb, (%rax)
je 0x375c
movl $0x1, %edi
leaq 0x9173(%rip), %rsi      # 0xc8c3
movb $0x0, %al
callq 0x1370
jmp 0x42fd
cmpl $0x0, -0x828(%rbp)
jge 0x3767
jmp 0x370d
cmpl $0x5a4, -0x828(%rbp)    # imm = 0x5A4
je 0x378b
movl $0x1, %edi
leaq 0x916b(%rip), %rsi      # 0xc8ea
movb $0x0, %al
callq 0x1370
jmp 0x42fd
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movzbl -0x810(%rbp), %eax
sarl $0x18, %eax
movzbl -0x80f(%rbp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl -0x80e(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl -0x80d(%rbp), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x37f7
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x37f7
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x1, %edi
leaq 0x912a(%rip), %rsi      # 0xc91a
movb $0x0, %al
callq 0x1370
movzbl -0x80c(%rbp), %eax
sarl $0x0, %eax
andl $0x1, %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xcada(%rip), %eax      # 0x102f0
je 0x3b40
movl -0x828(%rbp), %eax
movl %eax, 0xcac8(%rip)      # 0x102f0
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x9100(%rip), %rsi      # 0xc93a
movb $0x0, %al
callq 0x1370
cmpl $0x0, 0xcaa8(%rip)      # 0x102f0
je 0x3a6c
leaq 0xcd03(%rip), %rdi      # 0x10558
xorl %eax, %eax
movl %eax, %ecx
leaq 0xac0(%rip), %rdx       # 0x4320
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x3880
movl $0x1, %edi
leaq 0x90cd(%rip), %rsi      # 0xc946
movb $0x0, %al
callq 0x1370
leaq 0xccd9(%rip), %rdi      # 0x10560
xorl %eax, %eax
movl %eax, %ecx
leaq 0x11be(%rip), %rdx      # 0x4a50
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x38b2
movl $0x1, %edi
leaq 0x90c4(%rip), %rsi      # 0xc96f
movb $0x0, %al
callq 0x1370
movl $0x0, -0x834(%rbp)
cmpl $0x4, -0x834(%rbp)
jge 0x396d
movslq -0x834(%rbp), %rax
leaq 0xcc99(%rip), %rdi      # 0x10570
shlq $0x3, %rax
addq %rax, %rdi
movslq -0x834(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x1710(%rip), %rdx      # 0x5000
callq 0x1190
cmpl $0x0, %eax
jge 0x390d
movl $0x1, %edi
leaq 0x9092(%rip), %rsi      # 0xc998
movb $0x0, %al
callq 0x1370
movslq -0x834(%rbp), %rax
leaq 0xcc75(%rip), %rdi      # 0x10590
shlq $0x3, %rax
addq %rax, %rdi
movslq -0x834(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x256c(%rip), %rdx      # 0x5ea0
callq 0x1190
cmpl $0x0, %eax
jge 0x3957
movl -0x834(%rbp), %edx
movl $0x1, %edi
leaq 0x9067(%rip), %rsi      # 0xc9b7
movb $0x0, %al
callq 0x1370
jmp 0x3959
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x38bc
leaq 0xcc3c(%rip), %rdi      # 0x105b0
xorl %eax, %eax
movl %eax, %ecx
leaq 0x2561(%rip), %rdx      # 0x5ee0
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x399f
movl $0x1, %edi
leaq 0x904a(%rip), %rsi      # 0xc9e2
movb $0x0, %al
callq 0x1370
leaq 0xcc12(%rip), %rdi      # 0x105b8
xorl %eax, %eax
movl %eax, %ecx
leaq 0x29ff(%rip), %rdx      # 0x63b0
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x39d1
movl $0x1, %edi
leaq 0x9037(%rip), %rsi      # 0xca01
movb $0x0, %al
callq 0x1370
leaq 0xcbe8(%rip), %rdi      # 0x105c0
xorl %eax, %eax
movl %eax, %ecx
leaq 0x29fd(%rip), %rdx      # 0x63e0
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x3a03
movl $0x1, %edi
leaq 0x902d(%rip), %rsi      # 0xca29
movb $0x0, %al
callq 0x1370
leaq 0xcbbe(%rip), %rdi      # 0x105c8
xorl %eax, %eax
movl %eax, %ecx
leaq 0x2cfb(%rip), %rdx      # 0x6710
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x3a35
movl $0x1, %edi
leaq 0x9024(%rip), %rsi      # 0xca52
movb $0x0, %al
callq 0x1370
leaq 0xcb94(%rip), %rdi      # 0x105d0
xorl %eax, %eax
movl %eax, %ecx
leaq 0x2f99(%rip), %rdx      # 0x69e0
movq %rcx, %rsi
callq 0x1190
cmpl $0x0, %eax
jge 0x3a67
movl $0x1, %edi
leaq 0x9012(%rip), %rsi      # 0xca72
movb $0x0, %al
callq 0x1370
jmp 0x3b3e
movq 0xcae5(%rip), %rdi      # 0x10558
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movq 0xcadd(%rip), %rdi      # 0x10560
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movl $0x0, -0x834(%rbp)
cmpl $0x4, -0x834(%rbp)
jge 0x3acb
movslq -0x834(%rbp), %rcx
leaq 0xcac3(%rip), %rax      # 0x10570
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x3a96
movq 0xcaee(%rip), %rdi      # 0x105c0
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movq 0xcace(%rip), %rdi      # 0x105b0
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movq 0xcad6(%rip), %rdi      # 0x105c8
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movq 0xcace(%rip), %rdi      # 0x105d0
xorl %eax, %eax
movl %eax, %esi
callq 0x1200
movq $0x0, 0xc84a(%rip) # 0x10360
movl $0x1, %edi
leaq 0x8f72(%rip), %rsi      # 0xca94
movb $0x0, %al
callq 0x1370
movl -0x14(%rbp), %edi
callq 0x1110
movq $0x0, -0x8(%rbp)
jmp 0x430d
jmp 0x3b40
movzbl -0x80c(%rbp), %eax
sarl %eax
andl $0x1, %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xca7a(%rip), %eax      # 0x105d8
je 0x3bb6
movl -0x828(%rbp), %eax
movl %eax, 0xca6c(%rip)      # 0x105d8
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8f2d(%rip), %rsi      # 0xcaab
movb $0x0, %al
callq 0x1370
cmpl $0x0, 0xca4c(%rip)      # 0x105d8
jne 0x3bb4
leaq 0x17d7ebb(%rip), %rdi   # 0x17dba50
xorl %esi, %esi
movl $0x3ed00, %edx          # imm = 0x3ED00
callq 0x10f0
leaq 0x1855ea8(%rip), %rdi   # 0x1859a50
xorl %esi, %esi
movl $0x3ed00, %edx          # imm = 0x3ED00
callq 0x10f0
jmp 0x3bb6
movzbl -0x80b(%rbp), %eax
sarl $0x0, %eax
andl $0x1, %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xca07(%rip), %eax      # 0x105dc
je 0x3bfc
movl -0x828(%rbp), %eax
movl %eax, 0xc9f9(%rip)      # 0x105dc
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8ec2(%rip), %rsi      # 0xcab7
movb $0x0, %al
callq 0x1370
movzbl -0x80b(%rbp), %eax
sarl %eax
andl $0x1, %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc9c6(%rip), %eax      # 0x105e0
je 0x3c41
movl -0x828(%rbp), %eax
movl %eax, 0xc9b8(%rip)      # 0x105e0
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8e89(%rip), %rsi      # 0xcac3
movb $0x0, %al
callq 0x1370
movzbl -0x80b(%rbp), %eax
sarl $0x2, %eax
andl $0x1, %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc984(%rip), %eax      # 0x105e4
je 0x3c87
movl -0x828(%rbp), %eax
movl %eax, 0xc976(%rip)      # 0x105e4
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8e4f(%rip), %rsi      # 0xcacf
movb $0x0, %al
callq 0x1370
movl $0x0, -0x834(%rbp)
cmpl $0x4, -0x834(%rbp)
jge 0x3dfd
movl -0x834(%rbp), %eax
shll $0x2, %eax
addl $0x9, %eax
cltq
movzbl -0x810(%rbp,%rax), %eax
shll $0x18, %eax
movl -0x834(%rbp), %ecx
shll $0x2, %ecx
addl $0xa, %ecx
movslq %ecx, %rcx
movzbl -0x810(%rbp,%rcx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movl -0x834(%rbp), %ecx
shll $0x2, %ecx
addl $0xb, %ecx
movslq %ecx, %rcx
movzbl -0x810(%rbp,%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movl -0x834(%rbp), %ecx
shll $0x2, %ecx
addl $0xc, %ecx
movslq %ecx, %rcx
movzbl -0x810(%rbp,%rcx), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x830(%rbp)
movl 0xc631(%rip), %eax      # 0x10348
andl $0x8, %eax
cmpl $0x0, %eax
je 0x3d93
movaps 0x830a(%rip), %xmm1     # 0xc030
movq -0x830(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x8306(%rip), %xmm1     # 0xc040
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x82ff(%rip), %xmm1     # 0xc050
mulsd %xmm1, %xmm0
movsd 0x82fb(%rip), %xmm1     # 0xc058
mulsd %xmm1, %xmm0
callq 0x1040
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x82e3(%rip), %xmm1     # 0xc060
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x830(%rbp)
movq -0x830(%rbp), %rax
movslq -0x834(%rbp), %rdx
leaq 0xc638(%rip), %rcx      # 0x103e0
cmpq (%rcx,%rdx,8), %rax
je 0x3de7
movq -0x830(%rbp), %rdx
movslq -0x834(%rbp), %rcx
leaq 0xc61d(%rip), %rax      # 0x103e0
movq %rdx, (%rax,%rcx,8)
movl -0x834(%rbp), %edx
movq -0x830(%rbp), %rcx
movl $0x1, %edi
leaq 0x8cfc(%rip), %rsi      # 0xcadc
movb $0x0, %al
callq 0x1370
jmp 0x3de9
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x3c91
movzbl -0x6c7(%rbp), %eax
shll $0x18, %eax
movzbl -0x6c6(%rbp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl -0x6c5(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl -0x6c4(%rbp), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x830(%rbp)
movl 0xc511(%rip), %eax      # 0x10348
andl $0x8, %eax
cmpl $0x0, %eax
je 0x3eb3
movaps 0x81ea(%rip), %xmm1     # 0xc030
movq -0x830(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x81e6(%rip), %xmm1     # 0xc040
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x81df(%rip), %xmm1     # 0xc050
mulsd %xmm1, %xmm0
movsd 0x81db(%rip), %xmm1     # 0xc058
mulsd %xmm1, %xmm0
callq 0x1040
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x81c3(%rip), %xmm1     # 0xc060
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x830(%rbp)
movq -0x830(%rbp), %rax
cmpq 0xc727(%rip), %rax      # 0x105e8
je 0x3eeb
movq -0x830(%rbp), %rax
movq %rax, 0xc717(%rip)      # 0x105e8
movq -0x830(%rbp), %rdx
movl $0x1, %edi
leaq 0x8c0d(%rip), %rsi      # 0xcaf1
movb $0x0, %al
callq 0x1370
movzbl -0x6b7(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc6ec(%rip), %eax      # 0x105f0
je 0x3f4f
movl -0x828(%rbp), %eax
movl %eax, 0xc6de(%rip)      # 0x105f0
cvtsi2sdl 0xc6d6(%rip), %xmm0 # 0x105f0
movsd 0x8146(%rip), %xmm1     # 0xc068
mulsd %xmm1, %xmm0
movsd %xmm0, 0xc6ca(%rip)     # 0x105f8
movl 0xc6bc(%rip), %edx      # 0x105f0
movsd 0xc6bc(%rip), %xmm0     # 0x105f8
movl $0x1, %edi
leaq 0x8bbc(%rip), %rsi      # 0xcb04
movb $0x1, %al
callq 0x1370
movzbl -0x298(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc698(%rip), %eax      # 0x10600
je 0x3f8f
movl -0x828(%rbp), %eax
movl %eax, 0xc68a(%rip)      # 0x10600
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8b93(%rip), %rsi      # 0xcb1b
movb $0x0, %al
callq 0x1370
movzbl -0x297(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc65c(%rip), %eax      # 0x10604
je 0x3fcf
movl -0x828(%rbp), %eax
movl %eax, 0xc64e(%rip)      # 0x10604
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8b6d(%rip), %rsi      # 0xcb35
movb $0x0, %al
callq 0x1370
movzbl -0x296(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc620(%rip), %eax      # 0x10608
je 0x400f
movl -0x828(%rbp), %eax
movl %eax, 0xc612(%rip)      # 0x10608
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8b40(%rip), %rsi      # 0xcb48
movb $0x0, %al
callq 0x1370
movzbl -0x295(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc5e4(%rip), %eax      # 0x1060c
je 0x404f
movl -0x828(%rbp), %eax
movl %eax, 0xc5d6(%rip)      # 0x1060c
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8b14(%rip), %rsi      # 0xcb5c
movb $0x0, %al
callq 0x1370
movzbl -0x27c(%rbp), %eax
shll $0x18, %eax
movzbl -0x27b(%rbp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl -0x27a(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl -0x279(%rbp), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x830(%rbp)
movl $0x0, -0x834(%rbp)
cmpl $0x20, -0x834(%rbp)
jge 0x4115
movq -0x830(%rbp), %rax
movl -0x834(%rbp), %ecx
shrq %cl, %rax
andq $0x1, %rax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
movslq -0x834(%rbp), %rdx
leaq 0xc3bc(%rip), %rcx      # 0x10480
cmpl (%rcx,%rdx,4), %eax
je 0x40ff
movl -0x828(%rbp), %edx
movslq -0x834(%rbp), %rcx
leaq 0xc3a3(%rip), %rax      # 0x10480
movl %edx, (%rax,%rcx,4)
movl -0x834(%rbp), %edx
movl -0x828(%rbp), %ecx
movl $0x1, %edi
leaq 0x8a78(%rip), %rsi      # 0xcb70
movb $0x0, %al
callq 0x1370
jmp 0x4101
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x408d
movzbl -0x278(%rbp), %eax
shll $0x18, %eax
movzbl -0x277(%rbp), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movzbl -0x276(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movzbl -0x275(%rbp), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x830(%rbp)
movl $0x0, -0x834(%rbp)
cmpl $0x20, -0x834(%rbp)
jge 0x41db
movq -0x830(%rbp), %rax
movl -0x834(%rbp), %ecx
shrq %cl, %rax
andq $0x1, %rax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
movslq -0x834(%rbp), %rdx
leaq 0xc276(%rip), %rcx      # 0x10400
cmpl (%rcx,%rdx,4), %eax
je 0x41c5
movl -0x828(%rbp), %edx
movslq -0x834(%rbp), %rcx
leaq 0xc25d(%rip), %rax      # 0x10400
movl %edx, (%rax,%rcx,4)
movl -0x834(%rbp), %edx
movl -0x828(%rbp), %ecx
movl $0x1, %edi
leaq 0x89cd(%rip), %rsi      # 0xcb8b
movb $0x0, %al
callq 0x1370
jmp 0x41c7
movl -0x834(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x834(%rbp)
jmp 0x4153
movzbl -0x26e(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc41c(%rip), %eax      # 0x10610
je 0x4244
movl -0x828(%rbp), %eax
movl %eax, 0xc40e(%rip)      # 0x10610
cvtsi2sdl 0xc406(%rip), %xmm0 # 0x10610
movsd 0x7e66(%rip), %xmm1     # 0xc078
mulsd %xmm0, %xmm1
movsd 0x7e52(%rip), %xmm0     # 0xc070
callq 0x1090
movsd %xmm0, 0xbf15(%rip)     # 0x10140
movl -0x828(%rbp), %edx
movl $0x1, %edi
leaq 0x8969(%rip), %rsi      # 0xcba6
movb $0x0, %al
callq 0x1370
movzbl -0x26d(%rbp), %eax
movl %eax, -0x828(%rbp)
movl -0x828(%rbp), %eax
cmpl 0xc3b7(%rip), %eax      # 0x10614
je 0x4284
movl -0x828(%rbp), %eax
movl %eax, 0xc3a9(%rip)      # 0x10614
movl 0xc3a3(%rip), %edx      # 0x10614
movl $0x1, %edi
leaq 0x893c(%rip), %rsi      # 0xcbb9
movb $0x0, %al
callq 0x1370
leaq 0xc39d(%rip), %rax      # 0x10628
cmpl $0x5, (%rax)
jne 0x42bb
cvtsi2sdl 0xc37c(%rip), %xmm0 # 0x10614
movsd 0x7dd8(%rip), %xmm1     # 0xc078
mulsd %xmm0, %xmm1
movsd 0x7dc4(%rip), %xmm0     # 0xc070
callq 0x1090
movsd %xmm0, 0xbe8f(%rip)     # 0x10148
jmp 0x42f8
movl 0xc353(%rip), %eax      # 0x10614
imull $0xa, 0xc170(%rip), %ecx # 0x10438
addl %ecx, %eax
imull $0x14, 0xc163(%rip), %ecx # 0x10434
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x7d99(%rip), %xmm1     # 0xc078
mulsd %xmm0, %xmm1
movsd 0x7d85(%rip), %xmm0     # 0xc070
callq 0x1090
movsd %xmm0, 0xbe50(%rip)     # 0x10148
jmp 0x370d
movl -0x14(%rbp), %edi
callq 0x1110
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x840, %rsp            # imm = 0x840
popq %rbp
retq
nopw (%rax,%rax)