// File: /workspace/github_cpp_makefile_star2_O2/msu-starx[P]starx/exosuit.cpp
// Function: ExoSuit::updateSensors()
void ExoSuit::updateSensors(void){
    u.clear();
    y.clear();
    lasty.clear();
    pressureStates.clear();
    forceStates.clear();
    emgStates.clear();
    for(int i = 0; i < SensorMax; i++) {
        // Pressure Sensors
        /*if(i < pressurePins.size())
           pressureStates.push_back(cvt.convertToPressure(cvt.convertToVoltage(adcValues[pressurePins[i]], board.ADCVoltageMultiplier)));*/
        if(i < pressurePins.size()) {
            u.push_back(cvt.convertToPressure(cvt.convertToVoltage(adcValues[pressurePins[i]], board.ADCVoltageMultiplier)));
            y.push_back(0.945 * lasty[i] + 0.0549 * u[i]);
            lasty.push_back(y[i]);
            pressureStates.push_back(y[i]);
        }
        // Force Sensors
        if(i < forcePins.size())
            forceStates.push_back(cvt.convertToForce(cvt.convertToVoltage(adcValues[forcePins[i]], board.ADCVoltageMultiplier)));
        // EMG Sensors
        if(i < emgPins.size())
            emgStates.push_back(cvt.convertToVoltage(adcValues[emgPins[i]], board.ADCVoltageMultiplier));
    }
    for(int i = 0; i < pressureStates.size(); i++) {
        std::cout << pressureStates[i] << " ";
    }
    for(int i = 0; i < emgStates.size(); i++) {
        std::cout << emgStates[i] << " ";
    }
    std::cout << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0x2f25
movq %rax, 0x8(%rbx)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x2f33
movq %rax, 0x20(%rbx)
movq 0x30(%rbx), %rax
cmpq %rax, 0x38(%rbx)
je 0x2f41
movq %rax, 0x38(%rbx)
movq 0x378(%rbx), %rax
cmpq %rax, 0x380(%rbx)
je 0x2f58
movq %rax, 0x380(%rbx)
movq 0x390(%rbx), %rax
cmpq %rax, 0x398(%rbx)
je 0x2f6f
movq %rax, 0x398(%rbx)
movq 0x3a8(%rbx), %rax
cmpq %rax, 0x3b0(%rbx)
je 0x2f86
movq %rax, 0x3b0(%rbx)
leaq 0x18(%rbx), %rax
movq %rax, -0x58(%rbp)
leaq 0x30(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x378(%rbx), %rax
movq %rax, -0x48(%rbp)
leaq 0x390(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x3a8(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x48(%rbx), %r15
xorl %r13d, %r13d
leaq -0x30(%rbp), %r12
xorl %r14d, %r14d
movl 0x310(%rbx), %eax
cmpq %rax, %r14
jae 0x3126
movq 0x330(%rbx), %rax
movq 0x338(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x3080
movslq (%rax,%r14,4), %rax
movq 0x318(%rbx), %rcx
movl (%rcx,%rax,4), %esi
movsd 0x1e8(%rbx), %xmm0
movq %r15, %rdi
callq 0x4bb8
movq %r15, %rdi
callq 0x4bc6
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x39d6
movq (%rbx), %rax
movq 0x30(%rbx), %rcx
movsd (%rax,%r14,8), %xmm0
mulsd 0x307b(%rip), %xmm0     # 0x60b8
movsd (%rcx,%r14,8), %xmm1
mulsd 0x3075(%rip), %xmm1     # 0x60c0
addsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movq -0x58(%rbp), %rdi
movq %r12, %rsi
callq 0x39d6
movq 0x18(%rbx), %rsi
addq %r13, %rsi
movq -0x50(%rbp), %rdi
callq 0x36d8
movq 0x18(%rbx), %rsi
addq %r13, %rsi
movq -0x48(%rbp), %rdi
callq 0x36d8
movq 0x348(%rbx), %rax
movq 0x350(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x30d1
movslq (%rax,%r14,4), %rax
movq 0x318(%rbx), %rcx
movl (%rcx,%rax,4), %esi
movsd 0x1e8(%rbx), %xmm0
movq %r15, %rdi
callq 0x4bb8
movq %r15, %rdi
callq 0x4be4
movsd %xmm0, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x39d6
movq 0x360(%rbx), %rax
movq 0x368(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x311a
movslq (%rax,%r14,4), %rax
movq 0x318(%rbx), %rcx
movl (%rcx,%rax,4), %esi
movsd 0x1e8(%rbx), %xmm0
movq %r15, %rdi
callq 0x4bb8
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x39d6
incq %r14
addq $0x8, %r13
jmp 0x2fc5
xorl %r12d, %r12d
movq 0x6e90(%rip), %r14      # 0x9fc0
leaq 0x3181(%rip), %r15      # 0x62b8
movq 0x378(%rbx), %rax
movq 0x380(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x316f
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2190
incq %r12
jmp 0x3137
xorl %r12d, %r12d
movq 0x6e47(%rip), %r14      # 0x9fc0
leaq 0x3138(%rip), %r15      # 0x62b8
movq 0x3a8(%rbx), %rax
movq 0x3b0(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x31b8
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
callq 0x22d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2190
incq %r12
jmp 0x3180
movq 0x6e01(%rip), %rdi      # 0x9fc0
callq 0x20c0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop