// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class approx_sun_coord {
//     double D;   /* Declination of the Sun */
//     double EqT; /* The Equation of Time */
//     double R;   /* The distance of the Sun from the Earth
//                in astronomical units (AU)  */
//     double SD;  /* The angular semidiameter of the Sun in degrees */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// enum round_t {
//     UP, DOWN, NEAREST
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LATITUDE = (21.42249);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LONGITUDE = (39.82620);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double M_PI = (3.141592653589793);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double ONE_MINUTE = (60.0 / 3600.0);


import static org.arabeyes.itl.newmethod.DefsModule.ONE_MINUTE;
import org.arabeyes.itl.newmethod.DefsModule.approx_sun_coord;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import org.arabeyes.itl.newmethod.DefsModule.round_t;
import static java.lang.Math.acos;
import static java.lang.Math.asin;
import static java.lang.Math.atan2;
import static java.lang.Math.ceil;
import static java.lang.Math.cos;
import static java.lang.Math.floor;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static java.lang.Math.tan;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LATITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LONGITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.M_PI;
        double p1 = 1.0 / 15.0;
        double p2 = cos(to_radians(latitude)) * cos(to_radians(D));
        double p3 = sin(to_radians(latitude)) * sin(to_radians(D));
        double p4 = -1.0 * sin(to_radians(alpha));
        double p5 = to_degrees(acos((p4 - p3) / p2));
        double r = p1 * p5;
        return r;
    }

    /**
     * A function used to compute Asr
     * Taken from: http://praytimes.org/calculation/
     */
    private static double A(final double t,
                            final double latitude,
                            final double D) {
        double p1 = 1.0 / 15.0;
        double p2 = cos(to_radians(latitude)) * cos(to_radians(D));
        double p3 = sin(to_radians(latitude)) * sin(to_radians(D));
        double p4 = tan(to_radians((latitude - D)));
        double p5 = arccot(t + p4);
        double p6 = sin(p5);
        double p7 = acos((p6 - p3) / p2);
        double r = p1 * to_degrees(p7);
        return r;
    }

    /**
     * Compute the Dhuhr prayer time
     */
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class approx_sun_coord {
//     double D;   /* Declination of the Sun */
//     double EqT; /* The Equation of Time */
//     double R;   /* The distance of the Sun from the Earth
//                in astronomical units (AU)  */
//     double SD;  /* The angular semidiameter of the Sun in degrees */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// enum round_t {
//     UP, DOWN, NEAREST
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LATITUDE = (21.42249);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double KAABA_LONGITUDE = (39.82620);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double M_PI = (3.141592653589793);
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static final double ONE_MINUTE = (60.0 / 3600.0);


// Path: itl/src/main/java/org/arabeyes/itl/newmethod/PrayerModule.java
import static org.arabeyes.itl.newmethod.DefsModule.ONE_MINUTE;
import org.arabeyes.itl.newmethod.DefsModule.approx_sun_coord;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import org.arabeyes.itl.newmethod.DefsModule.round_t;
import static java.lang.Math.acos;
import static java.lang.Math.asin;
import static java.lang.Math.atan2;
import static java.lang.Math.ceil;
import static java.lang.Math.cos;
import static java.lang.Math.floor;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static java.lang.Math.tan;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LATITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.KAABA_LONGITUDE;
import static org.arabeyes.itl.newmethod.DefsModule.M_PI;

        double p1 = 1.0 / 15.0;
        double p2 = cos(to_radians(latitude)) * cos(to_radians(D));
        double p3 = sin(to_radians(latitude)) * sin(to_radians(D));
        double p4 = -1.0 * sin(to_radians(alpha));
        double p5 = to_degrees(acos((p4 - p3) / p2));
        double r = p1 * p5;
        return r;
    }

    /**
     * A function used to compute Asr
     * Taken from: http://praytimes.org/calculation/
     */
    private static double A(final double t,
                            final double latitude,
                            final double D) {
        double p1 = 1.0 / 15.0;
        double p2 = cos(to_radians(latitude)) * cos(to_radians(D));
        double p3 = sin(to_radians(latitude)) * sin(to_radians(D));
        double p4 = tan(to_radians((latitude - D)));
        double p5 = arccot(t + p4);
        double p6 = sin(p5);
        double p7 = acos((p6 - p3) / p2);
        double r = p1 * to_degrees(p7);
        return r;
    }

    /**
     * Compute the Dhuhr prayer time
     */
    private static double get_dhuhr(location loc,