Biquad filter from Matlab to C using "tf2sos"
What I can see from the code is the following mapping between the array coeffs[] and the filter coefficients $a_i$ and $b_i$ (note that $a_0=1$ and is not stored in coeffs[]):

$b_0=$coeffs[2], $b_1=$coeffs[1], $b_2=$coeffs[0]

$a_1=$coeffs[4], $a_2=$coeffs[3]

For the time being choose the scaling equal to $1$ (scalefactor=0) to check if everything else works. The final scaling per section will depend on the order of the sections, and on the goal of scaling (minimization of the possibility of overflow, or minimizing quantization noise).