vectorized c code