#include <math.h>

typedef struct {
  float x;
  float y;
  float z;
} point3;

typedef struct {
  point3 x;
  point3 y;
  point3 z;
  point3 translation;
} matrix3;

matrix3 MatrixFromNormal(point3 normal) {
  matrix3 result;
  float length = sqrtf(normal.x * normal.x + normal.y * normal.y + normal.z * normal.z);
  result.z = (point3){normal.x / length, normal.y / length, normal.z / length};
  if (fabsf(result.z.x) < fabsf(result.z.y)) {
    float a = 1.0f / sqrtf(result.z.y * result.z.y + result.z.z * result.z.z);
    result.x = (point3){result.z.z * a, 0.0f, -result.z.y * a};
  } else {
    float a = 1.0f / sqrtf(result.z.x * result.z.x + result.z.z * result.z.z);
    result.x = (point3){0.0f, result.z.z * a, -result.z.x * a};
  }
  result.y = (point3){result.z.y * result.x.z - result.z.z * result.x.y,
                     result.z.z * result.x.x - result.z.x * result.x.z,
                     result.z.x * result.x.y - result.z.y * result.x.x};
  result.translation = (point3){0.0f, 0.0f, 0.0f};
  return result;
}
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence