why am I getting a segmentation fault?
/*
 * Convert a 9 digit int to a 9 element int array.
 */
int populate_array(int sin, int *sin_array) {
    if (sin <= 99999999) {
        return 1;
    }

    int temp_sin = sin;
    for (int i = 8; i >= 0; i++) {
        sin_array[i] = temp_sin % 10;
        temp_sin = temp_sin / 10;
    }
    return 0;
}

/*
 * Return 0 if the given sin_array is a valid SIN, and 1 otherwise.
 */
int check_sin(int *sin_array) {
    int luhn_array[9] = {1, 2, 1, 2, 1, 2, 1, 2, 1};
    int sum = 0;
    for (int i = 0; i < 9; i++) {
        int product = luhn_array[i] * sin_array[i];
        if (product > 9) {
            product = product / 10 + product % 10;
        }
        sum += product;
    }
    if (sum % 10 == 0) {
        return 0;
    }
    return 1;
}
