// File: /workspace/github_cpp_makefile_star2_O2/msu-starx[P]starx/exosuit.cpp
// Function: ExoSuit::initialize()
void ExoSuit::initialize(void){
    //Filter
    u.clear();
    y.clear();
    lasty.clear();
    u.resize(4);
    y.resize(4);
    lasty.resize(4);
    // Sensor States
    adcValues.clear();
    pressureStates.clear();
    forceStates.clear();
    emgStates.clear();
    adcValues.resize(board.ADCPinCount);
    pressureStates.resize(pressurePins.size());
    forceStates.resize(forcePins.size());
    emgStates.resize(emgPins.size());
    // Pressure Controller States
    pressurePID.clear();
    outputStates.clear();
    setpointStates.clear();
    dutyCycleStates.clear();
    dutyCycles.clear();
    pressurePID.resize(pressurePins.size());
    outputStates.resize(pressurePins.size());
    setpointStates.resize(pressurePins.size());
    dutyCycleStates.resize(pressurePins.size());
    dutyCycles.resize(pressurePins.size());
    for(int i = 0; i < pressurePID.size(); i++) {
        pressurePID[i].setMode(pressurePID[i].AUTOMATIC);
        pressurePID[i].setOutputLimits(outputMin, outputMax);
        pressurePID[i].setTunings(Kp, Ki, Kd);
    }
    // Serial Port
    board.setupSerial(portName, baudRate);
    sleep(1); // Pause for 1 second
}

// 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 0x33c5
movq %rax, 0x8(%rbx)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x33d3
movq %rax, 0x20(%rbx)
leaq 0x18(%rbx), %r15
leaq 0x30(%rbx), %r14
movq 0x30(%rbx), %rax
cmpq %rax, 0x38(%rbx)
je 0x33e9
movq %rax, 0x38(%rbx)
pushq $0x4
popq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3764
movq %r15, %rdi
movq %r12, %rsi
callq 0x3764
movq %r14, %rdi
movq %r12, %rsi
callq 0x3764
movq 0x318(%rbx), %rax
cmpq %rax, 0x320(%rbx)
je 0x3425
movq %rax, 0x320(%rbx)
movq 0x378(%rbx), %rax
cmpq %rax, 0x380(%rbx)
je 0x343c
movq %rax, 0x380(%rbx)
movq 0x390(%rbx), %rax
cmpq %rax, 0x398(%rbx)
je 0x3453
movq %rax, 0x398(%rbx)
leaq 0x318(%rbx), %rdi
leaq 0x378(%rbx), %r12
leaq 0x390(%rbx), %r15
leaq 0x3a8(%rbx), %r14
movq 0x3a8(%rbx), %rax
cmpq %rax, 0x3b0(%rbx)
je 0x3486
movq %rax, 0x3b0(%rbx)
movslq 0x1e0(%rbx), %rsi
callq 0x379c
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq %r12, %rdi
callq 0x3764
movq 0x350(%rbx), %rsi
subq 0x348(%rbx), %rsi
sarq $0x2, %rsi
movq %r15, %rdi
callq 0x3764
movq 0x368(%rbx), %rsi
subq 0x360(%rbx), %rsi
sarq $0x2, %rsi
movq %r14, %rdi
callq 0x3764
movq 0x470(%rbx), %rax
cmpq %rax, 0x478(%rbx)
je 0x34f7
movq %rax, 0x478(%rbx)
movq 0x410(%rbx), %rax
cmpq %rax, 0x418(%rbx)
je 0x350e
movq %rax, 0x418(%rbx)
movq 0x428(%rbx), %rax
cmpq %rax, 0x430(%rbx)
je 0x3525
movq %rax, 0x430(%rbx)
leaq 0x470(%rbx), %r12
leaq 0x410(%rbx), %r14
leaq 0x428(%rbx), %r13
leaq 0x440(%rbx), %rax
movq %rax, -0x38(%rbp)
movq 0x440(%rbx), %rax
cmpq %rax, 0x448(%rbx)
je 0x355c
movq %rax, 0x448(%rbx)
leaq 0x50(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x458(%rbx), %r15
movq %r15, %rdi
callq 0x3702
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq %r12, %rdi
callq 0x37d4
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq %r14, %rdi
callq 0x3764
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq %r13, %rdi
callq 0x3764
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq -0x38(%rbp), %rdi
callq 0x3818
movq 0x338(%rbx), %rsi
subq 0x330(%rbx), %rsi
sarq $0x2, %rsi
movq %r15, %rdi
callq 0x3850
xorl %r14d, %r14d
movl $0x88, %r15d
xorl %r12d, %r12d
movq 0x470(%rbx), %rdi
movq 0x478(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %r12, %rax
jbe 0x367c
movl 0x4(%rdi,%r14), %esi
addq %r14, %rdi
callq 0x5442
movq 0x470(%rbx), %rdi
addq %r14, %rdi
movsd 0x3f8(%rbx), %xmm0
movsd 0x400(%rbx), %xmm1
callq 0x53ea
movq 0x470(%rbx), %rdi
addq %r14, %rdi
movsd 0x3e0(%rbx), %xmm0
movsd 0x3e8(%rbx), %xmm1
movsd 0x3f0(%rbx), %xmm2
callq 0x5326
incq %r12
addq $0x88, %r14
jmp 0x3602
leaq 0x2a5d(%rip), %rsi      # 0x60e0
leaq -0x60(%rbp), %rbx
leaq -0x29(%rbp), %rdx
movq %rbx, %rdi
callq 0x2aea
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
movl $0xf4240, %edx          # imm = 0xF4240
callq 0x4b8e
leaq -0x60(%rbp), %rdi
callq 0x20b0
pushq $0x1
popq %rdi
callq 0x2140
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2310