// Generated by rstantools.  Do not edit by hand.

/*
    multinma 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.

    multinma 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 multinma.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODELS_HPP
#define MODELS_HPP
#define STAN__SERVICES__COMMAND_HPP
#ifndef USE_STANC3
#define USE_STANC3
#endif
#include <rstan/rstaninc.hpp>
// Code generated by stanc v2.32.2
#include <stan/model/model_header.hpp>
namespace model_survival_param_namespace {
using stan::model::model_base_crtp;
using namespace stan::math;
stan::math::profile_map profiles__;
static constexpr std::array<const char*, 1243> locations_array__ =
  {" (found before start of program)",
  " (in 'string', line 797, column 0 to column 22)",
  " (in 'string', line 800, column 0 to column 24)",
  " (in 'string', line 801, column 0 to column 34)",
  " (in 'string', line 804, column 0 to column 53)",
  " (in 'string', line 805, column 0 to column 63)",
  " (in 'string', line 808, column 0 to column 49)",
  " (in 'string', line 811, column 2 to column 29)",
  " (in 'string', line 813, column 2 to column 39)",
  " (in 'string', line 815, column 2 to column 58)",
  " (in 'string', line 819, column 2 to column 27)",
  " (in 'string', line 820, column 2 to column 35)",
  " (in 'string', line 825, column 0 to column 23)",
  " (in 'string', line 830, column 0 to line 835, column 14)",
  " (in 'string', line 838, column 0 to column 54)",
  " (in 'string', line 841, column 0 to column 58)",
  " (in 'string', line 843, column 0 to column 17)",
  " (in 'string', line 845, column 0 to column 56)",
  " (in 'string', line 847, column 0 to column 24)",
  " (in 'string', line 849, column 0 to column 47)",
  " (in 'string', line 854, column 0 to column 70)",
  " (in 'string', line 855, column 0 to column 45)",
  " (in 'string', line 1252, column 2 to column 79)",
  " (in 'string', line 1253, column 2 to column 38)",
  " (in 'string', line 1254, column 2 to column 38)",
  " (in 'string', line 1255, column 2 to column 34)",
  " (in 'string', line 1257, column 2 to column 59)",
  " (in 'string', line 1262, column 0 to column 54)",
  " (in 'string', line 1263, column 0 to column 53)",
  " (in 'string', line 1264, column 0 to column 44)",
  " (in 'string', line 1267, column 2 to column 66)",
  " (in 'string', line 1271, column 0 to column 22)",
  " (in 'string', line 861, column 2 to column 24)",
  " (in 'string', line 860, column 11 to line 862, column 1)",
  " (in 'string', line 860, column 0 to line 862, column 1)",
  " (in 'string', line 867, column 2 to column 44)",
  " (in 'string', line 866, column 39 to line 868, column 1)",
  " (in 'string', line 866, column 0 to line 868, column 1)",
  " (in 'string', line 873, column 2 to column 33)",
  " (in 'string', line 872, column 15 to line 874, column 1)",
  " (in 'string', line 872, column 0 to line 874, column 1)",
  " (in 'string', line 878, column 2 to column 123)",
  " (in 'string', line 879, column 2 to column 113)",
  " (in 'string', line 877, column 19 to line 880, column 1)",
  " (in 'string', line 877, column 0 to line 880, column 1)",
  " (in 'string', line 902, column 4 to line 904, column 23)",
  " (in 'string', line 901, column 9 to line 905, column 3)",
  " (in 'string', line 890, column 13 to column 19)",
  " (in 'string', line 890, column 6 to line 892, column 25)",
  " (in 'string', line 898, column 8 to column 37)",
  " (in 'string', line 896, column 8 to column 69)",
  " (in 'string', line 895, column 8 to line 898, column 37)",
  " (in 'string', line 894, column 26 to line 899, column 7)",
  " (in 'string', line 894, column 6 to line 899, column 7)",
  " (in 'string', line 889, column 4 to line 900, column 5)",
  " (in 'string', line 888, column 10 to line 901, column 3)",
  " (in 'string', line 888, column 2 to line 905, column 3)",
  " (in 'string', line 912, column 4 to column 97)",
  " (in 'string', line 908, column 22 to line 913, column 3)",
  " (in 'string', line 908, column 2 to line 913, column 3)",
  " (in 'string', line 919, column 8 to column 69)",
  " (in 'string', line 918, column 72 to line 920, column 7)",
  " (in 'string', line 918, column 6 to line 920, column 7)",
  " (in 'string', line 917, column 24 to line 921, column 5)",
  " (in 'string', line 917, column 4 to line 921, column 5)",
  " (in 'string', line 916, column 21 to line 922, column 3)",
  " (in 'string', line 916, column 2 to line 922, column 3)",
  " (in 'string', line 887, column 12 to line 923, column 1)",
  " (in 'string', line 887, column 0 to line 923, column 1)",
  " (in 'string', line 978, column 6 to line 980, column 34)",
  " (in 'string', line 977, column 11 to line 981, column 5)",
  " (in 'string', line 967, column 13 to column 35)",
  " (in 'string', line 967, column 6 to line 969, column 34)",
  " (in 'string', line 975, column 8 to column 59)",
  " (in 'string', line 973, column 8 to column 108)",
  " (in 'string', line 972, column 8 to line 975, column 59)",
  " (in 'string', line 971, column 35 to line 976, column 7)",
  " (in 'string', line 971, column 6 to line 976, column 7)",
  " (in 'string', line 966, column 12 to line 977, column 5)",
  " (in 'string', line 966, column 4 to line 981, column 5)",
  " (in 'string', line 986, column 10 to column 84)",
  " (in 'string', line 985, column 74 to line 987, column 9)",
  " (in 'string', line 985, column 8 to line 987, column 9)",
  " (in 'string', line 989, column 10 to column 86)",
  " (in 'string', line 988, column 78 to line 990, column 9)",
  " (in 'string', line 988, column 8 to line 990, column 9)",
  " (in 'string', line 984, column 35 to line 991, column 7)",
  " (in 'string', line 984, column 6 to line 991, column 7)",
  " (in 'string', line 983, column 23 to line 992, column 5)",
  " (in 'string', line 983, column 4 to line 992, column 5)",
  " (in 'string', line 965, column 9 to line 993, column 3)",
  " (in 'string', line 928, column 11 to column 37)",
  " (in 'string', line 928, column 4 to line 930, column 32)",
  " (in 'string', line 936, column 10 to column 128)",
  " (in 'string', line 935, column 74 to line 937, column 9)",
  " (in 'string', line 935, column 8 to line 937, column 9)",
  " (in 'string', line 939, column 10 to column 130)",
  " (in 'string', line 938, column 78 to line 940, column 9)",
  " (in 'string', line 938, column 8 to line 940, column 9)",
  " (in 'string', line 934, column 29 to line 941, column 7)",
  " (in 'string', line 934, column 6 to line 941, column 7)",
  " (in 'string', line 933, column 23 to line 942, column 5)",
  " (in 'string', line 933, column 4 to line 942, column 5)",
  " (in 'string', line 958, column 8 to column 125)",
  " (in 'string', line 957, column 40 to line 959, column 7)",
  " (in 'string', line 957, column 11 to line 959, column 7)",
  " (in 'string', line 956, column 28 to column 72)",
  " (in 'string', line 956, column 6 to line 959, column 7)",
  " (in 'string', line 962, column 8 to column 87)",
  " (in 'string', line 961, column 35 to line 963, column 7)",
  " (in 'string', line 961, column 6 to line 963, column 7)",
  " (in 'string', line 955, column 11 to line 964, column 5)",
  " (in 'string', line 950, column 8 to line 951, column 76)",
  " (in 'string', line 947, column 8 to line 948, column 125)",
  " (in 'string', line 946, column 8 to line 951, column 76)",
  " (in 'string', line 953, column 8 to column 87)",
  " (in 'string', line 945, column 35 to line 954, column 7)",
  " (in 'string', line 945, column 6 to line 954, column 7)",
  " (in 'string', line 944, column 12 to line 955, column 5)",
  " (in 'string', line 944, column 4 to line 964, column 5)",
  " (in 'string', line 927, column 20 to line 965, column 3)",
  " (in 'string', line 927, column 2 to line 993, column 3)",
  " (in 'string', line 926, column 21 to line 994, column 1)",
  " (in 'string', line 926, column 0 to line 994, column 1)",
  " (in 'string', line 1014, column 8 to column 37)",
  " (in 'string', line 1016, column 16 to column 18)",
  " (in 'string', line 1016, column 10 to column 55)",
  " (in 'string', line 1017, column 10 to column 20)",
  " (in 'string', line 1018, column 10 to column 21)",
  " (in 'string', line 1019, column 21 to column 38)",
  " (in 'string', line 1019, column 10 to column 47)",
  " (in 'string', line 1020, column 22 to column 65)",
  " (in 'string', line 1020, column 10 to column 65)",
  " (in 'string', line 1026, column 24 to column 38)",
  " (in 'string', line 1026, column 12 to column 38)",
  " (in 'string', line 1027, column 26 to column 42)",
  " (in 'string', line 1027, column 12 to column 42)",
  " (in 'string', line 1024, column 17 to line 1028, column 11)",
  " (in 'string', line 1022, column 24 to column 66)",
  " (in 'string', line 1022, column 12 to column 66)",
  " (in 'string', line 1023, column 26 to column 70)",
  " (in 'string', line 1023, column 12 to column 70)",
  " (in 'string', line 1021, column 22 to line 1024, column 11)",
  " (in 'string', line 1021, column 10 to line 1028, column 11)",
  " (in 'string', line 1029, column 10 to line 1036, column 41)",
  " (in 'string', line 1015, column 16 to line 1037, column 9)",
  " (in 'string', line 1015, column 8 to line 1037, column 9)",
  " (in 'string', line 1013, column 31 to line 1038, column 7)",
  " (in 'string', line 1013, column 6 to line 1038, column 7)",
  " (in 'string', line 1012, column 11 to line 1039, column 5)",
  " (in 'string', line 998, column 13 to column 19)",
  " (in 'string', line 998, column 6 to column 26)",
  " (in 'string', line 999, column 13 to column 19)",
  " (in 'string', line 999, column 6 to column 27)",
  " (in 'string', line 1000, column 13 to column 32)",
  " (in 'string', line 1000, column 34 to column 51)",
  " (in 'string', line 1000, column 6 to column 60)",
  " (in 'string', line 1001, column 18 to column 53)",
  " (in 'string', line 1001, column 6 to column 53)",
  " (in 'string', line 1002, column 18 to column 55)",
  " (in 'string', line 1002, column 6 to column 55)",
  " (in 'string', line 1003, column 20 to column 59)",
  " (in 'string', line 1003, column 6 to column 59)",
  " (in 'string', line 1004, column 6 to line 1011, column 32)",
  " (in 'string', line 997, column 32 to line 1012, column 5)",
  " (in 'string', line 997, column 4 to line 1039, column 5)",
  " (in 'string', line 996, column 14 to line 1040, column 3)",
  " (in 'string', line 996, column 2 to line 1040, column 3)",
  " (in 'string', line 1043, column 11 to column 32)",
  " (in 'string', line 1043, column 4 to line 1045, column 37)",
  " (in 'string', line 1051, column 6 to column 116)",
  " (in 'string', line 1047, column 24 to line 1052, column 5)",
  " (in 'string', line 1047, column 4 to line 1052, column 5)",
  " (in 'string', line 1056, column 10 to column 118)",
  " (in 'string', line 1055, column 64 to line 1057, column 9)",
  " (in 'string', line 1055, column 8 to line 1057, column 9)",
  " (in 'string', line 1054, column 30 to line 1058, column 7)",
  " (in 'string', line 1054, column 6 to line 1058, column 7)",
  " (in 'string', line 1053, column 23 to line 1059, column 5)",
  " (in 'string', line 1053, column 4 to line 1059, column 5)",
  " (in 'string', line 1121, column 13 to column 23)",
  " (in 'string', line 1121, column 6 to column 56)",
  " (in 'string', line 1123, column 69 to column 122)",
  " (in 'string', line 1123, column 38 to column 122)",
  " (in 'string', line 1123, column 14 to column 122)",
  " (in 'string', line 1123, column 6 to column 122)",
  " (in 'string', line 1141, column 10 to column 43)",
  " (in 'string', line 1143, column 18 to column 20)",
  " (in 'string', line 1143, column 12 to column 61)",
  " (in 'string', line 1144, column 12 to column 22)",
  " (in 'string', line 1145, column 12 to column 23)",
  " (in 'string', line 1146, column 23 to column 40)",
  " (in 'string', line 1146, column 12 to column 49)",
  " (in 'string', line 1147, column 24 to column 71)",
  " (in 'string', line 1147, column 12 to column 71)",
  " (in 'string', line 1153, column 26 to column 40)",
  " (in 'string', line 1153, column 14 to column 40)",
  " (in 'string', line 1154, column 28 to column 44)",
  " (in 'string', line 1154, column 14 to column 44)",
  " (in 'string', line 1151, column 19 to line 1155, column 13)",
  " (in 'string', line 1149, column 26 to column 72)",
  " (in 'string', line 1149, column 14 to column 72)",
  " (in 'string', line 1150, column 28 to column 76)",
  " (in 'string', line 1150, column 14 to column 76)",
  " (in 'string', line 1148, column 24 to line 1151, column 13)",
  " (in 'string', line 1148, column 12 to line 1155, column 13)",
  " (in 'string', line 1156, column 12 to line 1163, column 47)",
  " (in 'string', line 1142, column 18 to line 1164, column 11)",
  " (in 'string', line 1142, column 10 to line 1164, column 11)",
  " (in 'string', line 1140, column 33 to line 1165, column 9)",
  " (in 'string', line 1140, column 8 to line 1165, column 9)",
  " (in 'string', line 1139, column 13 to line 1166, column 7)",
  " (in 'string', line 1125, column 15 to column 25)",
  " (in 'string', line 1125, column 8 to column 32)",
  " (in 'string', line 1126, column 15 to column 25)",
  " (in 'string', line 1126, column 8 to column 33)",
  " (in 'string', line 1127, column 15 to column 25)",
  " (in 'string', line 1127, column 27 to column 44)",
  " (in 'string', line 1127, column 8 to column 53)",
  " (in 'string', line 1128, column 20 to column 59)",
  " (in 'string', line 1128, column 8 to column 59)",
  " (in 'string', line 1129, column 20 to column 61)",
  " (in 'string', line 1129, column 8 to column 61)",
  " (in 'string', line 1130, column 22 to column 65)",
  " (in 'string', line 1130, column 8 to column 65)",
  " (in 'string', line 1131, column 8 to line 1138, column 38)",
  " (in 'string', line 1124, column 34 to line 1139, column 7)",
  " (in 'string', line 1124, column 6 to line 1166, column 7)",
  " (in 'string', line 1120, column 11 to line 1167, column 5)",
  " (in 'string', line 1087, column 10 to column 43)",
  " (in 'string', line 1089, column 18 to column 20)",
  " (in 'string', line 1089, column 12 to column 61)",
  " (in 'string', line 1090, column 12 to column 22)",
  " (in 'string', line 1091, column 12 to column 23)",
  " (in 'string', line 1092, column 23 to column 40)",
  " (in 'string', line 1092, column 12 to column 49)",
  " (in 'string', line 1093, column 24 to column 71)",
  " (in 'string', line 1093, column 12 to column 71)",
  " (in 'string', line 1099, column 14 to column 41)",
  " (in 'string', line 1100, column 14 to column 45)",
  " (in 'string', line 1097, column 19 to line 1101, column 13)",
  " (in 'string', line 1095, column 14 to column 73)",
  " (in 'string', line 1096, column 14 to column 77)",
  " (in 'string', line 1094, column 24 to line 1097, column 13)",
  " (in 'string', line 1094, column 12 to line 1101, column 13)",
  " (in 'string', line 1103, column 21 to column 25)",
  " (in 'string', line 1103, column 14 to column 42)",
  " (in 'string', line 1104, column 21 to column 25)",
  " (in 'string', line 1104, column 14 to column 36)",
  " (in 'string', line 1105, column 14 to column 102)",
  " (in 'string', line 1106, column 55 to column 112)",
  " (in 'string', line 1106, column 14 to column 112)",
  " (in 'string', line 1107, column 14 to line 1114, column 41)",
  " (in 'string', line 1115, column 14 to column 71)",
  " (in 'string', line 1102, column 28 to line 1116, column 13)",
  " (in 'string', line 1102, column 12 to line 1116, column 13)",
  " (in 'string', line 1088, column 18 to line 1117, column 11)",
  " (in 'string', line 1088, column 10 to line 1117, column 11)",
  " (in 'string', line 1086, column 33 to line 1118, column 9)",
  " (in 'string', line 1086, column 8 to line 1118, column 9)",
  " (in 'string', line 1085, column 13 to line 1119, column 7)",
  " (in 'string', line 1063, column 17 to column 21)",
  " (in 'string', line 1063, column 10 to column 38)",
  " (in 'string', line 1064, column 17 to column 21)",
  " (in 'string', line 1064, column 10 to column 32)",
  " (in 'string', line 1065, column 17 to column 21)",
  " (in 'string', line 1065, column 10 to column 28)",
  " (in 'string', line 1066, column 17 to column 21)",
  " (in 'string', line 1066, column 10 to column 29)",
  " (in 'string', line 1067, column 17 to column 34)",
  " (in 'string', line 1067, column 36 to column 53)",
  " (in 'string', line 1067, column 10 to column 62)",
  " (in 'string', line 1068, column 22 to column 109)",
  " (in 'string', line 1068, column 10 to column 109)",
  " (in 'string', line 1069, column 22 to column 109)",
  " (in 'string', line 1069, column 10 to column 109)",
  " (in 'string', line 1070, column 24 to column 113)",
  " (in 'string', line 1070, column 10 to column 113)",
  " (in 'string', line 1071, column 10 to column 90)",
  " (in 'string', line 1073, column 47 to column 100)",
  " (in 'string', line 1073, column 10 to column 100)",
  " (in 'string', line 1075, column 10 to line 1082, column 38)",
  " (in 'string', line 1083, column 10 to column 63)",
  " (in 'string', line 1062, column 32 to line 1084, column 9)",
  " (in 'string', line 1062, column 8 to line 1084, column 9)",
  " (in 'string', line 1061, column 34 to line 1085, column 7)",
  " (in 'string', line 1061, column 6 to line 1119, column 7)",
  " (in 'string', line 1060, column 22 to line 1120, column 5)",
  " (in 'string', line 1060, column 4 to line 1167, column 5)",
  " (in 'string', line 1042, column 18 to line 1168, column 3)",
  " (in 'string', line 1042, column 2 to line 1168, column 3)",
  " (in 'string', line 1274, column 2 to column 12)",
  " (in 'string', line 1277, column 6 to column 93)",
  " (in 'string', line 1278, column 6 to column 13)",
  " (in 'string', line 1276, column 21 to line 1279, column 5)",
  " (in 'string', line 1276, column 4 to line 1279, column 5)",
  " (in 'string', line 1275, column 41 to line 1280, column 3)",
  " (in 'string', line 1275, column 2 to line 1280, column 3)",
  " (in 'string', line 1283, column 6 to line 1284, column 101)",
  " (in 'string', line 1287, column 8 to column 49)",
  " (in 'string', line 1286, column 6 to line 1287, column 49)",
  " (in 'string', line 1289, column 6 to column 13)",
  " (in 'string', line 1282, column 47 to line 1290, column 5)",
  " (in 'string', line 1282, column 4 to line 1290, column 5)",
  " (in 'string', line 1281, column 31 to line 1291, column 3)",
  " (in 'string', line 1281, column 2 to line 1291, column 3)",
  " (in 'string', line 1273, column 8 to line 1292, column 1)",
  " (in 'string', line 1273, column 0 to line 1292, column 1)",
  " (in 'string', line 1297, column 4 to column 125)",
  " (in 'string', line 1296, column 26 to line 1298, column 3)",
  " (in 'string', line 1296, column 2 to line 1298, column 3)",
  " (in 'string', line 1295, column 29 to line 1299, column 1)",
  " (in 'string', line 1295, column 0 to line 1299, column 1)",
  " (in 'string', line 1301, column 0 to column 43)",
  " (in 'string', line 1305, column 2 to column 12)",
  " (in 'string', line 1306, column 2 to column 9)",
  " (in 'string', line 1308, column 4 to column 28)",
  " (in 'string', line 1309, column 4 to line 1310, column 102)",
  " (in 'string', line 1311, column 4 to line 1312, column 123)",
  " (in 'string', line 1313, column 4 to column 12)",
  " (in 'string', line 1307, column 31 to line 1314, column 3)",
  " (in 'string', line 1307, column 2 to line 1314, column 3)",
  " (in 'string', line 1304, column 0 to line 1315, column 1)",
  " (in 'string', line 1318, column 14 to column 44)",
  " (in 'string', line 1318, column 2 to column 44)",
  " (in 'string', line 1319, column 18 to column 78)",
  " (in 'string', line 1319, column 2 to column 78)",
  " (in 'string', line 1322, column 27 to column 99)",
  " (in 'string', line 1322, column 2 to column 99)",
  " (in 'string', line 1325, column 56 to column 68)",
  " (in 'string', line 1325, column 2 to column 68)",
  " (in 'string', line 1326, column 17 to column 29)",
  " (in 'string', line 1326, column 2 to column 29)",
  " (in 'string', line 1328, column 4 to column 16)",
  " (in 'string', line 1329, column 4 to column 13)",
  " (in 'string', line 1327, column 17 to line 1330, column 3)",
  " (in 'string', line 1327, column 2 to line 1330, column 3)",
  " (in 'string', line 1332, column 19 to column 48)",
  " (in 'string', line 1332, column 2 to column 48)",
  " (in 'string', line 1176, column 0 to column 111)",
  " (in 'string', line 1182, column 4 to column 127)",
  " (in 'string', line 1185, column 4 to column 117)",
  " (in 'string', line 1180, column 9 to line 1186, column 1)",
  " (in 'string', line 1179, column 4 to column 90)",
  " (in 'string', line 1178, column 26 to line 1180, column 3)",
  " (in 'string', line 1178, column 2 to line 1186, column 1)",
  " (in 'string', line 1189, column 0 to column 89)",
  " (in 'string', line 1192, column 0 to column 90)",
  " (in 'string', line 1201, column 11 to column 21)",
  " (in 'string', line 1201, column 4 to column 29)",
  " (in 'string', line 1208, column 6 to column 27)",
  " (in 'string', line 1209, column 6 to column 28)",
  " (in 'string', line 1207, column 34 to line 1210, column 5)",
  " (in 'string', line 1207, column 9 to line 1210, column 5)",
  " (in 'string', line 1204, column 6 to column 26)",
  " (in 'string', line 1205, column 6 to column 25)",
  " (in 'string', line 1203, column 29 to line 1206, column 5)",
  " (in 'string', line 1203, column 4 to line 1210, column 5)",
  " (in 'string', line 1211, column 4 to column 94)",
  " (in 'string', line 1199, column 10 to line 1212, column 3)",
  " (in 'string', line 1199, column 9 to line 1212, column 4)",
  " (in 'string', line 1197, column 4 to column 92)",
  " (in 'string', line 1196, column 27 to line 1199, column 3)",
  " (in 'string', line 1196, column 2 to line 1212, column 4)",
  " (in 'string', line 1195, column 8 to line 1213, column 1)",
  " (in 'string', line 1195, column 0 to line 1213, column 1)",
  " (in 'string', line 1216, column 0 to column 23)",
  " (in 'string', line 1220, column 2 to column 74)",
  " (in 'string', line 1219, column 21 to line 1221, column 1)",
  " (in 'string', line 1219, column 0 to line 1221, column 1)",
  " (in 'string', line 1231, column 6 to column 42)",
  " (in 'string', line 1229, column 11 to line 1232, column 5)",
  " (in 'string', line 1228, column 6 to column 96)",
  " (in 'string', line 1226, column 26 to line 1229, column 5)",
  " (in 'string', line 1226, column 4 to line 1232, column 5)",
  " (in 'string', line 1225, column 22 to line 1233, column 3)",
  " (in 'string', line 1225, column 2 to line 1233, column 3)",
  " (in 'string', line 1224, column 19 to line 1234, column 1)",
  " (in 'string', line 1224, column 0 to line 1234, column 1)",
  " (in 'string', line 1237, column 0 to column 23)",
  " (in 'string', line 1239, column 14 to column 102)",
  " (in 'string', line 1239, column 2 to column 102)",
  " (in 'string', line 1240, column 16 to column 109)",
  " (in 'string', line 1240, column 2 to column 109)",
  " (in 'string', line 1242, column 24 to column 137)",
  " (in 'string', line 1242, column 2 to column 137)",
  " (in 'string', line 1243, column 26 to column 139)",
  " (in 'string', line 1243, column 2 to column 139)",
  " (in 'string', line 1245, column 2 to column 22)",
  " (in 'string', line 1247, column 2 to column 26)",
  " (in 'string', line 526, column 0 to column 20)",
  " (in 'string', line 527, column 0 to column 24)",
  " (in 'string', line 528, column 0 to column 29)",
  " (in 'string', line 530, column 0 to column 20)",
  " (in 'string', line 531, column 0 to column 24)",
  " (in 'string', line 532, column 0 to column 29)",
  " (in 'string', line 535, column 0 to column 22)",
  " (in 'string', line 536, column 6 to column 12)",
  " (in 'string', line 536, column 0 to column 35)",
  " (in 'string', line 537, column 6 to column 14)",
  " (in 'string', line 537, column 0 to column 37)",
  " (in 'string', line 538, column 0 to column 26)",
  " (in 'string', line 539, column 6 to column 18)",
  " (in 'string', line 539, column 0 to column 45)",
  " (in 'string', line 540, column 6 to column 21)",
  " (in 'string', line 540, column 0 to column 53)",
  " (in 'string', line 541, column 6 to column 21)",
  " (in 'string', line 541, column 0 to column 55)",
  " (in 'string', line 548, column 0 to column 16)",
  " (in 'string', line 549, column 0 to column 16)",
  " (in 'string', line 552, column 0 to column 21)",
  " (in 'string', line 553, column 0 to column 36)",
  " (in 'string', line 554, column 6 to column 13)",
  " (in 'string', line 554, column 0 to column 37)",
  " (in 'string', line 555, column 0 to column 22)",
  " (in 'string', line 556, column 0 to column 22)",
  " (in 'string', line 558, column 0 to column 18)",
  " (in 'string', line 561, column 7 to column 22)",
  " (in 'string', line 561, column 0 to column 39)",
  " (in 'string', line 562, column 11 to column 48)",
  " (in 'string', line 562, column 0 to column 69)",
  " (in 'string', line 565, column 0 to column 25)",
  " (in 'string', line 566, column 7 to column 57)",
  " (in 'string', line 566, column 59 to column 61)",
  " (in 'string', line 566, column 0 to column 65)",
  " (in 'string', line 567, column 7 to column 18)",
  " (in 'string', line 567, column 20 to column 31)",
  " (in 'string', line 567, column 0 to column 39)",
  " (in 'string', line 570, column 0 to column 33)",
  " (in 'string', line 571, column 7 to column 74)",
  " (in 'string', line 571, column 0 to column 84)",
  " (in 'string', line 574, column 0 to column 25)",
  " (in 'string', line 575, column 6 to column 56)",
  " (in 'string', line 575, column 0 to column 80)",
  " (in 'string', line 576, column 12 to column 34)",
  " (in 'string', line 576, column 0 to column 43)",
  " (in 'string', line 579, column 0 to column 32)",
  " (in 'string', line 582, column 0 to column 24)",
  " (in 'string', line 583, column 6 to column 16)",
  " (in 'string', line 583, column 0 to column 40)",
  " (in 'string', line 584, column 0 to column 13)",
  " (in 'string', line 587, column 0 to column 42)",
  " (in 'string', line 588, column 0 to column 30)",
  " (in 'string', line 589, column 0 to column 36)",
  " (in 'string', line 590, column 0 to column 33)",
  " (in 'string', line 592, column 0 to column 36)",
  " (in 'string', line 593, column 0 to column 24)",
  " (in 'string', line 594, column 0 to column 30)",
  " (in 'string', line 595, column 0 to column 27)",
  " (in 'string', line 597, column 0 to column 36)",
  " (in 'string', line 598, column 0 to column 36)",
  " (in 'string', line 599, column 0 to column 24)",
  " (in 'string', line 600, column 0 to column 30)",
  " (in 'string', line 601, column 0 to column 27)",
  " (in 'string', line 603, column 0 to column 36)",
  " (in 'string', line 604, column 0 to column 24)",
  " (in 'string', line 605, column 0 to column 30)",
  " (in 'string', line 606, column 0 to column 27)",
  " (in 'string', line 609, column 0 to column 36)",
  " (in 'string', line 610, column 6 to column 30)",
  " (in 'string', line 610, column 0 to column 54)",
  " (in 'string', line 611, column 6 to column 30)",
  " (in 'string', line 611, column 0 to column 57)",
  " (in 'string', line 613, column 0 to column 43)",
  " (in 'string', line 614, column 0 to column 31)",
  " (in 'string', line 615, column 0 to column 37)",
  " (in 'string', line 616, column 0 to column 34)",
  " (in 'string', line 618, column 0 to column 41)",
  " (in 'string', line 619, column 0 to column 29)",
  " (in 'string', line 620, column 0 to column 35)",
  " (in 'string', line 621, column 0 to column 32)",
  " (in 'string', line 623, column 2 to column 38)",
  " (in 'string', line 624, column 2 to column 26)",
  " (in 'string', line 625, column 2 to column 32)",
  " (in 'string', line 626, column 2 to column 29)",
  " (in 'string', line 628, column 2 to column 39)",
  " (in 'string', line 629, column 2 to column 27)",
  " (in 'string', line 630, column 2 to column 33)",
  " (in 'string', line 631, column 2 to column 30)",
  " (in 'string', line 633, column 2 to column 20)",
  " (in 'string', line 645, column 8 to column 18)",
  " (in 'string', line 645, column 2 to column 45)",
  " (in 'string', line 647, column 9 to column 15)",
  " (in 'string', line 647, column 2 to column 26)",
  " (in 'string', line 648, column 9 to column 15)",
  " (in 'string', line 648, column 2 to column 32)",
  " (in 'string', line 649, column 9 to column 15)",
  " (in 'string', line 649, column 2 to column 32)",
  " (in 'string', line 650, column 8 to column 14)",
  " (in 'string', line 650, column 2 to column 49)",
  " (in 'string', line 651, column 9 to column 19)",
  " (in 'string', line 651, column 2 to column 34)",
  " (in 'string', line 652, column 9 to column 19)",
  " (in 'string', line 652, column 2 to column 40)",
  " (in 'string', line 653, column 9 to column 19)",
  " (in 'string', line 653, column 2 to column 40)",
  " (in 'string', line 654, column 8 to column 18)",
  " (in 'string', line 654, column 2 to column 57)",
  " (in 'string', line 656, column 2 to column 32)",
  " (in 'string', line 658, column 8 to column 54)",
  " (in 'string', line 658, column 2 to column 76)",
  " (in 'string', line 659, column 8 to column 54)",
  " (in 'string', line 659, column 2 to column 79)",
  " (in 'string', line 661, column 2 to column 22)",
  " (in 'string', line 662, column 9 to column 55)",
  " (in 'string', line 662, column 57 to column 63)",
  " (in 'string', line 662, column 2 to column 71)",
  " (in 'string', line 663, column 2 to column 36)",
  " (in 'string', line 665, column 2 to column 42)",
  " (in 'string', line 666, column 2 to column 39)",
  " (in 'string', line 667, column 2 to column 36)",
  " (in 'string', line 668, column 2 to column 33)",
  " (in 'string', line 672, column 2 to column 66)",
  " (in 'string', line 674, column 2 to column 53)",
  " (in 'string', line 676, column 2 to column 39)",
  " (in 'string', line 677, column 2 to column 48)",
  " (in 'string', line 679, column 8 to column 18)",
  " (in 'string', line 679, column 2 to column 37)",
  " (in 'string', line 681, column 8 to column 14)",
  " (in 'string', line 681, column 2 to column 59)",
  " (in 'string', line 682, column 8 to column 43)",
  " (in 'string', line 682, column 2 to column 143)",
  " (in 'string', line 683, column 8 to column 14)",
  " (in 'string', line 683, column 2 to column 65)",
  " (in 'string', line 684, column 8 to column 43)",
  " (in 'string', line 684, column 2 to column 149)",
  " (in 'string', line 686, column 8 to column 50)",
  " (in 'string', line 686, column 2 to column 147)",
  " (in 'string', line 687, column 8 to column 50)",
  " (in 'string', line 687, column 52 to column 104)",
  " (in 'string', line 687, column 2 to column 127)",
  " (in 'string', line 688, column 8 to column 50)",
  " (in 'string', line 688, column 2 to column 155)",
  " (in 'string', line 689, column 8 to column 50)",
  " (in 'string', line 689, column 52 to column 108)",
  " (in 'string', line 689, column 2 to column 135)",
  " (in 'string', line 691, column 12 to column 18)",
  " (in 'string', line 691, column 2 to column 30)",
  " (in 'string', line 692, column 9 to column 15)",
  " (in 'string', line 692, column 17 to column 23)",
  " (in 'string', line 692, column 2 to column 74)",
  " (in 'string', line 693, column 9 to column 46)",
  " (in 'string', line 693, column 48 to column 54)",
  " (in 'string', line 693, column 2 to column 166)",
  " (in 'string', line 699, column 0 to column 54)",
  " (in 'string', line 703, column 0 to column 46)",
  " (in 'string', line 705, column 7 to column 14)",
  " (in 'string', line 705, column 0 to column 47)",
  " (in 'string', line 707, column 0 to column 21)",
  " (in 'string', line 708, column 21 to column 28)",
  " (in 'string', line 708, column 0 to column 84)",
  " (in 'string', line 710, column 0 to column 17)",
  " (in 'string', line 711, column 0 to column 21)",
  " (in 'string', line 712, column 0 to column 34)",
  " (in 'string', line 713, column 0 to column 58)",
  " (in 'string', line 714, column 7 to column 30)",
  " (in 'string', line 714, column 0 to column 81)",
  " (in 'string', line 715, column 6 to column 29)",
  " (in 'string', line 715, column 0 to column 85)",
  " (in 'string', line 716, column 6 to column 33)",
  " (in 'string', line 716, column 0 to column 90)",
  " (in 'string', line 722, column 0 to column 32)",
  " (in 'string', line 728, column 6 to column 47)",
  " (in 'string', line 728, column 0 to column 135)",
  " (in 'string', line 731, column 10 to column 12)",
  " (in 'string', line 731, column 0 to column 21)",
  " (in 'string', line 732, column 7 to column 13)",
  " (in 'string', line 732, column 15 to column 17)",
  " (in 'string', line 732, column 0 to column 57)",
  " (in 'string', line 733, column 7 to column 28)",
  " (in 'string', line 733, column 30 to column 32)",
  " (in 'string', line 733, column 0 to column 117)",
  " (in 'string', line 734, column 7 to column 33)",
  " (in 'string', line 734, column 35 to column 37)",
  " (in 'string', line 734, column 0 to column 176)",
  " (in 'string', line 737, column 0 to column 17)",
  " (in 'string', line 738, column 7 to column 40)",
  " (in 'string', line 738, column 0 to column 105)",
  " (in 'string', line 739, column 7 to column 59)",
  " (in 'string', line 739, column 0 to column 169)",
  " (in 'string', line 740, column 7 to column 69)",
  " (in 'string', line 740, column 0 to column 233)",
  " (in 'string', line 743, column 0 to column 72)",
  " (in 'string', line 746, column 7 to column 44)",
  " (in 'string', line 746, column 46 to column 83)",
  " (in 'string', line 746, column 0 to column 129)",
  " (in 'string', line 750, column 6 to column 21)",
  " (in 'string', line 750, column 0 to column 43)",
  " (in 'string', line 752, column 2 to column 12)",
  " (in 'string', line 753, column 2 to column 12)",
  " (in 'string', line 760, column 6 to column 13)",
  " (in 'string', line 759, column 11 to line 761, column 5)",
  " (in 'string', line 756, column 6 to column 29)",
  " (in 'string', line 757, column 6 to column 13)",
  " (in 'string', line 758, column 6 to column 12)",
  " (in 'string', line 755, column 41 to line 759, column 5)",
  " (in 'string', line 755, column 4 to line 761, column 5)",
  " (in 'string', line 754, column 37 to line 762, column 3)",
  " (in 'string', line 754, column 2 to line 762, column 3)",
  " (in 'string', line 764, column 2 to column 25)",
  " (in 'string', line 751, column 21 to line 765, column 1)",
  " (in 'string', line 751, column 0 to line 765, column 1)",
  " (in 'string', line 768, column 0 to column 63)",
  " (in 'string', line 769, column 6 to column 18)",
  " (in 'string', line 769, column 0 to column 63)",
  " (in 'string', line 772, column 0 to column 57)",
  " (in 'string', line 773, column 6 to column 30)",
  " (in 'string', line 773, column 0 to column 58)",
  " (in 'string', line 776, column 2 to column 16)",
  " (in 'string', line 783, column 6 to column 26)",
  " (in 'string', line 782, column 11 to line 784, column 5)",
  " (in 'string', line 780, column 6 to column 30)",
  " (in 'string', line 781, column 6 to column 17)",
  " (in 'string', line 779, column 28 to line 782, column 5)",
  " (in 'string', line 779, column 4 to line 784, column 5)",
  " (in 'string', line 778, column 24 to line 785, column 3)",
  " (in 'string', line 778, column 2 to line 785, column 3)",
  " (in 'string', line 775, column 19 to line 786, column 1)",
  " (in 'string', line 775, column 0 to line 786, column 1)",
  " (in 'string', line 787, column 26 to column 70)",
  " (in 'string', line 787, column 2 to column 70)",
  " (in 'string', line 789, column 29 to column 98)",
  " (in 'string', line 789, column 4 to column 98)",
  " (in 'string', line 790, column 33 to column 114)",
  " (in 'string', line 790, column 4 to column 114)",
  " (in 'string', line 788, column 55 to line 791, column 3)",
  " (in 'string', line 788, column 30 to line 791, column 3)",
  " (in 'string', line 788, column 2 to line 791, column 3)",
  " (in 'string', line 797, column 7 to column 9)",
  " (in 'string', line 800, column 7 to column 14)",
  " (in 'string', line 801, column 18 to column 28)",
  " (in 'string', line 804, column 7 to column 40)",
  " (in 'string', line 805, column 16 to column 52)",
  " (in 'string', line 808, column 7 to column 39)",
  " (in 'string', line 811, column 18 to column 23)",
  " (in 'string', line 813, column 18 to column 32)",
  " (in 'string', line 815, column 9 to column 28)",
  " (in 'string', line 815, column 30 to column 47)",
  " (in 'string', line 819, column 9 to column 15)",
  " (in 'string', line 820, column 9 to column 19)",
  " (in 'string', line 825, column 7 to column 13)",
  " (in 'string', line 830, column 7 to column 14)",
  " (in 'string', line 838, column 7 to column 44)",
  " (in 'string', line 841, column 7 to column 9)",
  " (in 'string', line 843, column 7 to column 12)",
  " (in 'string', line 845, column 7 to column 13)",
  " (in 'string', line 847, column 7 to column 16)",
  " (in 'string', line 849, column 7 to column 40)",
  " (in 'string', line 854, column 7 to column 48)",
  " (in 'string', line 855, column 7 to column 22)",
  " (in 'string', line 1252, column 9 to column 71)",
  " (in 'string', line 1253, column 9 to column 30)",
  " (in 'string', line 1254, column 9 to column 30)",
  " (in 'string', line 1255, column 9 to column 30)",
  " (in 'string', line 1257, column 9 to column 31)",
  " (in 'string', line 1257, column 34 to column 51)",
  " (in 'string', line 1262, column 7 to column 44)",
  " (in 'string', line 1263, column 7 to column 44)",
  " (in 'string', line 1264, column 7 to column 22)",
  " (in 'string', line 1267, column 9 to column 37)",
  " (in 'string', line 1271, column 7 to column 14)",
  " (in 'string', line 21, column 4 to column 42)",
  " (in 'string', line 20, column 9 to line 22, column 3)",
  " (in 'string', line 18, column 4 to column 44)",
  " (in 'string', line 19, column 4 to column 22)",
  " (in 'string', line 17, column 24 to line 20, column 3)",
  " (in 'string', line 17, column 9 to line 22, column 3)",
  " (in 'string', line 16, column 4 to column 35)",
  " (in 'string', line 15, column 24 to line 17, column 3)",
  " (in 'string', line 15, column 9 to line 22, column 3)",
  " (in 'string', line 14, column 4 to column 29)",
  " (in 'string', line 13, column 24 to line 15, column 3)",
  " (in 'string', line 13, column 9 to line 22, column 3)",
  " (in 'string', line 12, column 4 to column 39)",
  " (in 'string', line 11, column 24 to line 13, column 3)",
  " (in 'string', line 11, column 9 to line 22, column 3)",
  " (in 'string', line 10, column 4 to column 32)",
  " (in 'string', line 9, column 24 to line 11, column 3)",
  " (in 'string', line 9, column 9 to line 22, column 3)",
  " (in 'string', line 8, column 4 to column 32)",
  " (in 'string', line 7, column 24 to line 9, column 3)",
  " (in 'string', line 7, column 9 to line 22, column 3)",
  " (in 'string', line 5, column 17 to line 7, column 3)",
  " (in 'string', line 5, column 2 to line 22, column 3)",
  " (in 'string', line 23, column 2 to column 9)",
  " (in 'string', line 4, column 77 to line 24, column 1)",
  " (in 'string', line 43, column 4 to column 42)",
  " (in 'string', line 42, column 9 to line 44, column 3)",
  " (in 'string', line 40, column 4 to column 44)",
  " (in 'string', line 41, column 4 to column 22)",
  " (in 'string', line 39, column 24 to line 42, column 3)",
  " (in 'string', line 39, column 9 to line 44, column 3)",
  " (in 'string', line 38, column 4 to column 35)",
  " (in 'string', line 37, column 24 to line 39, column 3)",
  " (in 'string', line 37, column 9 to line 44, column 3)",
  " (in 'string', line 36, column 4 to column 29)",
  " (in 'string', line 35, column 24 to line 37, column 3)",
  " (in 'string', line 35, column 9 to line 44, column 3)",
  " (in 'string', line 34, column 4 to column 39)",
  " (in 'string', line 33, column 24 to line 35, column 3)",
  " (in 'string', line 33, column 9 to line 44, column 3)",
  " (in 'string', line 32, column 4 to column 32)",
  " (in 'string', line 31, column 24 to line 33, column 3)",
  " (in 'string', line 31, column 9 to line 44, column 3)",
  " (in 'string', line 30, column 4 to column 32)",
  " (in 'string', line 29, column 24 to line 31, column 3)",
  " (in 'string', line 29, column 9 to line 44, column 3)",
  " (in 'string', line 27, column 17 to line 29, column 3)",
  " (in 'string', line 27, column 2 to line 44, column 3)",
  " (in 'string', line 45, column 2 to column 9)",
  " (in 'string', line 26, column 76 to line 46, column 1)",
  " (in 'string', line 51, column 2 to column 18)",
  " (in 'string', line 52, column 2 to column 18)",
  " (in 'string', line 53, column 2 to column 12)",
  " (in 'string', line 56, column 23 to column 30)",
  " (in 'string', line 56, column 6 to column 30)",
  " (in 'string', line 55, column 19 to line 57, column 5)",
  " (in 'string', line 55, column 4 to line 57, column 5)",
  " (in 'string', line 54, column 17 to line 58, column 3)",
  " (in 'string', line 54, column 2 to line 58, column 3)",
  " (in 'string', line 59, column 2 to column 11)",
  " (in 'string', line 50, column 28 to line 60, column 1)",
  " (in 'string', line 64, column 2 to column 26)",
  " (in 'string', line 65, column 8 to column 9)",
  " (in 'string', line 65, column 2 to column 17)",
  " (in 'string', line 66, column 2 to column 12)",
  " (in 'string', line 69, column 6 to column 15)",
  " (in 'string', line 70, column 6 to column 13)",
  " (in 'string', line 68, column 18 to line 71, column 5)",
  " (in 'string', line 68, column 4 to line 71, column 5)",
  " (in 'string', line 67, column 17 to line 72, column 3)",
  " (in 'string', line 67, column 2 to line 72, column 3)",
  " (in 'string', line 73, column 2 to column 20)",
  " (in 'string', line 63, column 38 to line 74, column 1)",
  " (in 'string', line 80, column 2 to column 26)",
  " (in 'string', line 81, column 8 to column 9)",
  " (in 'string', line 81, column 2 to column 17)",
  " (in 'string', line 82, column 2 to column 12)",
  " (in 'string', line 85, column 6 to column 15)",
  " (in 'string', line 86, column 6 to column 13)",
  " (in 'string', line 84, column 19 to line 87, column 5)",
  " (in 'string', line 84, column 4 to line 87, column 5)",
  " (in 'string', line 83, column 17 to line 88, column 3)",
  " (in 'string', line 83, column 2 to line 88, column 3)",
  " (in 'string', line 89, column 2 to column 20)",
  " (in 'string', line 79, column 40 to line 90, column 1)",
  " (in 'string', line 94, column 2 to column 12)",
  " (in 'string', line 96, column 19 to column 26)",
  " (in 'string', line 96, column 4 to column 26)",
  " (in 'string', line 95, column 31 to line 97, column 3)",
  " (in 'string', line 95, column 2 to line 97, column 3)",
  " (in 'string', line 98, column 2 to column 11)",
  " (in 'string', line 93, column 33 to line 99, column 1)",
  " (in 'string', line 102, column 8 to column 14)",
  " (in 'string', line 102, column 2 to column 45)",
  " (in 'string', line 104, column 14 to column 27)",
  " (in 'string', line 104, column 4 to column 27)",
  " (in 'string', line 103, column 31 to line 105, column 3)",
  " (in 'string', line 103, column 2 to line 105, column 3)",
  " (in 'string', line 106, column 2 to column 11)",
  " (in 'string', line 101, column 50 to line 107, column 1)",
  " (in 'string', line 111, column 2 to column 26)",
  " (in 'string', line 112, column 8 to column 9)",
  " (in 'string', line 112, column 2 to column 17)",
  " (in 'string', line 113, column 2 to column 12)",
  " (in 'string', line 116, column 6 to column 15)",
  " (in 'string', line 117, column 6 to column 13)",
  " (in 'string', line 115, column 18 to line 118, column 5)",
  " (in 'string', line 115, column 4 to line 118, column 5)",
  " (in 'string', line 114, column 17 to line 119, column 3)",
  " (in 'string', line 114, column 2 to line 119, column 3)",
  " (in 'string', line 120, column 2 to column 20)",
  " (in 'string', line 110, column 32 to line 121, column 1)",
  " (in 'string', line 125, column 3 to column 25)",
  " (in 'string', line 126, column 3 to column 38)",
  " (in 'string', line 127, column 3 to column 91)",
  " (in 'string', line 123, column 58 to line 128, column 3)",
  " (in 'string', line 133, column 4 to column 28)",
  " (in 'string', line 134, column 11 to column 12)",
  " (in 'string', line 134, column 4 to column 18)",
  " (in 'string', line 155, column 13 to column 14)",
  " (in 'string', line 155, column 6 to column 36)",
  " (in 'string', line 156, column 13 to column 14)",
  " (in 'string', line 156, column 6 to column 60)",
  " (in 'string', line 157, column 6 to column 36)",
  " (in 'string', line 154, column 26 to line 158, column 5)",
  " (in 'string', line 154, column 11 to line 158, column 5)",
  " (in 'string', line 152, column 13 to column 14)",
  " (in 'string', line 152, column 6 to column 33)",
  " (in 'string', line 153, column 21 to column 66)",
  " (in 'string', line 153, column 6 to column 66)",
  " (in 'string', line 151, column 26 to line 154, column 5)",
  " (in 'string', line 151, column 11 to line 158, column 5)",
  " (in 'string', line 150, column 6 to column 44)",
  " (in 'string', line 149, column 26 to line 151, column 5)",
  " (in 'string', line 149, column 11 to line 158, column 5)",
  " (in 'string', line 148, column 21 to column 69)",
  " (in 'string', line 148, column 6 to column 69)",
  " (in 'string', line 145, column 26 to line 149, column 5)",
  " (in 'string', line 145, column 11 to line 158, column 5)",
  " (in 'string', line 144, column 6 to column 45)",
  " (in 'string', line 143, column 26 to line 145, column 5)",
  " (in 'string', line 143, column 11 to line 158, column 5)",
  " (in 'string', line 142, column 6 to column 28)",
  " (in 'string', line 141, column 26 to line 143, column 5)",
  " (in 'string', line 141, column 11 to line 158, column 5)",
  " (in 'string', line 140, column 6 to column 46)",
  " (in 'string', line 139, column 26 to line 141, column 5)",
  " (in 'string', line 139, column 11 to line 158, column 5)",
  " (in 'string', line 138, column 6 to column 37)",
  " (in 'string', line 137, column 26 to line 139, column 5)",
  " (in 'string', line 137, column 11 to line 158, column 5)",
  " (in 'string', line 136, column 6 to column 27)",
  " (in 'string', line 135, column 19 to line 137, column 5)",
  " (in 'string', line 135, column 4 to line 158, column 5)",
  " (in 'string', line 159, column 4 to column 15)",
  " (in 'string', line 130, column 69 to line 160, column 3)",
  " (in 'string', line 165, column 4 to column 28)",
  " (in 'string', line 166, column 11 to column 12)",
  " (in 'string', line 166, column 4 to column 18)",
  " (in 'string', line 187, column 6 to column 31)",
  " (in 'string', line 188, column 13 to column 14)",
  " (in 'string', line 188, column 6 to column 57)",
  " (in 'string', line 189, column 6 to column 36)",
  " (in 'string', line 186, column 26 to line 190, column 5)",
  " (in 'string', line 186, column 11 to line 190, column 5)",
  " (in 'string', line 184, column 13 to column 14)",
  " (in 'string', line 184, column 6 to column 33)",
  " (in 'string', line 185, column 21 to column 63)",
  " (in 'string', line 185, column 6 to column 63)",
  " (in 'string', line 183, column 26 to line 186, column 5)",
  " (in 'string', line 183, column 11 to line 190, column 5)",
  " (in 'string', line 182, column 6 to column 44)",
  " (in 'string', line 181, column 26 to line 183, column 5)",
  " (in 'string', line 181, column 11 to line 190, column 5)",
  " (in 'string', line 180, column 21 to column 66)",
  " (in 'string', line 180, column 6 to column 66)",
  " (in 'string', line 177, column 26 to line 181, column 5)",
  " (in 'string', line 177, column 11 to line 190, column 5)",
  " (in 'string', line 176, column 6 to column 44)",
  " (in 'string', line 175, column 26 to line 177, column 5)",
  " (in 'string', line 175, column 11 to line 190, column 5)",
  " (in 'string', line 174, column 6 to column 28)",
  " (in 'string', line 173, column 26 to line 175, column 5)",
  " (in 'string', line 173, column 11 to line 190, column 5)",
  " (in 'string', line 172, column 6 to column 44)",
  " (in 'string', line 171, column 26 to line 173, column 5)",
  " (in 'string', line 171, column 11 to line 190, column 5)",
  " (in 'string', line 170, column 6 to column 37)",
  " (in 'string', line 169, column 26 to line 171, column 5)",
  " (in 'string', line 169, column 11 to line 190, column 5)",
  " (in 'string', line 168, column 6 to column 27)",
  " (in 'string', line 167, column 19 to line 169, column 5)",
  " (in 'string', line 167, column 4 to line 190, column 5)",
  " (in 'string', line 191, column 4 to column 15)",
  " (in 'string', line 162, column 66 to line 192, column 3)",
  " (in 'string', line 197, column 4 to column 30)",
  " (in 'string', line 198, column 11 to column 12)",
  " (in 'string', line 198, column 4 to column 18)",
  " (in 'string', line 219, column 6 to column 31)",
  " (in 'string', line 220, column 13 to column 14)",
  " (in 'string', line 220, column 6 to column 57)",
  " (in 'string', line 221, column 6 to column 36)",
  " (in 'string', line 218, column 26 to line 222, column 5)",
  " (in 'string', line 218, column 11 to line 222, column 5)",
  " (in 'string', line 216, column 13 to column 14)",
  " (in 'string', line 216, column 6 to column 33)",
  " (in 'string', line 217, column 21 to column 60)",
  " (in 'string', line 217, column 6 to column 60)",
  " (in 'string', line 215, column 26 to line 218, column 5)",
  " (in 'string', line 215, column 11 to line 222, column 5)",
  " (in 'string', line 214, column 6 to column 44)",
  " (in 'string', line 213, column 26 to line 215, column 5)",
  " (in 'string', line 213, column 11 to line 222, column 5)",
  " (in 'string', line 212, column 21 to column 63)",
  " (in 'string', line 212, column 6 to column 63)",
  " (in 'string', line 209, column 26 to line 213, column 5)",
  " (in 'string', line 209, column 11 to line 222, column 5)",
  " (in 'string', line 208, column 6 to column 43)",
  " (in 'string', line 207, column 26 to line 209, column 5)",
  " (in 'string', line 207, column 11 to line 222, column 5)",
  " (in 'string', line 206, column 6 to column 27)",
  " (in 'string', line 205, column 26 to line 207, column 5)",
  " (in 'string', line 205, column 11 to line 222, column 5)",
  " (in 'string', line 204, column 6 to column 43)",
  " (in 'string', line 203, column 26 to line 205, column 5)",
  " (in 'string', line 203, column 11 to line 222, column 5)",
  " (in 'string', line 202, column 6 to column 36)",
  " (in 'string', line 201, column 26 to line 203, column 5)",
  " (in 'string', line 201, column 11 to line 222, column 5)",
  " (in 'string', line 200, column 6 to column 26)",
  " (in 'string', line 199, column 19 to line 201, column 5)",
  " (in 'string', line 199, column 4 to line 222, column 5)",
  " (in 'string', line 223, column 4 to column 15)",
  " (in 'string', line 194, column 65 to line 224, column 3)",
  " (in 'string', line 229, column 4 to column 30)",
  " (in 'string', line 230, column 11 to column 12)",
  " (in 'string', line 230, column 4 to column 18)",
  " (in 'string', line 251, column 13 to column 14)",
  " (in 'string', line 251, column 6 to column 36)",
  " (in 'string', line 252, column 13 to column 14)",
  " (in 'string', line 252, column 6 to column 60)",
  " (in 'string', line 253, column 6 to column 36)",
  " (in 'string', line 250, column 26 to line 254, column 5)",
  " (in 'string', line 250, column 11 to line 254, column 5)",
  " (in 'string', line 248, column 13 to column 14)",
  " (in 'string', line 248, column 6 to column 33)",
  " (in 'string', line 249, column 21 to column 63)",
  " (in 'string', line 249, column 6 to column 63)",
  " (in 'string', line 247, column 26 to line 250, column 5)",
  " (in 'string', line 247, column 11 to line 254, column 5)",
  " (in 'string', line 246, column 6 to column 44)",
  " (in 'string', line 245, column 26 to line 247, column 5)",
  " (in 'string', line 245, column 11 to line 254, column 5)",
  " (in 'string', line 244, column 21 to column 66)",
  " (in 'string', line 244, column 6 to column 66)",
  " (in 'string', line 241, column 26 to line 245, column 5)",
  " (in 'string', line 241, column 11 to line 254, column 5)",
  " (in 'string', line 240, column 6 to column 45)",
  " (in 'string', line 239, column 26 to line 241, column 5)",
  " (in 'string', line 239, column 11 to line 254, column 5)",
  " (in 'string', line 238, column 6 to column 27)",
  " (in 'string', line 237, column 26 to line 239, column 5)",
  " (in 'string', line 237, column 11 to line 254, column 5)",
  " (in 'string', line 236, column 6 to column 45)",
  " (in 'string', line 235, column 26 to line 237, column 5)",
  " (in 'string', line 235, column 11 to line 254, column 5)",
  " (in 'string', line 234, column 6 to column 37)",
  " (in 'string', line 233, column 26 to line 235, column 5)",
  " (in 'string', line 233, column 11 to line 254, column 5)",
  " (in 'string', line 232, column 6 to column 26)",
  " (in 'string', line 231, column 19 to line 233, column 5)",
  " (in 'string', line 231, column 4 to line 254, column 5)",
  " (in 'string', line 255, column 4 to column 15)",
  " (in 'string', line 226, column 70 to line 256, column 3)",
  " (in 'string', line 261, column 4 to column 28)",
  " (in 'string', line 262, column 11 to column 12)",
  " (in 'string', line 262, column 4 to column 18)",
  " (in 'string', line 282, column 26 to line 284, column 5)",
  " (in 'string', line 282, column 11 to line 284, column 5)",
  " (in 'string', line 280, column 13 to column 14)",
  " (in 'string', line 280, column 6 to column 33)",
  " (in 'string', line 281, column 21 to column 103)",
  " (in 'string', line 281, column 6 to column 103)",
  " (in 'string', line 279, column 26 to line 282, column 5)",
  " (in 'string', line 279, column 11 to line 284, column 5)",
  " (in 'string', line 278, column 6 to column 88)",
  " (in 'string', line 277, column 26 to line 279, column 5)",
  " (in 'string', line 277, column 11 to line 284, column 5)",
  " (in 'string', line 276, column 21 to column 109)",
  " (in 'string', line 276, column 6 to column 109)",
  " (in 'string', line 273, column 26 to line 277, column 5)",
  " (in 'string', line 273, column 11 to line 284, column 5)",
  " (in 'string', line 272, column 6 to column 60)",
  " (in 'string', line 271, column 26 to line 273, column 5)",
  " (in 'string', line 271, column 11 to line 284, column 5)",
  " (in 'string', line 270, column 6 to column 17)",
  " (in 'string', line 269, column 26 to line 271, column 5)",
  " (in 'string', line 269, column 11 to line 284, column 5)",
  " (in 'string', line 268, column 6 to column 29)",
  " (in 'string', line 267, column 26 to line 269, column 5)",
  " (in 'string', line 267, column 11 to line 284, column 5)",
  " (in 'string', line 266, column 6 to column 51)",
  " (in 'string', line 265, column 26 to line 267, column 5)",
  " (in 'string', line 265, column 11 to line 284, column 5)",
  " (in 'string', line 264, column 6 to column 16)",
  " (in 'string', line 263, column 19 to line 265, column 5)",
  " (in 'string', line 263, column 4 to line 284, column 5)",
  " (in 'string', line 285, column 4 to column 15)",
  " (in 'string', line 258, column 69 to line 286, column 3)",
  " (in 'string', line 291, column 4 to column 28)",
  " (in 'string', line 292, column 11 to column 12)",
  " (in 'string', line 292, column 4 to column 18)",
  " (in 'string', line 312, column 26 to line 314, column 5)",
  " (in 'string', line 312, column 11 to line 314, column 5)",
  " (in 'string', line 310, column 13 to column 14)",
  " (in 'string', line 310, column 6 to column 33)",
  " (in 'string', line 311, column 21 to column 97)",
  " (in 'string', line 311, column 6 to column 97)",
  " (in 'string', line 309, column 26 to line 312, column 5)",
  " (in 'string', line 309, column 11 to line 314, column 5)",
  " (in 'string', line 308, column 6 to column 87)",
  " (in 'string', line 307, column 26 to line 309, column 5)",
  " (in 'string', line 307, column 11 to line 314, column 5)",
  " (in 'string', line 306, column 21 to column 103)",
  " (in 'string', line 306, column 6 to column 103)",
  " (in 'string', line 303, column 26 to line 307, column 5)",
  " (in 'string', line 303, column 11 to line 314, column 5)",
  " (in 'string', line 302, column 6 to column 59)",
  " (in 'string', line 301, column 26 to line 303, column 5)",
  " (in 'string', line 301, column 11 to line 314, column 5)",
  " (in 'string', line 300, column 6 to column 17)",
  " (in 'string', line 299, column 26 to line 301, column 5)",
  " (in 'string', line 299, column 11 to line 314, column 5)",
  " (in 'string', line 298, column 6 to column 28)",
  " (in 'string', line 297, column 26 to line 299, column 5)",
  " (in 'string', line 297, column 11 to line 314, column 5)",
  " (in 'string', line 296, column 6 to column 51)",
  " (in 'string', line 295, column 26 to line 297, column 5)",
  " (in 'string', line 295, column 11 to line 314, column 5)",
  " (in 'string', line 294, column 6 to column 16)",
  " (in 'string', line 293, column 19 to line 295, column 5)",
  " (in 'string', line 293, column 4 to line 314, column 5)",
  " (in 'string', line 315, column 4 to column 15)",
  " (in 'string', line 288, column 66 to line 316, column 3)",
  " (in 'string', line 321, column 4 to column 30)",
  " (in 'string', line 322, column 11 to column 12)",
  " (in 'string', line 322, column 4 to column 18)",
  " (in 'string', line 342, column 26 to line 344, column 5)",
  " (in 'string', line 342, column 11 to line 344, column 5)",
  " (in 'string', line 340, column 13 to column 14)",
  " (in 'string', line 340, column 6 to column 33)",
  " (in 'string', line 341, column 21 to column 91)",
  " (in 'string', line 341, column 6 to column 91)",
  " (in 'string', line 339, column 26 to line 342, column 5)",
  " (in 'string', line 339, column 11 to line 344, column 5)",
  " (in 'string', line 338, column 6 to column 87)",
  " (in 'string', line 337, column 26 to line 339, column 5)",
  " (in 'string', line 337, column 11 to line 344, column 5)",
  " (in 'string', line 336, column 21 to column 96)",
  " (in 'string', line 336, column 6 to column 96)",
  " (in 'string', line 333, column 26 to line 337, column 5)",
  " (in 'string', line 333, column 11 to line 344, column 5)",
  " (in 'string', line 332, column 6 to column 59)",
  " (in 'string', line 331, column 26 to line 333, column 5)",
  " (in 'string', line 331, column 11 to line 344, column 5)",
  " (in 'string', line 330, column 6 to column 17)",
  " (in 'string', line 329, column 26 to line 331, column 5)",
  " (in 'string', line 329, column 11 to line 344, column 5)",
  " (in 'string', line 328, column 6 to column 28)",
  " (in 'string', line 327, column 26 to line 329, column 5)",
  " (in 'string', line 327, column 11 to line 344, column 5)",
  " (in 'string', line 326, column 6 to column 51)",
  " (in 'string', line 325, column 26 to line 327, column 5)",
  " (in 'string', line 325, column 11 to line 344, column 5)",
  " (in 'string', line 324, column 6 to column 16)",
  " (in 'string', line 323, column 19 to line 325, column 5)",
  " (in 'string', line 323, column 4 to line 344, column 5)",
  " (in 'string', line 345, column 4 to column 15)",
  " (in 'string', line 318, column 65 to line 346, column 3)",
  " (in 'string', line 351, column 4 to column 30)",
  " (in 'string', line 352, column 11 to column 12)",
  " (in 'string', line 352, column 4 to column 18)",
  " (in 'string', line 372, column 26 to line 374, column 5)",
  " (in 'string', line 372, column 11 to line 374, column 5)",
  " (in 'string', line 370, column 13 to column 14)",
  " (in 'string', line 370, column 6 to column 33)",
  " (in 'string', line 371, column 21 to column 97)",
  " (in 'string', line 371, column 6 to column 97)",
  " (in 'string', line 369, column 26 to line 372, column 5)",
  " (in 'string', line 369, column 11 to line 374, column 5)",
  " (in 'string', line 368, column 6 to column 88)",
  " (in 'string', line 367, column 26 to line 369, column 5)",
  " (in 'string', line 367, column 11 to line 374, column 5)",
  " (in 'string', line 366, column 21 to column 102)",
  " (in 'string', line 366, column 6 to column 102)",
  " (in 'string', line 363, column 26 to line 367, column 5)",
  " (in 'string', line 363, column 11 to line 374, column 5)",
  " (in 'string', line 362, column 6 to column 60)",
  " (in 'string', line 361, column 26 to line 363, column 5)",
  " (in 'string', line 361, column 11 to line 374, column 5)",
  " (in 'string', line 360, column 6 to column 17)",
  " (in 'string', line 359, column 26 to line 361, column 5)",
  " (in 'string', line 359, column 11 to line 374, column 5)",
  " (in 'string', line 358, column 6 to column 28)",
  " (in 'string', line 357, column 26 to line 359, column 5)",
  " (in 'string', line 357, column 11 to line 374, column 5)",
  " (in 'string', line 356, column 6 to column 51)",
  " (in 'string', line 355, column 26 to line 357, column 5)",
  " (in 'string', line 355, column 11 to line 374, column 5)",
  " (in 'string', line 354, column 6 to column 16)",
  " (in 'string', line 353, column 19 to line 355, column 5)",
  " (in 'string', line 353, column 4 to line 374, column 5)",
  " (in 'string', line 375, column 4 to column 15)",
  " (in 'string', line 348, column 70 to line 376, column 3)",
  " (in 'string', line 379, column 4 to column 30)",
  " (in 'string', line 380, column 11 to column 12)",
  " (in 'string', line 380, column 4 to column 16)",
  " (in 'string', line 382, column 4 to column 44)",
  " (in 'string', line 383, column 4 to column 70)",
  " (in 'string', line 384, column 10 to column 13)",
  " (in 'string', line 384, column 4 to column 22)",
  " (in 'string', line 385, column 10 to column 15)",
  " (in 'string', line 385, column 4 to column 24)",
  " (in 'string', line 386, column 10 to column 15)",
  " (in 'string', line 386, column 4 to column 24)",
  " (in 'string', line 387, column 10 to column 15)",
  " (in 'string', line 387, column 4 to column 24)",
  " (in 'string', line 388, column 4 to column 49)",
  " (in 'string', line 389, column 10 to column 12)",
  " (in 'string', line 389, column 4 to column 21)",
  " (in 'string', line 390, column 13 to column 35)",
  " (in 'string', line 390, column 4 to column 35)",
  " (in 'string', line 391, column 15 to column 37)",
  " (in 'string', line 391, column 4 to column 37)",
  " (in 'string', line 392, column 15 to column 37)",
  " (in 'string', line 392, column 4 to column 37)",
  " (in 'string', line 393, column 15 to column 37)",
  " (in 'string', line 393, column 4 to column 37)",
  " (in 'string', line 394, column 12 to column 39)",
  " (in 'string', line 394, column 4 to column 39)",
  " (in 'string', line 405, column 6 to column 41)",
  " (in 'string', line 407, column 6 to column 62)",
  " (in 'string', line 403, column 11 to line 408, column 5)",
  " (in 'string', line 398, column 6 to column 61)",
  " (in 'string', line 400, column 56 to column 104)",
  " (in 'string', line 400, column 36 to column 104)",
  " (in 'string', line 400, column 21 to column 104)",
  " (in 'string', line 400, column 6 to column 104)",
  " (in 'string', line 401, column 56 to column 106)",
  " (in 'string', line 401, column 36 to column 106)",
  " (in 'string', line 401, column 21 to column 106)",
  " (in 'string', line 401, column 6 to column 106)",
  " (in 'string', line 402, column 56 to column 112)",
  " (in 'string', line 402, column 36 to column 112)",
  " (in 'string', line 402, column 21 to column 112)",
  " (in 'string', line 402, column 6 to column 112)",
  " (in 'string', line 396, column 45 to line 403, column 5)",
  " (in 'string', line 396, column 4 to line 408, column 5)",
  " (in 'string', line 410, column 4 to column 29)",
  " (in 'string', line 414, column 4 to column 86)",
  " (in 'string', line 416, column 4 to column 66)",
  " (in 'string', line 417, column 4 to column 13)",
  " (in 'string', line 378, column 134 to line 418, column 3)",
  " (in 'string', line 421, column 4 to column 30)",
  " (in 'string', line 422, column 11 to column 12)",
  " (in 'string', line 422, column 4 to column 16)",
  " (in 'string', line 424, column 4 to column 44)",
  " (in 'string', line 425, column 4 to column 70)",
  " (in 'string', line 426, column 10 to column 13)",
  " (in 'string', line 426, column 4 to column 22)",
  " (in 'string', line 427, column 10 to column 15)",
  " (in 'string', line 427, column 4 to column 24)",
  " (in 'string', line 428, column 10 to column 15)",
  " (in 'string', line 428, column 4 to column 24)",
  " (in 'string', line 429, column 10 to column 15)",
  " (in 'string', line 429, column 4 to column 24)",
  " (in 'string', line 430, column 4 to column 49)",
  " (in 'string', line 431, column 10 to column 12)",
  " (in 'string', line 431, column 4 to column 21)",
  " (in 'string', line 432, column 13 to column 35)",
  " (in 'string', line 432, column 4 to column 35)",
  " (in 'string', line 433, column 15 to column 37)",
  " (in 'string', line 433, column 4 to column 37)",
  " (in 'string', line 434, column 15 to column 37)",
  " (in 'string', line 434, column 4 to column 37)",
  " (in 'string', line 435, column 15 to column 37)",
  " (in 'string', line 435, column 4 to column 37)",
  " (in 'string', line 436, column 12 to column 39)",
  " (in 'string', line 436, column 4 to column 39)",
  " (in 'string', line 447, column 6 to column 42)",
  " (in 'string', line 449, column 6 to column 55)",
  " (in 'string', line 445, column 11 to line 450, column 5)",
  " (in 'string', line 440, column 6 to column 54)",
  " (in 'string', line 442, column 56 to column 101)",
  " (in 'string', line 442, column 36 to column 101)",
  " (in 'string', line 442, column 21 to column 101)",
  " (in 'string', line 442, column 6 to column 101)",
  " (in 'string', line 443, column 56 to column 103)",
  " (in 'string', line 443, column 36 to column 103)",
  " (in 'string', line 443, column 21 to column 103)",
  " (in 'string', line 443, column 6 to column 103)",
  " (in 'string', line 444, column 56 to column 106)",
  " (in 'string', line 444, column 36 to column 106)",
  " (in 'string', line 444, column 21 to column 106)",
  " (in 'string', line 444, column 6 to column 106)",
  " (in 'string', line 438, column 45 to line 445, column 5)",
  " (in 'string', line 438, column 4 to line 450, column 5)",
  " (in 'string', line 452, column 4 to column 29)",
  " (in 'string', line 456, column 4 to column 79)",
  " (in 'string', line 458, column 4 to column 59)",
  " (in 'string', line 459, column 4 to column 13)",
  " (in 'string', line 420, column 131 to line 460, column 3)",
  " (in 'string', line 463, column 4 to column 30)",
  " (in 'string', line 464, column 11 to column 12)",
  " (in 'string', line 464, column 4 to column 16)",
  " (in 'string', line 482, column 6 to column 97)",
  " (in 'string', line 481, column 28 to line 484, column 5)",
  " (in 'string', line 481, column 11 to line 484, column 5)",
  " (in 'string', line 480, column 6 to column 54)",
  " (in 'string', line 479, column 28 to line 481, column 5)",
  " (in 'string', line 479, column 11 to line 484, column 5)",
  " (in 'string', line 477, column 8 to column 80)",
  " (in 'string', line 476, column 13 to line 478, column 7)",
  " (in 'string', line 475, column 23 to column 70)",
  " (in 'string', line 475, column 8 to column 70)",
  " (in 'string', line 474, column 28 to line 476, column 7)",
  " (in 'string', line 474, column 13 to line 478, column 7)",
  " (in 'string', line 472, column 15 to column 16)",
  " (in 'string', line 472, column 8 to column 35)",
  " (in 'string', line 473, column 23 to column 62)",
  " (in 'string', line 473, column 8 to column 62)",
  " (in 'string', line 471, column 28 to line 474, column 7)",
  " (in 'string', line 471, column 13 to line 478, column 7)",
  " (in 'string', line 470, column 23 to column 65)",
  " (in 'string', line 470, column 8 to column 65)",
  " (in 'string', line 469, column 21 to line 471, column 7)",
  " (in 'string', line 469, column 6 to line 478, column 7)",
  " (in 'string', line 467, column 28 to line 479, column 5)",
  " (in 'string', line 467, column 11 to line 484, column 5)",
  " (in 'string', line 466, column 6 to column 43)",
  " (in 'string', line 465, column 21 to line 467, column 5)",
  " (in 'string', line 465, column 4 to line 484, column 5)",
  " (in 'string', line 487, column 6 to column 50)",
  " (in 'string', line 486, column 24 to line 488, column 5)",
  " (in 'string', line 486, column 4 to line 488, column 5)",
  " (in 'string', line 489, column 4 to column 13)",
  " (in 'string', line 462, column 118 to line 490, column 3)",
  " (in 'string', line 493, column 4 to column 30)",
  " (in 'string', line 494, column 11 to column 12)",
  " (in 'string', line 494, column 4 to column 16)",
  " (in 'string', line 512, column 6 to column 99)",
  " (in 'string', line 511, column 28 to line 514, column 5)",
  " (in 'string', line 511, column 11 to line 514, column 5)",
  " (in 'string', line 510, column 6 to column 55)",
  " (in 'string', line 509, column 28 to line 511, column 5)",
  " (in 'string', line 509, column 11 to line 514, column 5)",
  " (in 'string', line 507, column 8 to column 82)",
  " (in 'string', line 506, column 13 to line 508, column 7)",
  " (in 'string', line 505, column 23 to column 76)",
  " (in 'string', line 505, column 8 to column 76)",
  " (in 'string', line 504, column 28 to line 506, column 7)",
  " (in 'string', line 504, column 13 to line 508, column 7)",
  " (in 'string', line 502, column 15 to column 16)",
  " (in 'string', line 502, column 8 to column 35)",
  " (in 'string', line 503, column 23 to column 65)",
  " (in 'string', line 503, column 8 to column 65)",
  " (in 'string', line 501, column 28 to line 504, column 7)",
  " (in 'string', line 501, column 13 to line 508, column 7)",
  " (in 'string', line 500, column 23 to column 68)",
  " (in 'string', line 500, column 8 to column 68)",
  " (in 'string', line 499, column 21 to line 501, column 7)",
  " (in 'string', line 499, column 6 to line 508, column 7)",
  " (in 'string', line 497, column 28 to line 509, column 5)",
  " (in 'string', line 497, column 11 to line 514, column 5)",
  " (in 'string', line 496, column 6 to column 44)",
  " (in 'string', line 495, column 21 to line 497, column 5)",
  " (in 'string', line 495, column 4 to line 514, column 5)",
  " (in 'string', line 517, column 6 to column 51)",
  " (in 'string', line 516, column 24 to line 518, column 5)",
  " (in 'string', line 516, column 4 to line 518, column 5)",
  " (in 'string', line 519, column 4 to column 13)",
  " (in 'string', line 492, column 123 to line 520, column 3)"};
template <bool propto__, typename T0__, typename T2__, typename T3__,
          typename T4__, typename T_lp__, typename T_lp_accum__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
void
prior_select_lp(const T0__& y_arg__, const int& dist, const T2__& location,
                const T3__& scale, const T4__& df, T_lp__& lp__,
                T_lp_accum__& lp_accum__, std::ostream* pstream__);
template <bool propto__, typename T0__, typename T2__, typename T3__,
          typename T4__, typename T_lp__, typename T_lp_accum__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
void
prior_select2_lp(const T0__& y, const int& dist, const T2__& location,
                 const T3__& scale, const T4__& df, T_lp__& lp__,
                 T_lp_accum__& lp_accum__, std::ostream* pstream__);
template <typename T0__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>>* = nullptr>
int count_nonzero(const T0__& m_arg__, std::ostream* pstream__);
std::vector<int>
which_gt0a(const std::vector<int>& x, std::ostream* pstream__);
std::vector<int>
which(const std::vector<int>& x, const int& y, std::ostream* pstream__);
int nwhich(const std::vector<int>& x, const int& y, std::ostream* pstream__);
std::vector<int>
nwhich_all(const std::vector<int>& x, const int& max_id, std::ostream*
           pstream__);
template <typename T0__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>>* = nullptr>
std::vector<int> which_gt0(const T0__& x_arg__, std::ostream* pstream__);
template <bool propto__, typename T0__, typename T1__, typename T2__,
          typename T3__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>>* = nullptr>
stan::promote_args_t<T0__, T1__, T2__, T3__>
gengamma_lpdf(const T0__& y, const T1__& mu, const T2__& sigma, const T3__&
              k, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T4__>>,-1,1>
lS(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
   aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lS2(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
    aux, const T4__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lS_a(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__& aux,
     const T4__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>>,-1,1>
lS_a2(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__&
      aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T4__>>,-1,1>
lh(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
   aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lh2(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
    aux, const T4__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lh_a(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__& aux,
     const T4__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>>,-1,1>
lh_a2(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__&
      aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_col_vector<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T5__>, stan::base_type_t<T6__>,
                stan::promote_args_t<stan::base_type_t<T7__>>>,-1,1>
loglik(const int& dist, const T1__& time_arg__, const T2__& start_time_arg__,
       const T3__& delay_time_arg__, const std::vector<int>& status,
       const T5__& eta_arg__, const T6__& aux_arg__, const T7__& aux2_arg__,
       std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_stan_scalar<T6__>,
                              stan::is_stan_scalar<T7__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T5__>, T6__, stan::promote_args_t<T7__>>,-1,1>
loglik2(const int& dist, const T1__& time_arg__, const T2__&
        start_time_arg__, const T3__& delay_time_arg__,
        const std::vector<int>& status, const T5__& eta_arg__, const T6__&
        aux, const T7__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_stan_scalar<T6__>,
                              stan::is_stan_scalar<T7__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, T2__, T3__, stan::base_type_t<T5__>,
                T6__, stan::promote_args_t<T7__>>,-1,1>
loglik_a(const int& dist, const T1__& time, const T2__& start_time,
         const T3__& delay_time, const int& status, const T5__& eta_arg__,
         const T6__& aux, const T7__& aux2, std::ostream* pstream__);
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_col_vector<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<T1__, T2__, T3__, stan::base_type_t<T5__>,
                stan::base_type_t<T6__>,
                stan::promote_args_t<stan::base_type_t<T7__>>>,-1,1>
loglik_a2(const int& dist, const T1__& time, const T2__& start_time,
          const T3__& delay_time, const int& status, const T5__& eta_arg__,
          const T6__& aux_arg__, const T7__& aux2_arg__, std::ostream*
          pstream__);
template <bool propto__, typename T0__, typename T2__, typename T3__,
          typename T4__, typename T_lp__, typename T_lp_accum__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
void
prior_select_lp(const T0__& y_arg__, const int& dist, const T2__& location,
                const T3__& scale, const T4__& df, T_lp__& lp__,
                T_lp_accum__& lp_accum__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>,
                             T2__, T3__, T4__>;
  int current_statement__ = 0;
  const auto& y = stan::math::to_ref(y_arg__);
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 683;
    if (stan::math::logical_eq(dist, 0)) {} else {
                                            current_statement__ = 681;
                                            if (stan::math::logical_eq(dist,
                                                  1)) {
                                              current_statement__ = 679;
                                              lp_accum__.add(stan::math::normal_lpdf<
                                                               propto__>(y,
                                                               location,
                                                               scale));
                                            } else {
                                              current_statement__ = 678;
                                              if (stan::math::logical_eq(
                                                    dist, 2)) {
                                                current_statement__ = 676;
                                                lp_accum__.add(stan::math::cauchy_lpdf<
                                                                 propto__>(y,
                                                                 location,
                                                                 scale));
                                              } else {
                                                current_statement__ = 675;
                                                if (stan::math::logical_eq(
                                                      dist, 3)) {
                                                  current_statement__ = 673;
                                                  lp_accum__.add(stan::math::student_t_lpdf<
                                                                   propto__>(
                                                                   y, df,
                                                                   location,
                                                                   scale));
                                                } else {
                                                  current_statement__ = 672;
                                                  if (stan::math::logical_eq(
                                                        dist, 4)) {
                                                    current_statement__ = 670;
                                                    lp_accum__.add(stan::math::exponential_lpdf<
                                                                    propto__>(
                                                                    y, (1 /
                                                                    scale)));
                                                  } else {
                                                    current_statement__ = 669;
                                                    if (stan::math::logical_eq(
                                                          dist, 5)) {
                                                      current_statement__ = 667;
                                                      lp_accum__.add(
                                                        stan::math::lognormal_lpdf<
                                                          propto__>(y,
                                                          location, scale));
                                                    } else {
                                                      current_statement__ = 666;
                                                      if (stan::math::logical_eq(
                                                            dist, 6)) {
                                                        current_statement__ = 663;
                                                        lp_accum__.add(
                                                          stan::math::student_t_lpdf<
                                                            propto__>(
                                                            stan::math::log(y),
                                                            df, location,
                                                            scale));
                                                        current_statement__ = 664;
                                                        lp_accum__.add(
                                                          stan::math::minus(
                                                            stan::math::log(y)));
                                                      } else {
                                                        current_statement__ = 661;
                                                        std::stringstream
                                                          errmsg_stream__;
                                                        stan::math::stan_print(
                                                          &errmsg_stream__,
                                                          "Not a supported prior dist.");
                                                        throw std::domain_error(
                                                                errmsg_stream__.str());
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
    }
    current_statement__ = 684;
    return ;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <bool propto__, typename T0__, typename T2__, typename T3__,
          typename T4__, typename T_lp__, typename T_lp_accum__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
void
prior_select2_lp(const T0__& y, const int& dist, const T2__& location,
                 const T3__& scale, const T4__& df, T_lp__& lp__,
                 T_lp_accum__& lp_accum__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__, T2__, T3__, T4__>;
  int current_statement__ = 0;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 708;
    if (stan::math::logical_eq(dist, 0)) {} else {
                                            current_statement__ = 706;
                                            if (stan::math::logical_eq(dist,
                                                  1)) {
                                              current_statement__ = 704;
                                              lp_accum__.add(stan::math::normal_lpdf<
                                                               propto__>(y,
                                                               location,
                                                               scale));
                                            } else {
                                              current_statement__ = 703;
                                              if (stan::math::logical_eq(
                                                    dist, 2)) {
                                                current_statement__ = 701;
                                                lp_accum__.add(stan::math::cauchy_lpdf<
                                                                 propto__>(y,
                                                                 location,
                                                                 scale));
                                              } else {
                                                current_statement__ = 700;
                                                if (stan::math::logical_eq(
                                                      dist, 3)) {
                                                  current_statement__ = 698;
                                                  lp_accum__.add(stan::math::student_t_lpdf<
                                                                   propto__>(
                                                                   y, df,
                                                                   location,
                                                                   scale));
                                                } else {
                                                  current_statement__ = 697;
                                                  if (stan::math::logical_eq(
                                                        dist, 4)) {
                                                    current_statement__ = 695;
                                                    lp_accum__.add(stan::math::exponential_lpdf<
                                                                    propto__>(
                                                                    y, (1 /
                                                                    scale)));
                                                  } else {
                                                    current_statement__ = 694;
                                                    if (stan::math::logical_eq(
                                                          dist, 5)) {
                                                      current_statement__ = 692;
                                                      lp_accum__.add(
                                                        stan::math::lognormal_lpdf<
                                                          propto__>(y,
                                                          location, scale));
                                                    } else {
                                                      current_statement__ = 691;
                                                      if (stan::math::logical_eq(
                                                            dist, 6)) {
                                                        current_statement__ = 688;
                                                        lp_accum__.add(
                                                          stan::math::student_t_lpdf<
                                                            propto__>(
                                                            stan::math::log(y),
                                                            df, location,
                                                            scale));
                                                        current_statement__ = 689;
                                                        lp_accum__.add(-
                                                          stan::math::log(y));
                                                      } else {
                                                        current_statement__ = 686;
                                                        std::stringstream
                                                          errmsg_stream__;
                                                        stan::math::stan_print(
                                                          &errmsg_stream__,
                                                          "Not a supported prior dist.");
                                                        throw std::domain_error(
                                                                errmsg_stream__.str());
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
    }
    current_statement__ = 709;
    return ;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__,
          stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
                              stan::is_vt_not_complex<T0__>>*>
int count_nonzero(const T0__& m_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  const auto& m = stan::math::to_ref(m_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int I = std::numeric_limits<int>::min();
    current_statement__ = 711;
    I = stan::math::rows(m);
    int J = std::numeric_limits<int>::min();
    current_statement__ = 712;
    J = stan::math::cols(m);
    int c = std::numeric_limits<int>::min();
    current_statement__ = 713;
    c = 0;
    current_statement__ = 719;
    for (int j = 1; j <= I; ++j) {
      current_statement__ = 717;
      for (int i = 1; i <= J; ++i) {
        current_statement__ = 715;
        if (stan::math::logical_neq(
              stan::model::rvalue(m, "m", stan::model::index_uni(i),
                stan::model::index_uni(j)), 0)) {
          current_statement__ = 714;
          c = (c + 1);
        }
      }
    }
    current_statement__ = 720;
    return c;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
std::vector<int>
which_gt0a(const std::vector<int>& x, std::ostream* pstream__) {
  using local_scalar_t__ = double;
  int current_statement__ = 0;
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 722;
    n = stan::math::num_elements(x);
    current_statement__ = 723;
    stan::math::validate_non_negative_index("w", "n", n);
    std::vector<int> w = std::vector<int>(n, std::numeric_limits<int>::min());
    int c = std::numeric_limits<int>::min();
    current_statement__ = 725;
    c = 1;
    current_statement__ = 731;
    for (int i = 1; i <= n; ++i) {
      current_statement__ = 729;
      if (stan::math::logical_gt(
            stan::model::rvalue(x, "x", stan::model::index_uni(i)), 0)) {
        current_statement__ = 726;
        stan::model::assign(w, i, "assigning variable w",
          stan::model::index_uni(c));
        current_statement__ = 727;
        c = (c + 1);
      }
    }
    current_statement__ = 732;
    return stan::model::rvalue(w, "w", stan::model::index_min_max(1, (c - 1)));
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
std::vector<int>
which(const std::vector<int>& x, const int& y, std::ostream* pstream__) {
  using local_scalar_t__ = double;
  int current_statement__ = 0;
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 734;
    n = stan::math::num_elements(x);
    current_statement__ = 735;
    stan::math::validate_non_negative_index("w", "n", n);
    std::vector<int> w = std::vector<int>(n, std::numeric_limits<int>::min());
    int c = std::numeric_limits<int>::min();
    current_statement__ = 737;
    c = 1;
    current_statement__ = 743;
    for (int i = 1; i <= n; ++i) {
      current_statement__ = 741;
      if (stan::math::logical_eq(
            stan::model::rvalue(x, "x", stan::model::index_uni(i)), y)) {
        current_statement__ = 738;
        stan::model::assign(w, i, "assigning variable w",
          stan::model::index_uni(c));
        current_statement__ = 739;
        c = (c + 1);
      }
    }
    current_statement__ = 744;
    return stan::model::rvalue(w, "w", stan::model::index_min_max(1, (c - 1)));
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
int nwhich(const std::vector<int>& x, const int& y, std::ostream* pstream__) {
  using local_scalar_t__ = double;
  int current_statement__ = 0;
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int w = std::numeric_limits<int>::min();
    current_statement__ = 746;
    w = 0;
    current_statement__ = 750;
    for (int i = 1; i <= stan::math::num_elements(x); ++i) {
      current_statement__ = 748;
      if (stan::math::logical_eq(
            stan::model::rvalue(x, "x", stan::model::index_uni(i)), y)) {
        current_statement__ = 747;
        w = (w + 1);
      }
    }
    current_statement__ = 751;
    return w;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
std::vector<int>
nwhich_all(const std::vector<int>& x, const int& max_id, std::ostream*
           pstream__) {
  using local_scalar_t__ = double;
  int current_statement__ = 0;
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    current_statement__ = 753;
    stan::math::validate_non_negative_index("w", "max_id", max_id);
    std::vector<int> w =
      std::vector<int>(max_id, std::numeric_limits<int>::min());
    current_statement__ = 754;
    stan::model::assign(w, stan::math::rep_array(0, max_id),
      "assigning variable w");
    current_statement__ = 758;
    for (int i = 1; i <= stan::math::num_elements(x); ++i) {
      current_statement__ = 756;
      if (stan::model::rvalue(x, "x", stan::model::index_uni(i))) {
        current_statement__ = 755;
        stan::model::assign(w,
          (stan::model::rvalue(w, "w",
             stan::model::index_uni(
               stan::model::rvalue(x, "x", stan::model::index_uni(i)))) + 1),
          "assigning variable w",
          stan::model::index_uni(
            stan::model::rvalue(x, "x", stan::model::index_uni(i))));
      }
    }
    current_statement__ = 759;
    return w;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T0__,
          stan::require_all_t<stan::is_col_vector<T0__>,
                              stan::is_vt_not_complex<T0__>>*>
std::vector<int> which_gt0(const T0__& x_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T0__>>;
  int current_statement__ = 0;
  const auto& x = stan::math::to_ref(x_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 761;
    n = stan::math::num_elements(x);
    current_statement__ = 762;
    stan::math::validate_non_negative_index("w", "n", n);
    std::vector<int> w = std::vector<int>(n, std::numeric_limits<int>::min());
    int c = std::numeric_limits<int>::min();
    current_statement__ = 764;
    c = 1;
    current_statement__ = 770;
    for (int i = 1; i <= n; ++i) {
      current_statement__ = 768;
      if (stan::math::logical_gt(
            stan::model::rvalue(x, "x", stan::model::index_uni(i)), 0)) {
        current_statement__ = 765;
        stan::model::assign(w, i, "assigning variable w",
          stan::model::index_uni(c));
        current_statement__ = 766;
        c = (c + 1);
      }
    }
    current_statement__ = 771;
    return stan::model::rvalue(w, "w", stan::model::index_min_max(1, (c - 1)));
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <bool propto__, typename T0__, typename T1__, typename T2__,
          typename T3__,
          stan::require_all_t<stan::is_stan_scalar<T0__>,
                              stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>>*>
stan::promote_args_t<T0__, T1__, T2__, T3__>
gengamma_lpdf(const T0__& y, const T1__& mu, const T2__& sigma, const T3__&
              k, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T0__, T1__, T2__, T3__>;
  int current_statement__ = 0;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    local_scalar_t__ Q = DUMMY_VAR__;
    current_statement__ = 773;
    Q = stan::math::pow(k, -0.5);
    local_scalar_t__ w = DUMMY_VAR__;
    current_statement__ = 774;
    w = ((Q * (stan::math::log(y) - mu)) / sigma);
    current_statement__ = 775;
    return ((((-stan::math::log(sigma) - stan::math::log(y)) - ((0.5 *
           stan::math::log(k)) * (1 - (2 * k)))) + (k * (w -
           stan::math::exp(w)))) - stan::math::lgamma(k));
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T4__>>,-1,1>
lS(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
   aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>>;
  int current_statement__ = 0;
  const auto& y = stan::math::to_ref(y_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 777;
    n = stan::math::num_elements(y);
    current_statement__ = 778;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 814;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 812;
      stan::model::assign(out,
        stan::math::elt_multiply(stan::math::minus(y), stan::math::exp(eta)),
        "assigning variable out");
    } else {
      current_statement__ = 811;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 809;
        stan::model::assign(out,
          stan::math::elt_multiply(
            stan::math::minus(stan::math::pow(y, aux)), stan::math::exp(eta)),
          "assigning variable out");
      } else {
        current_statement__ = 808;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 806;
          stan::model::assign(out,
            stan::math::elt_multiply(
              stan::math::elt_divide(stan::math::minus(stan::math::exp(eta)),
                aux), stan::math::expm1(stan::math::elt_multiply(aux, y))),
            "assigning variable out");
        } else {
          current_statement__ = 805;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 803;
            stan::model::assign(out,
              stan::math::elt_multiply(stan::math::minus(y),
                stan::math::exp(stan::math::minus(eta))),
              "assigning variable out");
          } else {
            current_statement__ = 802;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 800;
              stan::model::assign(out,
                stan::math::elt_multiply(
                  stan::math::minus(stan::math::pow(y, aux)),
                  stan::math::exp(
                    stan::math::elt_multiply(stan::math::minus(aux), eta))),
                "assigning variable out");
            } else {
              current_statement__ = 799;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 797;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 796;
                  stan::model::assign(out,
                    stan::math::lognormal_lccdf(
                      stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)),
                      stan::model::rvalue(aux, "aux",
                        stan::model::index_uni(i))),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 795;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 793;
                  stan::model::assign(out,
                    stan::math::minus(
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 792;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 787;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 788;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 790;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 789;
                      stan::model::assign(out,
                        stan::math::gamma_lccdf(
                          stan::model::rvalue(y, "y",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 786;
                    if (stan::math::logical_eq(dist, 9)) {
                      current_statement__ = 780;
                      stan::math::validate_non_negative_index("Q", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> Q =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 781;
                      stan::model::assign(Q,
                        stan::math::inv(stan::math::sqrt(aux2)),
                        "assigning variable Q");
                      current_statement__ = 782;
                      stan::math::validate_non_negative_index("w", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> w =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 783;
                      stan::model::assign(w,
                        stan::math::elt_multiply(
                          stan::math::exp(
                            stan::math::elt_divide(
                              stan::math::elt_multiply(Q,
                                stan::math::subtract(stan::math::log(y), eta)),
                              aux)), aux2), "assigning variable w");
                      current_statement__ = 784;
                      stan::model::assign(out,
                        stan::math::log1m(stan::math::gamma_p(aux2, w)),
                        "assigning variable out");
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 815;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lS2(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
    aux, const T4__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>, T3__, T4__>;
  int current_statement__ = 0;
  const auto& y = stan::math::to_ref(y_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 817;
    n = stan::math::num_elements(y);
    current_statement__ = 818;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 853;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 851;
      stan::model::assign(out,
        stan::math::elt_multiply(stan::math::minus(y), stan::math::exp(eta)),
        "assigning variable out");
    } else {
      current_statement__ = 850;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 848;
        stan::model::assign(out,
          stan::math::elt_multiply(
            stan::math::minus(stan::math::pow(y, aux)), stan::math::exp(eta)),
          "assigning variable out");
      } else {
        current_statement__ = 847;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 845;
          stan::model::assign(out,
            stan::math::elt_multiply(
              stan::math::divide(stan::math::minus(stan::math::exp(eta)), aux),
              stan::math::expm1(stan::math::multiply(aux, y))),
            "assigning variable out");
        } else {
          current_statement__ = 844;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 842;
            stan::model::assign(out,
              stan::math::elt_multiply(stan::math::minus(y),
                stan::math::exp(stan::math::minus(eta))),
              "assigning variable out");
          } else {
            current_statement__ = 841;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 839;
              stan::model::assign(out,
                stan::math::elt_multiply(
                  stan::math::minus(stan::math::pow(y, aux)),
                  stan::math::exp(stan::math::multiply(-aux, eta))),
                "assigning variable out");
            } else {
              current_statement__ = 838;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 836;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 835;
                  stan::model::assign(out,
                    stan::math::lognormal_lccdf(
                      stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)), aux),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 834;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 832;
                  stan::model::assign(out,
                    stan::math::minus(
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 831;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 826;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 827;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 829;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 828;
                      stan::model::assign(out,
                        stan::math::gamma_lccdf(
                          stan::model::rvalue(y, "y",
                            stan::model::index_uni(i)), aux,
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 825;
                    if (stan::math::logical_eq(dist, 9)) {
                      local_scalar_t__ Q = DUMMY_VAR__;
                      current_statement__ = 820;
                      Q = stan::math::inv(stan::math::sqrt(aux2));
                      current_statement__ = 821;
                      stan::math::validate_non_negative_index("w", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> w =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 822;
                      stan::model::assign(w,
                        stan::math::multiply(
                          stan::math::exp(
                            stan::math::divide(
                              stan::math::multiply(Q,
                                stan::math::subtract(stan::math::log(y), eta)),
                              aux)), aux2), "assigning variable w");
                      current_statement__ = 823;
                      stan::model::assign(out,
                        stan::math::log1m(stan::math::gamma_p(aux2, w)),
                        "assigning variable out");
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 854;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lS_a(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__& aux,
     const T4__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__,
                             stan::base_type_t<T2__>, T3__, T4__>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 856;
    n = stan::math::num_elements(eta);
    current_statement__ = 857;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 892;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 890;
      stan::model::assign(out,
        stan::math::multiply(-y, stan::math::exp(eta)),
        "assigning variable out");
    } else {
      current_statement__ = 889;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 887;
        stan::model::assign(out,
          stan::math::multiply(-stan::math::pow(y, aux), stan::math::exp(eta)),
          "assigning variable out");
      } else {
        current_statement__ = 886;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 884;
          stan::model::assign(out,
            stan::math::multiply(
              stan::math::divide(stan::math::minus(stan::math::exp(eta)), aux),
              stan::math::expm1((aux * y))), "assigning variable out");
        } else {
          current_statement__ = 883;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 881;
            stan::model::assign(out,
              stan::math::multiply(-y,
                stan::math::exp(stan::math::minus(eta))),
              "assigning variable out");
          } else {
            current_statement__ = 880;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 878;
              stan::model::assign(out,
                stan::math::multiply(-stan::math::pow(y, aux),
                  stan::math::exp(stan::math::multiply(-aux, eta))),
                "assigning variable out");
            } else {
              current_statement__ = 877;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 875;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 874;
                  stan::model::assign(out,
                    stan::math::lognormal_lccdf(y,
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)), aux),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 873;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 871;
                  stan::model::assign(out,
                    stan::math::minus(
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 870;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 865;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 866;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 868;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 867;
                      stan::model::assign(out,
                        stan::math::gamma_lccdf(y, aux,
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 864;
                    if (stan::math::logical_eq(dist, 9)) {
                      local_scalar_t__ Q = DUMMY_VAR__;
                      current_statement__ = 859;
                      Q = stan::math::pow(aux2, -0.5);
                      current_statement__ = 860;
                      stan::math::validate_non_negative_index("w", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> w =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 861;
                      stan::model::assign(w,
                        stan::math::multiply(
                          stan::math::exp(
                            stan::math::divide(
                              stan::math::multiply(Q,
                                stan::math::subtract(stan::math::log(y), eta)),
                              aux)), aux2), "assigning variable w");
                      current_statement__ = 862;
                      stan::model::assign(out,
                        stan::math::log1m(stan::math::gamma_p(aux2, w)),
                        "assigning variable out");
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 893;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>>,-1,1>
lS_a2(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__&
      aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 895;
    n = stan::math::num_elements(eta);
    current_statement__ = 896;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 932;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 930;
      stan::model::assign(out,
        stan::math::multiply(-y, stan::math::exp(eta)),
        "assigning variable out");
    } else {
      current_statement__ = 929;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 927;
        stan::model::assign(out,
          stan::math::elt_multiply(
            stan::math::minus(stan::math::pow(y, aux)), stan::math::exp(eta)),
          "assigning variable out");
      } else {
        current_statement__ = 926;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 924;
          stan::model::assign(out,
            stan::math::elt_multiply(
              stan::math::elt_divide(stan::math::minus(stan::math::exp(eta)),
                aux), stan::math::expm1(stan::math::multiply(aux, y))),
            "assigning variable out");
        } else {
          current_statement__ = 923;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 921;
            stan::model::assign(out,
              stan::math::multiply(-y,
                stan::math::exp(stan::math::minus(eta))),
              "assigning variable out");
          } else {
            current_statement__ = 920;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 918;
              stan::model::assign(out,
                stan::math::elt_multiply(
                  stan::math::minus(stan::math::pow(y, aux)),
                  stan::math::exp(
                    stan::math::elt_multiply(stan::math::minus(aux), eta))),
                "assigning variable out");
            } else {
              current_statement__ = 917;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 915;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 914;
                  stan::model::assign(out,
                    stan::math::lognormal_lccdf(y,
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)),
                      stan::model::rvalue(aux, "aux",
                        stan::model::index_uni(i))),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 913;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 911;
                  stan::model::assign(out,
                    stan::math::minus(
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 910;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 905;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 906;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 908;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 907;
                      stan::model::assign(out,
                        stan::math::gamma_lccdf(y,
                          stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 904;
                    if (stan::math::logical_eq(dist, 9)) {
                      current_statement__ = 898;
                      stan::math::validate_non_negative_index("Q", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> Q =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 899;
                      stan::model::assign(Q, stan::math::pow(aux2, -0.5),
                        "assigning variable Q");
                      current_statement__ = 900;
                      stan::math::validate_non_negative_index("w", "n", n);
                      Eigen::Matrix<local_scalar_t__,-1,1> w =
                        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                          DUMMY_VAR__);
                      current_statement__ = 901;
                      stan::model::assign(w,
                        stan::math::elt_multiply(
                          stan::math::exp(
                            stan::math::elt_divide(
                              stan::math::elt_multiply(Q,
                                stan::math::subtract(stan::math::log(y), eta)),
                              aux)), aux2), "assigning variable w");
                      current_statement__ = 902;
                      stan::model::assign(out,
                        stan::math::log1m(stan::math::gamma_p(aux2, w)),
                        "assigning variable out");
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 933;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T4__>>,-1,1>
lh(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
   aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>>;
  int current_statement__ = 0;
  const auto& y = stan::math::to_ref(y_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 935;
    n = stan::math::num_elements(y);
    current_statement__ = 936;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 967;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 965;
      stan::model::assign(out, eta, "assigning variable out");
    } else {
      current_statement__ = 964;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 962;
        stan::model::assign(out,
          stan::math::add(stan::math::add(stan::math::log(aux), eta),
            stan::math::multiply_log(stan::math::subtract(aux, 1), y)),
          "assigning variable out");
      } else {
        current_statement__ = 961;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 959;
          stan::model::assign(out,
            stan::math::add(eta, stan::math::elt_multiply(aux, y)),
            "assigning variable out");
        } else {
          current_statement__ = 958;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 956;
            stan::model::assign(out, stan::math::minus(eta),
              "assigning variable out");
          } else {
            current_statement__ = 955;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 953;
              stan::model::assign(out,
                stan::math::add(
                  stan::math::subtract(stan::math::log(aux),
                    stan::math::elt_multiply(aux, eta)),
                  stan::math::multiply_log(stan::math::subtract(aux, 1), y)),
                "assigning variable out");
            } else {
              current_statement__ = 952;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 950;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 949;
                  stan::model::assign(out,
                    (stan::math::lognormal_lpdf<false>(
                       stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                       stan::model::rvalue(eta, "eta",
                         stan::model::index_uni(i)),
                       stan::model::rvalue(aux, "aux",
                         stan::model::index_uni(i))) -
                    stan::math::lognormal_lccdf(
                      stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)),
                      stan::model::rvalue(aux, "aux",
                        stan::model::index_uni(i)))),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 948;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 946;
                  stan::model::assign(out,
                    stan::math::subtract(
                      stan::math::add(
                        stan::math::subtract(stan::math::log(aux), eta),
                        stan::math::elt_multiply(
                          stan::math::subtract(aux, 1),
                          stan::math::subtract(stan::math::log(y), eta))),
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 945;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 940;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 941;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 943;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 942;
                      stan::model::assign(out,
                        (stan::math::gamma_lpdf<false>(
                           stan::model::rvalue(y, "y",
                             stan::model::index_uni(i)),
                           stan::model::rvalue(aux, "aux",
                             stan::model::index_uni(i)),
                           stan::model::rvalue(eeta, "eeta",
                             stan::model::index_uni(i))) -
                        stan::math::gamma_lccdf(
                          stan::model::rvalue(y, "y",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i)))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 939;
                    if (stan::math::logical_eq(dist, 9)) {}
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 968;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lh2(const int& dist, const T1__& y_arg__, const T2__& eta_arg__, const T3__&
    aux, const T4__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>, T3__, T4__>;
  int current_statement__ = 0;
  const auto& y = stan::math::to_ref(y_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 970;
    n = stan::math::num_elements(y);
    current_statement__ = 971;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 1002;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 1000;
      stan::model::assign(out, eta, "assigning variable out");
    } else {
      current_statement__ = 999;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 997;
        stan::model::assign(out,
          stan::math::add(stan::math::add(stan::math::log(aux), eta),
            stan::math::multiply_log((aux - 1), y)), "assigning variable out");
      } else {
        current_statement__ = 996;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 994;
          stan::model::assign(out,
            stan::math::add(eta, stan::math::multiply(aux, y)),
            "assigning variable out");
        } else {
          current_statement__ = 993;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 991;
            stan::model::assign(out, stan::math::minus(eta),
              "assigning variable out");
          } else {
            current_statement__ = 990;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 988;
              stan::model::assign(out,
                stan::math::add(
                  stan::math::subtract(stan::math::log(aux),
                    stan::math::multiply(aux, eta)),
                  stan::math::multiply_log((aux - 1), y)),
                "assigning variable out");
            } else {
              current_statement__ = 987;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 985;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 984;
                  stan::model::assign(out,
                    (stan::math::lognormal_lpdf<false>(
                       stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                       stan::model::rvalue(eta, "eta",
                         stan::model::index_uni(i)), aux) -
                    stan::math::lognormal_lccdf(
                      stan::model::rvalue(y, "y", stan::model::index_uni(i)),
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)), aux)),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 983;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 981;
                  stan::model::assign(out,
                    stan::math::subtract(
                      stan::math::add(
                        stan::math::subtract(stan::math::log(aux), eta),
                        stan::math::multiply((aux - 1),
                          stan::math::subtract(stan::math::log(y), eta))),
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 980;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 975;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 976;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 978;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 977;
                      stan::model::assign(out,
                        (stan::math::gamma_lpdf<false>(
                           stan::model::rvalue(y, "y",
                             stan::model::index_uni(i)), aux,
                           stan::model::rvalue(eeta, "eeta",
                             stan::model::index_uni(i))) -
                        stan::math::gamma_lccdf(
                          stan::model::rvalue(y, "y",
                            stan::model::index_uni(i)), aux,
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i)))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 974;
                    if (stan::math::logical_eq(dist, 9)) {}
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 1003;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_stan_scalar<T4__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>, T3__, T4__>,-1,1>
lh_a(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__& aux,
     const T4__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__,
                             stan::base_type_t<T2__>, T3__, T4__>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1005;
    n = stan::math::num_elements(eta);
    current_statement__ = 1006;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 1037;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 1035;
      stan::model::assign(out, eta, "assigning variable out");
    } else {
      current_statement__ = 1034;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 1032;
        stan::model::assign(out,
          stan::math::add(stan::math::add(stan::math::log(aux), eta),
            stan::math::multiply_log((aux - 1), y)), "assigning variable out");
      } else {
        current_statement__ = 1031;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 1029;
          stan::model::assign(out, stan::math::add(eta, (aux * y)),
            "assigning variable out");
        } else {
          current_statement__ = 1028;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 1026;
            stan::model::assign(out, stan::math::minus(eta),
              "assigning variable out");
          } else {
            current_statement__ = 1025;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 1023;
              stan::model::assign(out,
                stan::math::add(
                  stan::math::subtract(stan::math::log(aux),
                    stan::math::multiply(aux, eta)),
                  stan::math::multiply_log((aux - 1), y)),
                "assigning variable out");
            } else {
              current_statement__ = 1022;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 1020;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 1019;
                  stan::model::assign(out,
                    (stan::math::lognormal_lpdf<false>(y,
                       stan::model::rvalue(eta, "eta",
                         stan::model::index_uni(i)), aux) -
                    stan::math::lognormal_lccdf(y,
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)), aux)),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 1018;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 1016;
                  stan::model::assign(out,
                    stan::math::subtract(
                      stan::math::add(
                        stan::math::subtract(stan::math::log(aux), eta),
                        stan::math::multiply((aux - 1),
                          stan::math::subtract(stan::math::log(y), eta))),
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 1015;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 1010;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 1011;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 1013;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 1012;
                      stan::model::assign(out,
                        (stan::math::gamma_lpdf<false>(y, aux,
                           stan::model::rvalue(eeta, "eeta",
                             stan::model::index_uni(i))) -
                        stan::math::gamma_lccdf(y, aux,
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i)))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 1009;
                    if (stan::math::logical_eq(dist, 9)) {}
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 1038;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T4__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T4__>,
                              stan::is_vt_not_complex<T4__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, stan::base_type_t<T2__>,
                stan::base_type_t<T3__>, stan::base_type_t<T4__>>,-1,1>
lh_a2(const int& dist, const T1__& y, const T2__& eta_arg__, const T3__&
      aux_arg__, const T4__& aux2_arg__, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T4__>>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1040;
    n = stan::math::num_elements(eta);
    current_statement__ = 1041;
    stan::math::validate_non_negative_index("out", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> out =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 1072;
    if (stan::math::logical_eq(dist, 1)) {
      current_statement__ = 1070;
      stan::model::assign(out, eta, "assigning variable out");
    } else {
      current_statement__ = 1069;
      if (stan::math::logical_eq(dist, 2)) {
        current_statement__ = 1067;
        stan::model::assign(out,
          stan::math::add(stan::math::add(stan::math::log(aux), eta),
            stan::math::multiply_log(stan::math::subtract(aux, 1), y)),
          "assigning variable out");
      } else {
        current_statement__ = 1066;
        if (stan::math::logical_eq(dist, 3)) {
          current_statement__ = 1064;
          stan::model::assign(out,
            stan::math::add(eta, stan::math::multiply(aux, y)),
            "assigning variable out");
        } else {
          current_statement__ = 1063;
          if (stan::math::logical_eq(dist, 4)) {
            current_statement__ = 1061;
            stan::model::assign(out, stan::math::minus(eta),
              "assigning variable out");
          } else {
            current_statement__ = 1060;
            if (stan::math::logical_eq(dist, 5)) {
              current_statement__ = 1058;
              stan::model::assign(out,
                stan::math::add(
                  stan::math::subtract(stan::math::log(aux),
                    stan::math::elt_multiply(aux, eta)),
                  stan::math::multiply_log(stan::math::subtract(aux, 1), y)),
                "assigning variable out");
            } else {
              current_statement__ = 1057;
              if (stan::math::logical_eq(dist, 6)) {
                current_statement__ = 1055;
                for (int i = 1; i <= n; ++i) {
                  current_statement__ = 1054;
                  stan::model::assign(out,
                    (stan::math::lognormal_lpdf<false>(y,
                       stan::model::rvalue(eta, "eta",
                         stan::model::index_uni(i)),
                       stan::model::rvalue(aux, "aux",
                         stan::model::index_uni(i))) -
                    stan::math::lognormal_lccdf(y,
                      stan::model::rvalue(eta, "eta",
                        stan::model::index_uni(i)),
                      stan::model::rvalue(aux, "aux",
                        stan::model::index_uni(i)))),
                    "assigning variable out", stan::model::index_uni(i));
                }
              } else {
                current_statement__ = 1053;
                if (stan::math::logical_eq(dist, 7)) {
                  current_statement__ = 1051;
                  stan::model::assign(out,
                    stan::math::subtract(
                      stan::math::add(
                        stan::math::subtract(stan::math::log(aux), eta),
                        stan::math::elt_multiply(
                          stan::math::subtract(aux, 1),
                          stan::math::subtract(stan::math::log(y), eta))),
                      stan::math::log1p(
                        stan::math::pow(
                          stan::math::elt_divide(y, stan::math::exp(eta)),
                          aux))), "assigning variable out");
                } else {
                  current_statement__ = 1050;
                  if (stan::math::logical_eq(dist, 8)) {
                    current_statement__ = 1045;
                    stan::math::validate_non_negative_index("eeta", "n", n);
                    Eigen::Matrix<local_scalar_t__,-1,1> eeta =
                      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n,
                        DUMMY_VAR__);
                    current_statement__ = 1046;
                    stan::model::assign(eeta,
                      stan::math::exp(stan::math::minus(eta)),
                      "assigning variable eeta");
                    current_statement__ = 1048;
                    for (int i = 1; i <= n; ++i) {
                      current_statement__ = 1047;
                      stan::model::assign(out,
                        (stan::math::gamma_lpdf<false>(y,
                           stan::model::rvalue(aux, "aux",
                             stan::model::index_uni(i)),
                           stan::model::rvalue(eeta, "eeta",
                             stan::model::index_uni(i))) -
                        stan::math::gamma_lccdf(y,
                          stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(i)),
                          stan::model::rvalue(eeta, "eeta",
                            stan::model::index_uni(i)))),
                        "assigning variable out", stan::model::index_uni(i));
                    }
                  } else {
                    current_statement__ = 1044;
                    if (stan::math::logical_eq(dist, 9)) {}
                  }
                }
              }
            }
          }
        }
      }
    }
    current_statement__ = 1073;
    return out;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_col_vector<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T5__>, stan::base_type_t<T6__>,
                stan::promote_args_t<stan::base_type_t<T7__>>>,-1,1>
loglik(const int& dist, const T1__& time_arg__, const T2__& start_time_arg__,
       const T3__& delay_time_arg__, const std::vector<int>& status,
       const T5__& eta_arg__, const T6__& aux_arg__, const T7__& aux2_arg__,
       std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T5__>,
                             stan::base_type_t<T6__>,
                             stan::promote_args_t<stan::base_type_t<T7__>>>;
  int current_statement__ = 0;
  const auto& time = stan::math::to_ref(time_arg__);
  const auto& start_time = stan::math::to_ref(start_time_arg__);
  const auto& delay_time = stan::math::to_ref(delay_time_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1075;
    n = stan::math::num_elements(eta);
    current_statement__ = 1076;
    stan::math::validate_non_negative_index("l", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> l =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    std::vector<int> nw =
      std::vector<int>(3, std::numeric_limits<int>::min());
    current_statement__ = 1078;
    stan::model::assign(nw, nwhich_all(status, 3, pstream__),
      "assigning variable nw");
    int nw0 = std::numeric_limits<int>::min();
    current_statement__ = 1079;
    nw0 = ((stan::math::primitive_value(
              (stan::math::primitive_value(stan::math::logical_eq(dist, 6))
              ||
              stan::math::primitive_value(stan::math::logical_eq(dist, 8))))
      || stan::math::primitive_value(stan::math::logical_eq(dist, 9))) ? (n -
      stan::math::sum(nw)) : 0);
    current_statement__ = 1080;
    stan::math::validate_non_negative_index("w0", "nw0", nw0);
    std::vector<int> w0 =
      std::vector<int>(nw0, std::numeric_limits<int>::min());
    current_statement__ = 1082;
    stan::math::validate_non_negative_index("w1", "nw[1]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(1)));
    std::vector<int> w1 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(1)),
        std::numeric_limits<int>::min());
    current_statement__ = 1084;
    stan::math::validate_non_negative_index("w2", "nw[2]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(2)));
    std::vector<int> w2 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(2)),
        std::numeric_limits<int>::min());
    current_statement__ = 1086;
    stan::math::validate_non_negative_index("w3", "nw[3]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(3)));
    std::vector<int> w3 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(3)),
        std::numeric_limits<int>::min());
    int nd = std::numeric_limits<int>::min();
    current_statement__ = 1088;
    nd = stan::math::num_elements(which_gt0(delay_time, pstream__));
    current_statement__ = 1089;
    stan::math::validate_non_negative_index("wd", "nd", nd);
    std::vector<int> wd =
      std::vector<int>(nd, std::numeric_limits<int>::min());
    current_statement__ = 1092;
    if (nw0) {
      current_statement__ = 1091;
      stan::model::assign(w0, which(status, 0, pstream__),
        "assigning variable w0");
    }
    current_statement__ = 1094;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(1))) {
      current_statement__ = 1093;
      stan::model::assign(w1, which(status, 1, pstream__),
        "assigning variable w1");
    }
    current_statement__ = 1096;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(2))) {
      current_statement__ = 1095;
      stan::model::assign(w2, which(status, 2, pstream__),
        "assigning variable w2");
    }
    current_statement__ = 1098;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(3))) {
      current_statement__ = 1097;
      stan::model::assign(w3, which(status, 3, pstream__),
        "assigning variable w3");
    }
    current_statement__ = 1100;
    if (nd) {
      current_statement__ = 1099;
      stan::model::assign(wd, which_gt0(delay_time, pstream__),
        "assigning variable wd");
    }
    current_statement__ = 1118;
    if ((stan::math::primitive_value(
           (stan::math::primitive_value(stan::math::logical_eq(dist, 6)) ||
           stan::math::primitive_value(stan::math::logical_eq(dist, 8))))
        || stan::math::primitive_value(stan::math::logical_eq(dist, 9)))) {
      current_statement__ = 1104;
      stan::model::assign(l,
        lS(dist,
          stan::model::rvalue(time, "time", stan::model::index_multi(w0)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(w0)),
          stan::model::rvalue(aux, "aux", stan::model::index_multi(w0)),
          stan::model::rvalue(aux2, "aux2", stan::model::index_multi(w0)),
          pstream__), "assigning variable l", stan::model::index_multi(w0));
      current_statement__ = 1108;
      if (stan::math::logical_eq(dist, 6)) {
        current_statement__ = 1107;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1106;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1105;
            stan::model::assign(l,
              stan::math::lognormal_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                stan::model::rvalue(aux, "aux", stan::model::index_uni(i))),
              "assigning variable l", stan::model::index_uni(i));
          }
        }
      }
      current_statement__ = 1112;
      if (stan::math::logical_eq(dist, 8)) {
        current_statement__ = 1111;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1110;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1109;
            stan::model::assign(l,
              stan::math::gamma_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                stan::model::rvalue(aux, "aux", stan::model::index_uni(i)),
                stan::math::exp(
                  -stan::model::rvalue(eta, "eta", stan::model::index_uni(i)))),
              "assigning variable l", stan::model::index_uni(i));
          }
        }
      }
      current_statement__ = 1116;
      if (stan::math::logical_eq(dist, 9)) {
        current_statement__ = 1115;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1114;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1113;
            stan::model::assign(l,
              gengamma_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                stan::model::rvalue(aux, "aux", stan::model::index_uni(i)),
                stan::model::rvalue(aux2, "aux2", stan::model::index_uni(i)),
                pstream__), "assigning variable l", stan::model::index_uni(i));
          }
        }
      }
    } else {
      current_statement__ = 1101;
      stan::model::assign(l, lS(dist, time, eta, aux, aux2, pstream__),
        "assigning variable l");
      current_statement__ = 1102;
      stan::model::assign(l,
        stan::math::add(
          stan::model::deep_copy(
            stan::model::rvalue(l, "l", stan::model::index_multi(w1))),
          lh(dist,
            stan::model::rvalue(time, "time", stan::model::index_multi(w1)),
            stan::model::rvalue(eta, "eta", stan::model::index_multi(w1)),
            stan::model::rvalue(aux, "aux", stan::model::index_multi(w1)),
            stan::model::rvalue(aux2, "aux2", stan::model::index_multi(w1)),
            pstream__)), "assigning variable l", stan::model::index_multi(w1));
    }
    current_statement__ = 1119;
    stan::model::assign(l,
      stan::math::log1m_exp(
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(w2)))),
      "assigning variable l", stan::model::index_multi(w2));
    current_statement__ = 1120;
    stan::model::assign(l,
      stan::math::log_diff_exp(
        lS(dist,
          stan::model::rvalue(start_time, "start_time",
            stan::model::index_multi(w3)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(w3)),
          stan::model::rvalue(aux, "aux", stan::model::index_multi(w3)),
          stan::model::rvalue(aux2, "aux2", stan::model::index_multi(w3)),
          pstream__),
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(w3)))),
      "assigning variable l", stan::model::index_multi(w3));
    current_statement__ = 1121;
    stan::model::assign(l,
      stan::math::subtract(
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(wd))),
        lS(dist,
          stan::model::rvalue(delay_time, "delay_time",
            stan::model::index_multi(wd)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(wd)),
          stan::model::rvalue(aux, "aux", stan::model::index_multi(wd)),
          stan::model::rvalue(aux2, "aux2", stan::model::index_multi(wd)),
          pstream__)), "assigning variable l", stan::model::index_multi(wd));
    current_statement__ = 1122;
    return l;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_col_vector<T1__>,
                              stan::is_vt_not_complex<T1__>,
                              stan::is_col_vector<T2__>,
                              stan::is_vt_not_complex<T2__>,
                              stan::is_col_vector<T3__>,
                              stan::is_vt_not_complex<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_stan_scalar<T6__>,
                              stan::is_stan_scalar<T7__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T1__>,
                stan::base_type_t<T2__>, stan::base_type_t<T3__>,
                stan::base_type_t<T5__>, T6__, stan::promote_args_t<T7__>>,-1,1>
loglik2(const int& dist, const T1__& time_arg__, const T2__&
        start_time_arg__, const T3__& delay_time_arg__,
        const std::vector<int>& status, const T5__& eta_arg__, const T6__&
        aux, const T7__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T1__>,
                             stan::base_type_t<T2__>,
                             stan::base_type_t<T3__>,
                             stan::base_type_t<T5__>, T6__,
                             stan::promote_args_t<T7__>>;
  int current_statement__ = 0;
  const auto& time = stan::math::to_ref(time_arg__);
  const auto& start_time = stan::math::to_ref(start_time_arg__);
  const auto& delay_time = stan::math::to_ref(delay_time_arg__);
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1124;
    n = stan::math::num_elements(eta);
    current_statement__ = 1125;
    stan::math::validate_non_negative_index("l", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> l =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    std::vector<int> nw =
      std::vector<int>(3, std::numeric_limits<int>::min());
    current_statement__ = 1127;
    stan::model::assign(nw, nwhich_all(status, 3, pstream__),
      "assigning variable nw");
    int nw0 = std::numeric_limits<int>::min();
    current_statement__ = 1128;
    nw0 = ((stan::math::primitive_value(
              (stan::math::primitive_value(stan::math::logical_eq(dist, 6))
              ||
              stan::math::primitive_value(stan::math::logical_eq(dist, 8))))
      || stan::math::primitive_value(stan::math::logical_eq(dist, 9))) ? (n -
      stan::math::sum(nw)) : 0);
    current_statement__ = 1129;
    stan::math::validate_non_negative_index("w0", "nw0", nw0);
    std::vector<int> w0 =
      std::vector<int>(nw0, std::numeric_limits<int>::min());
    current_statement__ = 1131;
    stan::math::validate_non_negative_index("w1", "nw[1]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(1)));
    std::vector<int> w1 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(1)),
        std::numeric_limits<int>::min());
    current_statement__ = 1133;
    stan::math::validate_non_negative_index("w2", "nw[2]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(2)));
    std::vector<int> w2 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(2)),
        std::numeric_limits<int>::min());
    current_statement__ = 1135;
    stan::math::validate_non_negative_index("w3", "nw[3]",
      stan::model::rvalue(nw, "nw", stan::model::index_uni(3)));
    std::vector<int> w3 =
      std::vector<int>(stan::model::rvalue(nw, "nw",
                         stan::model::index_uni(3)),
        std::numeric_limits<int>::min());
    int nd = std::numeric_limits<int>::min();
    current_statement__ = 1137;
    nd = stan::math::num_elements(which_gt0(delay_time, pstream__));
    current_statement__ = 1138;
    stan::math::validate_non_negative_index("wd", "nd", nd);
    std::vector<int> wd =
      std::vector<int>(nd, std::numeric_limits<int>::min());
    current_statement__ = 1141;
    if (nw0) {
      current_statement__ = 1140;
      stan::model::assign(w0, which(status, 0, pstream__),
        "assigning variable w0");
    }
    current_statement__ = 1143;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(1))) {
      current_statement__ = 1142;
      stan::model::assign(w1, which(status, 1, pstream__),
        "assigning variable w1");
    }
    current_statement__ = 1145;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(2))) {
      current_statement__ = 1144;
      stan::model::assign(w2, which(status, 2, pstream__),
        "assigning variable w2");
    }
    current_statement__ = 1147;
    if (stan::model::rvalue(nw, "nw", stan::model::index_uni(3))) {
      current_statement__ = 1146;
      stan::model::assign(w3, which(status, 3, pstream__),
        "assigning variable w3");
    }
    current_statement__ = 1149;
    if (nd) {
      current_statement__ = 1148;
      stan::model::assign(wd, which_gt0(delay_time, pstream__),
        "assigning variable wd");
    }
    current_statement__ = 1167;
    if ((stan::math::primitive_value(
           (stan::math::primitive_value(stan::math::logical_eq(dist, 6)) ||
           stan::math::primitive_value(stan::math::logical_eq(dist, 8))))
        || stan::math::primitive_value(stan::math::logical_eq(dist, 9)))) {
      current_statement__ = 1153;
      stan::model::assign(l,
        lS2(dist,
          stan::model::rvalue(time, "time", stan::model::index_multi(w0)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(w0)), aux,
          aux2, pstream__), "assigning variable l",
        stan::model::index_multi(w0));
      current_statement__ = 1157;
      if (stan::math::logical_eq(dist, 6)) {
        current_statement__ = 1156;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1155;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1154;
            stan::model::assign(l,
              stan::math::lognormal_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                aux), "assigning variable l", stan::model::index_uni(i));
          }
        }
      }
      current_statement__ = 1161;
      if (stan::math::logical_eq(dist, 8)) {
        current_statement__ = 1160;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1159;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1158;
            stan::model::assign(l,
              stan::math::gamma_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                aux,
                stan::math::exp(
                  -stan::model::rvalue(eta, "eta", stan::model::index_uni(i)))),
              "assigning variable l", stan::model::index_uni(i));
          }
        }
      }
      current_statement__ = 1165;
      if (stan::math::logical_eq(dist, 9)) {
        current_statement__ = 1164;
        for (int i = 1; i <= n; ++i) {
          current_statement__ = 1163;
          if (stan::math::logical_eq(
                stan::model::rvalue(status, "status",
                  stan::model::index_uni(i)), 1)) {
            current_statement__ = 1162;
            stan::model::assign(l,
              gengamma_lpdf<false>(
                stan::model::rvalue(time, "time", stan::model::index_uni(i)),
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                aux, aux2, pstream__), "assigning variable l",
              stan::model::index_uni(i));
          }
        }
      }
    } else {
      current_statement__ = 1150;
      stan::model::assign(l, lS2(dist, time, eta, aux, aux2, pstream__),
        "assigning variable l");
      current_statement__ = 1151;
      stan::model::assign(l,
        stan::math::add(
          stan::model::deep_copy(
            stan::model::rvalue(l, "l", stan::model::index_multi(w1))),
          lh2(dist,
            stan::model::rvalue(time, "time", stan::model::index_multi(w1)),
            stan::model::rvalue(eta, "eta", stan::model::index_multi(w1)),
            aux, aux2, pstream__)), "assigning variable l",
        stan::model::index_multi(w1));
    }
    current_statement__ = 1168;
    stan::model::assign(l,
      stan::math::log1m_exp(
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(w2)))),
      "assigning variable l", stan::model::index_multi(w2));
    current_statement__ = 1169;
    stan::model::assign(l,
      stan::math::log_diff_exp(
        lS2(dist,
          stan::model::rvalue(start_time, "start_time",
            stan::model::index_multi(w3)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(w3)), aux,
          aux2, pstream__),
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(w3)))),
      "assigning variable l", stan::model::index_multi(w3));
    current_statement__ = 1170;
    stan::model::assign(l,
      stan::math::subtract(
        stan::model::deep_copy(
          stan::model::rvalue(l, "l", stan::model::index_multi(wd))),
        lS2(dist,
          stan::model::rvalue(delay_time, "delay_time",
            stan::model::index_multi(wd)),
          stan::model::rvalue(eta, "eta", stan::model::index_multi(wd)), aux,
          aux2, pstream__)), "assigning variable l",
      stan::model::index_multi(wd));
    current_statement__ = 1171;
    return l;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_stan_scalar<T6__>,
                              stan::is_stan_scalar<T7__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, T2__, T3__, stan::base_type_t<T5__>,
                T6__, stan::promote_args_t<T7__>>,-1,1>
loglik_a(const int& dist, const T1__& time, const T2__& start_time,
         const T3__& delay_time, const int& status, const T5__& eta_arg__,
         const T6__& aux, const T7__& aux2, std::ostream* pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__, T2__, T3__,
                             stan::base_type_t<T5__>, T6__,
                             stan::promote_args_t<T7__>>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1173;
    n = stan::math::num_elements(eta);
    current_statement__ = 1174;
    stan::math::validate_non_negative_index("l", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> l =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 1202;
    if (stan::math::logical_eq(status, 0)) {
      current_statement__ = 1200;
      stan::model::assign(l, lS_a(dist, time, eta, aux, aux2, pstream__),
        "assigning variable l");
    } else {
      current_statement__ = 1199;
      if (stan::math::logical_eq(status, 1)) {
        current_statement__ = 1197;
        if (stan::math::logical_eq(dist, 6)) {
          current_statement__ = 1195;
          for (int i = 1; i <= n; ++i) {
            current_statement__ = 1194;
            stan::model::assign(l,
              stan::math::lognormal_lpdf<false>(time,
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                aux), "assigning variable l", stan::model::index_uni(i));
          }
        } else {
          current_statement__ = 1193;
          if (stan::math::logical_eq(dist, 8)) {
            current_statement__ = 1188;
            stan::math::validate_non_negative_index("eeta", "n", n);
            Eigen::Matrix<local_scalar_t__,-1,1> eeta =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
            current_statement__ = 1189;
            stan::model::assign(eeta,
              stan::math::exp(stan::math::minus(eta)),
              "assigning variable eeta");
            current_statement__ = 1191;
            for (int i = 1; i <= n; ++i) {
              current_statement__ = 1190;
              stan::model::assign(l,
                stan::math::gamma_lpdf<false>(time, aux,
                  stan::model::rvalue(eeta, "eeta", stan::model::index_uni(i))),
                "assigning variable l", stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 1187;
            if (stan::math::logical_eq(dist, 9)) {
              current_statement__ = 1185;
              for (int i = 1; i <= n; ++i) {
                current_statement__ = 1184;
                stan::model::assign(l,
                  gengamma_lpdf<false>(time,
                    stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                    aux, aux2, pstream__), "assigning variable l",
                  stan::model::index_uni(i));
              }
            } else {
              current_statement__ = 1182;
              stan::model::assign(l,
                stan::math::add(lS_a(dist, time, eta, aux, aux2, pstream__),
                  lh_a(dist, time, eta, aux, aux2, pstream__)),
                "assigning variable l");
            }
          }
        }
      } else {
        current_statement__ = 1181;
        if (stan::math::logical_eq(status, 2)) {
          current_statement__ = 1179;
          stan::model::assign(l,
            stan::math::log1m_exp(lS_a(dist, time, eta, aux, aux2, pstream__)),
            "assigning variable l");
        } else {
          current_statement__ = 1178;
          if (stan::math::logical_eq(status, 3)) {
            current_statement__ = 1176;
            stan::model::assign(l,
              stan::math::log_diff_exp(
                lS_a(dist, start_time, eta, aux, aux2, pstream__),
                lS_a(dist, time, eta, aux, aux2, pstream__)),
              "assigning variable l");
          }
        }
      }
    }
    current_statement__ = 1205;
    if (stan::math::logical_gt(delay_time, 0)) {
      current_statement__ = 1203;
      stan::model::assign(l,
        stan::math::subtract(stan::model::deep_copy(l),
          lS_a(dist, delay_time, eta, aux, aux2, pstream__)),
        "assigning variable l");
    }
    current_statement__ = 1206;
    return l;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
template <typename T1__, typename T2__, typename T3__, typename T5__,
          typename T6__, typename T7__,
          stan::require_all_t<stan::is_stan_scalar<T1__>,
                              stan::is_stan_scalar<T2__>,
                              stan::is_stan_scalar<T3__>,
                              stan::is_col_vector<T5__>,
                              stan::is_vt_not_complex<T5__>,
                              stan::is_col_vector<T6__>,
                              stan::is_vt_not_complex<T6__>,
                              stan::is_col_vector<T7__>,
                              stan::is_vt_not_complex<T7__>>*>
Eigen::Matrix<stan::promote_args_t<T1__, T2__, T3__, stan::base_type_t<T5__>,
                stan::base_type_t<T6__>,
                stan::promote_args_t<stan::base_type_t<T7__>>>,-1,1>
loglik_a2(const int& dist, const T1__& time, const T2__& start_time,
          const T3__& delay_time, const int& status, const T5__& eta_arg__,
          const T6__& aux_arg__, const T7__& aux2_arg__, std::ostream*
          pstream__) {
  using local_scalar_t__ = stan::promote_args_t<T1__, T2__, T3__,
                             stan::base_type_t<T5__>,
                             stan::base_type_t<T6__>,
                             stan::promote_args_t<stan::base_type_t<T7__>>>;
  int current_statement__ = 0;
  const auto& eta = stan::math::to_ref(eta_arg__);
  const auto& aux = stan::math::to_ref(aux_arg__);
  const auto& aux2 = stan::math::to_ref(aux2_arg__);
  static constexpr bool propto__ = true;
  // suppress unused var warning
  (void) propto__;
  local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  // suppress unused var warning
  (void) DUMMY_VAR__;
  try {
    int n = std::numeric_limits<int>::min();
    current_statement__ = 1208;
    n = stan::math::num_elements(eta);
    current_statement__ = 1209;
    stan::math::validate_non_negative_index("l", "n", n);
    Eigen::Matrix<local_scalar_t__,-1,1> l =
      Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
    current_statement__ = 1237;
    if (stan::math::logical_eq(status, 0)) {
      current_statement__ = 1235;
      stan::model::assign(l, lS_a2(dist, time, eta, aux, aux2, pstream__),
        "assigning variable l");
    } else {
      current_statement__ = 1234;
      if (stan::math::logical_eq(status, 1)) {
        current_statement__ = 1232;
        if (stan::math::logical_eq(dist, 6)) {
          current_statement__ = 1230;
          for (int i = 1; i <= n; ++i) {
            current_statement__ = 1229;
            stan::model::assign(l,
              stan::math::lognormal_lpdf<false>(time,
                stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                stan::model::rvalue(aux, "aux", stan::model::index_uni(i))),
              "assigning variable l", stan::model::index_uni(i));
          }
        } else {
          current_statement__ = 1228;
          if (stan::math::logical_eq(dist, 8)) {
            current_statement__ = 1223;
            stan::math::validate_non_negative_index("eeta", "n", n);
            Eigen::Matrix<local_scalar_t__,-1,1> eeta =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n, DUMMY_VAR__);
            current_statement__ = 1224;
            stan::model::assign(eeta,
              stan::math::exp(stan::math::minus(eta)),
              "assigning variable eeta");
            current_statement__ = 1226;
            for (int i = 1; i <= n; ++i) {
              current_statement__ = 1225;
              stan::model::assign(l,
                stan::math::gamma_lpdf<false>(time,
                  stan::model::rvalue(aux, "aux", stan::model::index_uni(i)),
                  stan::model::rvalue(eeta, "eeta", stan::model::index_uni(i))),
                "assigning variable l", stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 1222;
            if (stan::math::logical_eq(dist, 9)) {
              current_statement__ = 1220;
              for (int i = 1; i <= n; ++i) {
                current_statement__ = 1219;
                stan::model::assign(l,
                  gengamma_lpdf<false>(time,
                    stan::model::rvalue(eta, "eta", stan::model::index_uni(i)),
                    stan::model::rvalue(aux, "aux", stan::model::index_uni(i)),
                    stan::model::rvalue(aux2, "aux2",
                      stan::model::index_uni(i)), pstream__),
                  "assigning variable l", stan::model::index_uni(i));
              }
            } else {
              current_statement__ = 1217;
              stan::model::assign(l,
                stan::math::add(lS_a2(dist, time, eta, aux, aux2, pstream__),
                  lh_a2(dist, time, eta, aux, aux2, pstream__)),
                "assigning variable l");
            }
          }
        }
      } else {
        current_statement__ = 1216;
        if (stan::math::logical_eq(status, 2)) {
          current_statement__ = 1214;
          stan::model::assign(l,
            stan::math::log1m_exp(
              lS_a2(dist, time, eta, aux, aux2, pstream__)),
            "assigning variable l");
        } else {
          current_statement__ = 1213;
          if (stan::math::logical_eq(status, 3)) {
            current_statement__ = 1211;
            stan::model::assign(l,
              stan::math::log_diff_exp(
                lS_a2(dist, start_time, eta, aux, aux2, pstream__),
                lS_a2(dist, time, eta, aux, aux2, pstream__)),
              "assigning variable l");
          }
        }
      }
    }
    current_statement__ = 1240;
    if (stan::math::logical_gt(delay_time, 0)) {
      current_statement__ = 1238;
      stan::model::assign(l,
        stan::math::subtract(stan::model::deep_copy(l),
          lS_a2(dist, delay_time, eta, aux, aux2, pstream__)),
        "assigning variable l");
    }
    current_statement__ = 1241;
    return l;
  } catch (const std::exception& e) {
    stan::lang::rethrow_located(e, locations_array__[current_statement__]);
  }
}
#include <stan_meta_header.hpp>
class model_survival_param final : public model_base_crtp<model_survival_param> {
private:
  int ns_ipd;
  int ns_agd_arm;
  int ns_agd_contrast;
  int ni_ipd;
  int ni_agd_arm;
  int ni_agd_contrast;
  int narm_ipd;
  std::vector<int> ipd_arm;
  std::vector<int> ipd_trt;
  int narm_agd_arm;
  std::vector<int> agd_arm_trt;
  std::vector<int> agd_contrast_trt;
  std::vector<int> agd_contrast_trt_b;
  int nt;
  int nX;
  int nchains;
  int CHAIN_ID;
  std::vector<int> nint_vec;
  int nint_max;
  int int_thin;
  int link;
  Eigen::Matrix<double,-1,1> agd_contrast_y_data__;
  Eigen::Matrix<double,-1,-1> agd_contrast_Sigma_data__;
  int QR;
  Eigen::Matrix<double,-1,-1> X_data__;
  Eigen::Matrix<double,-1,-1> R_inv_data__;
  int has_offset;
  Eigen::Matrix<double,-1,1> offsets_data__;
  int RE;
  std::vector<int> which_RE;
  Eigen::Matrix<double,-1,-1> RE_cor_data__;
  int nodesplit;
  int brmr_n_col;
  std::vector<int> brmr_col;
  double xbar_mu;
  int prior_intercept_dist;
  double prior_intercept_location;
  double prior_intercept_scale;
  double prior_intercept_df;
  int prior_trt_dist;
  double prior_trt_location;
  double prior_trt_scale;
  double prior_trt_df;
  int prior_het_dist;
  int prior_het_type;
  double prior_het_location;
  double prior_het_scale;
  double prior_het_df;
  int prior_reg_dist;
  double prior_reg_location;
  double prior_reg_scale;
  double prior_reg_df;
  int class_effects;
  std::vector<int> which_CE;
  std::vector<int> which_CE_sd;
  int prior_class_mean_dist;
  double prior_class_mean_location;
  double prior_class_mean_scale;
  double prior_class_mean_df;
  int prior_class_sd_dist;
  double prior_class_sd_location;
  double prior_class_sd_scale;
  double prior_class_sd_df;
  int prior_aux_dist;
  double prior_aux_location;
  double prior_aux_scale;
  double prior_aux_df;
  int prior_aux2_dist;
  double prior_aux2_location;
  double prior_aux2_scale;
  double prior_aux2_df;
  int dist;
  std::vector<int> agd_arm_arm;
  Eigen::Matrix<double,-1,1> ipd_time_data__;
  Eigen::Matrix<double,-1,1> ipd_start_time_data__;
  Eigen::Matrix<double,-1,1> ipd_delay_time_data__;
  std::vector<int> ipd_status;
  Eigen::Matrix<double,-1,1> agd_arm_time_data__;
  Eigen::Matrix<double,-1,1> agd_arm_start_time_data__;
  Eigen::Matrix<double,-1,1> agd_arm_delay_time_data__;
  std::vector<int> agd_arm_status;
  int aux_int;
  std::vector<int> aux_id;
  std::vector<int> aux_group;
  int nX_aux;
  Eigen::Matrix<double,-1,-1> X_aux_data__;
  int aux_reg_trt;
  int prior_aux_reg_dist;
  double prior_aux_reg_location;
  double prior_aux_reg_scale;
  double prior_aux_reg_df;
  int nonexp;
  int gengamma;
  int n_aux;
  int n_aux_group;
  std::vector<int> agd_arm_arm2;
  std::vector<int> aux_id_ipd;
  std::vector<int> aux_id_agd_arm;
  std::vector<int> aux_group_ipd;
  std::vector<int> aux_group_agd_arm;
  std::vector<int> ni_aux_group_ipd;
  std::vector<std::vector<int>> wi_aux_group_ipd;
  std::vector<int> ni_aux_group_agd_arm;
  std::vector<std::vector<int>> wi_aux_group_agd_arm;
  Eigen::Matrix<double,-1,-1> Xauxdummy_data__;
  Eigen::Matrix<double,-1,-1> X_aux_ipd_data__;
  Eigen::Matrix<double,-1,-1> X_aux_agd_arm_data__;
  int nint;
  int n_delta;
  Eigen::Matrix<double,-1,1> RE_mu_data__;
  Eigen::Matrix<double,-1,-1> REdummy_data__;
  Eigen::Matrix<double,-1,-1> RE_L_data__;
  Eigen::Matrix<double,-1,1> wdummy_data__;
  std::vector<int> vudummy;
  int RE_L_nz;
  int RE_sparse;
  Eigen::Matrix<double,-1,1> RE_L_w_data__;
  std::vector<int> RE_L_v;
  std::vector<int> RE_L_u;
  int totns;
  std::vector<int> trt;
  Eigen::Matrix<double,-1,-1> Xdummy_data__;
  Eigen::Matrix<double,-1,-1> X_ipd_data__;
  Eigen::Matrix<double,-1,-1> X_agd_arm_data__;
  Eigen::Matrix<double,-1,-1> X_agd_contrast_data__;
  Eigen::Matrix<double,-1,1> odummy_data__;
  Eigen::Matrix<double,-1,1> offset_ipd_data__;
  Eigen::Matrix<double,-1,1> offset_agd_arm_data__;
  Eigen::Matrix<double,-1,1> offset_agd_contrast_data__;
  int n_int_thin;
  Eigen::Matrix<double,-1,-1> inv_Sigma_data__;
  std::vector<int> nc_agd_contrast;
  int n_class_trts;
  std::vector<int> which_class_trt;
  int n_class;
  std::vector<int> which_fclass;
  int tau_1dim__;
  int class_mean_1dim__;
  int class_sd_1dim__;
  int z_class_1dim__;
  int aux2_1dim__;
  int beta_aux_1dim__;
  int beta_aux_2dim__;
  int f_class_1dim__;
  int d_1dim__;
  int beta_1dim__;
  int eta_agd_contrast_ii_1dim__;
  int shape_1dim__;
  int sdlog_1dim__;
  int sigma_1dim__;
  int k_1dim__;
  int d_aux_1dim__;
  int d_aux_2dim__;
  int log_lik_1dim__;
  int resdev_1dim__;
  int theta_bar_cum_agd_contrast_1dim__;
  Eigen::Map<Eigen::Matrix<double,-1,1>> agd_contrast_y{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> agd_contrast_Sigma{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> R_inv{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> offsets{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> RE_cor{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> ipd_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> ipd_start_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> ipd_delay_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> agd_arm_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> agd_arm_start_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> agd_arm_delay_time{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_aux{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> Xauxdummy{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_aux_ipd{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_aux_agd_arm{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> RE_mu{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> REdummy{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> RE_L{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> wdummy{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> RE_L_w{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> Xdummy{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_ipd{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_agd_arm{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> X_agd_contrast{nullptr, 0, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> odummy{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> offset_ipd{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> offset_agd_arm{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,1>> offset_agd_contrast{nullptr, 0};
  Eigen::Map<Eigen::Matrix<double,-1,-1>> inv_Sigma{nullptr, 0, 0};
public:
  ~model_survival_param() {}
  model_survival_param(stan::io::var_context& context__, unsigned int
                       random_seed__ = 0, std::ostream* pstream__ = nullptr)
      : model_base_crtp(0) {
    int current_statement__ = 0;
    using local_scalar_t__ = double;
    boost::ecuyer1988 base_rng__ =
      stan::services::util::create_rng(random_seed__, 0);
    // suppress unused var warning
    (void) base_rng__;
    static constexpr const char* function__ =
      "model_survival_param_namespace::model_survival_param";
    // suppress unused var warning
    (void) function__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      current_statement__ = 390;
      context__.validate_dims("data initialization", "ns_ipd", "int",
        std::vector<size_t>{});
      ns_ipd = std::numeric_limits<int>::min();
      current_statement__ = 390;
      ns_ipd = context__.vals_i("ns_ipd")[(1 - 1)];
      current_statement__ = 390;
      stan::math::check_greater_or_equal(function__, "ns_ipd", ns_ipd, 0);
      current_statement__ = 391;
      context__.validate_dims("data initialization", "ns_agd_arm", "int",
        std::vector<size_t>{});
      ns_agd_arm = std::numeric_limits<int>::min();
      current_statement__ = 391;
      ns_agd_arm = context__.vals_i("ns_agd_arm")[(1 - 1)];
      current_statement__ = 391;
      stan::math::check_greater_or_equal(function__, "ns_agd_arm",
        ns_agd_arm, 0);
      current_statement__ = 392;
      context__.validate_dims("data initialization", "ns_agd_contrast",
        "int", std::vector<size_t>{});
      ns_agd_contrast = std::numeric_limits<int>::min();
      current_statement__ = 392;
      ns_agd_contrast = context__.vals_i("ns_agd_contrast")[(1 - 1)];
      current_statement__ = 392;
      stan::math::check_greater_or_equal(function__, "ns_agd_contrast",
        ns_agd_contrast, 0);
      current_statement__ = 393;
      context__.validate_dims("data initialization", "ni_ipd", "int",
        std::vector<size_t>{});
      ni_ipd = std::numeric_limits<int>::min();
      current_statement__ = 393;
      ni_ipd = context__.vals_i("ni_ipd")[(1 - 1)];
      current_statement__ = 393;
      stan::math::check_greater_or_equal(function__, "ni_ipd", ni_ipd, 0);
      current_statement__ = 394;
      context__.validate_dims("data initialization", "ni_agd_arm", "int",
        std::vector<size_t>{});
      ni_agd_arm = std::numeric_limits<int>::min();
      current_statement__ = 394;
      ni_agd_arm = context__.vals_i("ni_agd_arm")[(1 - 1)];
      current_statement__ = 394;
      stan::math::check_greater_or_equal(function__, "ni_agd_arm",
        ni_agd_arm, 0);
      current_statement__ = 395;
      context__.validate_dims("data initialization", "ni_agd_contrast",
        "int", std::vector<size_t>{});
      ni_agd_contrast = std::numeric_limits<int>::min();
      current_statement__ = 395;
      ni_agd_contrast = context__.vals_i("ni_agd_contrast")[(1 - 1)];
      current_statement__ = 395;
      stan::math::check_greater_or_equal(function__, "ni_agd_contrast",
        ni_agd_contrast, 0);
      current_statement__ = 396;
      context__.validate_dims("data initialization", "narm_ipd", "int",
        std::vector<size_t>{});
      narm_ipd = std::numeric_limits<int>::min();
      current_statement__ = 396;
      narm_ipd = context__.vals_i("narm_ipd")[(1 - 1)];
      current_statement__ = 396;
      stan::math::check_greater_or_equal(function__, "narm_ipd", narm_ipd, 0);
      current_statement__ = 397;
      stan::math::validate_non_negative_index("ipd_arm", "ni_ipd", ni_ipd);
      current_statement__ = 398;
      context__.validate_dims("data initialization", "ipd_arm", "int",
        std::vector<size_t>{static_cast<size_t>(ni_ipd)});
      ipd_arm = std::vector<int>(ni_ipd, std::numeric_limits<int>::min());
      current_statement__ = 398;
      ipd_arm = context__.vals_i("ipd_arm");
      current_statement__ = 398;
      stan::math::check_greater_or_equal(function__, "ipd_arm", ipd_arm, 1);
      current_statement__ = 399;
      stan::math::validate_non_negative_index("ipd_trt", "narm_ipd", narm_ipd);
      current_statement__ = 400;
      context__.validate_dims("data initialization", "ipd_trt", "int",
        std::vector<size_t>{static_cast<size_t>(narm_ipd)});
      ipd_trt = std::vector<int>(narm_ipd, std::numeric_limits<int>::min());
      current_statement__ = 400;
      ipd_trt = context__.vals_i("ipd_trt");
      current_statement__ = 400;
      stan::math::check_greater_or_equal(function__, "ipd_trt", ipd_trt, 1);
      current_statement__ = 401;
      context__.validate_dims("data initialization", "narm_agd_arm", "int",
        std::vector<size_t>{});
      narm_agd_arm = std::numeric_limits<int>::min();
      current_statement__ = 401;
      narm_agd_arm = context__.vals_i("narm_agd_arm")[(1 - 1)];
      current_statement__ = 401;
      stan::math::check_greater_or_equal(function__, "narm_agd_arm",
        narm_agd_arm, 0);
      current_statement__ = 402;
      stan::math::validate_non_negative_index("agd_arm_trt", "narm_agd_arm",
        narm_agd_arm);
      current_statement__ = 403;
      context__.validate_dims("data initialization", "agd_arm_trt", "int",
        std::vector<size_t>{static_cast<size_t>(narm_agd_arm)});
      agd_arm_trt = std::vector<int>(narm_agd_arm,
                      std::numeric_limits<int>::min());
      current_statement__ = 403;
      agd_arm_trt = context__.vals_i("agd_arm_trt");
      current_statement__ = 403;
      stan::math::check_greater_or_equal(function__, "agd_arm_trt",
        agd_arm_trt, 1);
      current_statement__ = 404;
      stan::math::validate_non_negative_index("agd_contrast_trt",
        "ni_agd_contrast", ni_agd_contrast);
      current_statement__ = 405;
      context__.validate_dims("data initialization", "agd_contrast_trt",
        "int", std::vector<size_t>{static_cast<size_t>(ni_agd_contrast)});
      agd_contrast_trt = std::vector<int>(ni_agd_contrast,
                           std::numeric_limits<int>::min());
      current_statement__ = 405;
      agd_contrast_trt = context__.vals_i("agd_contrast_trt");
      current_statement__ = 405;
      stan::math::check_greater_or_equal(function__, "agd_contrast_trt",
        agd_contrast_trt, 1);
      current_statement__ = 406;
      stan::math::validate_non_negative_index("agd_contrast_trt_b",
        "ni_agd_contrast", ni_agd_contrast);
      current_statement__ = 407;
      context__.validate_dims("data initialization", "agd_contrast_trt_b",
        "int", std::vector<size_t>{static_cast<size_t>(ni_agd_contrast)});
      agd_contrast_trt_b = std::vector<int>(ni_agd_contrast,
                             std::numeric_limits<int>::min());
      current_statement__ = 407;
      agd_contrast_trt_b = context__.vals_i("agd_contrast_trt_b");
      current_statement__ = 407;
      stan::math::check_greater_or_equal(function__, "agd_contrast_trt_b",
        agd_contrast_trt_b, 1);
      current_statement__ = 408;
      context__.validate_dims("data initialization", "nt", "int",
        std::vector<size_t>{});
      nt = std::numeric_limits<int>::min();
      current_statement__ = 408;
      nt = context__.vals_i("nt")[(1 - 1)];
      current_statement__ = 408;
      stan::math::check_greater_or_equal(function__, "nt", nt, 1);
      current_statement__ = 409;
      context__.validate_dims("data initialization", "nX", "int",
        std::vector<size_t>{});
      nX = std::numeric_limits<int>::min();
      current_statement__ = 409;
      nX = context__.vals_i("nX")[(1 - 1)];
      current_statement__ = 409;
      stan::math::check_greater_or_equal(function__, "nX", nX, 0);
      current_statement__ = 410;
      context__.validate_dims("data initialization", "nchains", "int",
        std::vector<size_t>{});
      nchains = std::numeric_limits<int>::min();
      current_statement__ = 410;
      nchains = context__.vals_i("nchains")[(1 - 1)];
      current_statement__ = 410;
      stan::math::check_greater_or_equal(function__, "nchains", nchains, 1);
      current_statement__ = 411;
      context__.validate_dims("data initialization", "CHAIN_ID", "int",
        std::vector<size_t>{});
      CHAIN_ID = std::numeric_limits<int>::min();
      current_statement__ = 411;
      CHAIN_ID = context__.vals_i("CHAIN_ID")[(1 - 1)];
      current_statement__ = 411;
      stan::math::check_greater_or_equal(function__, "CHAIN_ID", CHAIN_ID, 1);
      current_statement__ = 411;
      stan::math::check_less_or_equal(function__, "CHAIN_ID", CHAIN_ID,
        nchains);
      current_statement__ = 412;
      stan::math::validate_non_negative_index("nint_vec", "nchains", nchains);
      current_statement__ = 413;
      context__.validate_dims("data initialization", "nint_vec", "int",
        std::vector<size_t>{static_cast<size_t>(nchains)});
      nint_vec = std::vector<int>(nchains, std::numeric_limits<int>::min());
      current_statement__ = 413;
      nint_vec = context__.vals_i("nint_vec");
      current_statement__ = 413;
      stan::math::check_greater_or_equal(function__, "nint_vec", nint_vec, 1);
      current_statement__ = 414;
      context__.validate_dims("data initialization", "nint_max", "int",
        std::vector<size_t>{});
      nint_max = std::numeric_limits<int>::min();
      current_statement__ = 414;
      nint_max = context__.vals_i("nint_max")[(1 - 1)];
      current_statement__ = 414;
      stan::math::check_greater_or_equal(function__, "nint_max", nint_max, 1);
      current_statement__ = 415;
      context__.validate_dims("data initialization", "int_thin", "int",
        std::vector<size_t>{});
      int_thin = std::numeric_limits<int>::min();
      current_statement__ = 415;
      int_thin = context__.vals_i("int_thin")[(1 - 1)];
      current_statement__ = 415;
      stan::math::check_greater_or_equal(function__, "int_thin", int_thin, 0);
      current_statement__ = 416;
      context__.validate_dims("data initialization", "link", "int",
        std::vector<size_t>{});
      link = std::numeric_limits<int>::min();
      current_statement__ = 416;
      link = context__.vals_i("link")[(1 - 1)];
      current_statement__ = 416;
      stan::math::check_greater_or_equal(function__, "link", link, 1);
      current_statement__ = 417;
      stan::math::validate_non_negative_index("agd_contrast_y",
        "ni_agd_contrast", ni_agd_contrast);
      current_statement__ = 418;
      context__.validate_dims("data initialization", "agd_contrast_y",
        "double", std::vector<size_t>{static_cast<size_t>(ni_agd_contrast)});
      agd_contrast_y_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_agd_contrast,
                                std::numeric_limits<double>::quiet_NaN());
      new (&agd_contrast_y)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(agd_contrast_y_data__.data(),
        ni_agd_contrast);
      {
        std::vector<local_scalar_t__> agd_contrast_y_flat__;
        current_statement__ = 418;
        agd_contrast_y_flat__ = context__.vals_r("agd_contrast_y");
        current_statement__ = 418;
        pos__ = 1;
        current_statement__ = 418;
        for (int sym1__ = 1; sym1__ <= ni_agd_contrast; ++sym1__) {
          current_statement__ = 418;
          stan::model::assign(agd_contrast_y, agd_contrast_y_flat__[(pos__ -
            1)], "assigning variable agd_contrast_y",
            stan::model::index_uni(sym1__));
          current_statement__ = 418;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 419;
      stan::math::validate_non_negative_index("agd_contrast_Sigma",
        "ni_agd_contrast ? ni_agd_contrast : 1",
        (ni_agd_contrast ? ni_agd_contrast : 1));
      current_statement__ = 419;
      stan::math::validate_non_negative_index("agd_contrast_Sigma",
        "ni_agd_contrast ? ni_agd_contrast : 1",
        (ni_agd_contrast ? ni_agd_contrast : 1));
      current_statement__ = 420;
      context__.validate_dims("data initialization", "agd_contrast_Sigma",
        "double",
        std::vector<size_t>{static_cast<size_t>(
                              (ni_agd_contrast ? ni_agd_contrast : 1)),
          static_cast<size_t>((ni_agd_contrast ? ni_agd_contrast : 1))});
      agd_contrast_Sigma_data__ = Eigen::Matrix<double,-1,-1>::Constant((ni_agd_contrast ? ni_agd_contrast : 1),
                                    (ni_agd_contrast ? ni_agd_contrast : 1),
                                    std::numeric_limits<double>::quiet_NaN());
      new (&agd_contrast_Sigma)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(agd_contrast_Sigma_data__.data(),
        (ni_agd_contrast ? ni_agd_contrast : 1),
        (ni_agd_contrast ? ni_agd_contrast : 1));
      {
        std::vector<local_scalar_t__> agd_contrast_Sigma_flat__;
        current_statement__ = 420;
        agd_contrast_Sigma_flat__ = context__.vals_r("agd_contrast_Sigma");
        current_statement__ = 420;
        pos__ = 1;
        current_statement__ = 420;
        for (int sym1__ = 1; sym1__ <=
             (ni_agd_contrast ? ni_agd_contrast : 1); ++sym1__) {
          current_statement__ = 420;
          for (int sym2__ = 1; sym2__ <=
               (ni_agd_contrast ? ni_agd_contrast : 1); ++sym2__) {
            current_statement__ = 420;
            stan::model::assign(agd_contrast_Sigma,
              agd_contrast_Sigma_flat__[(pos__ - 1)],
              "assigning variable agd_contrast_Sigma",
              stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
            current_statement__ = 420;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 420;
      stan::math::check_cov_matrix(function__, "agd_contrast_Sigma",
        agd_contrast_Sigma);
      current_statement__ = 421;
      context__.validate_dims("data initialization", "QR", "int",
        std::vector<size_t>{});
      QR = std::numeric_limits<int>::min();
      current_statement__ = 421;
      QR = context__.vals_i("QR")[(1 - 1)];
      current_statement__ = 421;
      stan::math::check_greater_or_equal(function__, "QR", QR, 0);
      current_statement__ = 421;
      stan::math::check_less_or_equal(function__, "QR", QR, 1);
      current_statement__ = 422;
      stan::math::validate_non_negative_index("X",
        "ni_ipd + nint_max * (ni_agd_arm + ni_agd_contrast)", (ni_ipd +
        (nint_max * (ni_agd_arm + ni_agd_contrast))));
      current_statement__ = 423;
      stan::math::validate_non_negative_index("X", "nX", nX);
      current_statement__ = 424;
      context__.validate_dims("data initialization", "X", "double",
        std::vector<size_t>{static_cast<size_t>((ni_ipd + (nint_max *
                              (ni_agd_arm + ni_agd_contrast)))),
          static_cast<size_t>(nX)});
      X_data__ = Eigen::Matrix<double,-1,-1>::Constant((ni_ipd + (nint_max *
                   (ni_agd_arm + ni_agd_contrast))), nX,
                   std::numeric_limits<double>::quiet_NaN());
      new (&X) Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_data__.data(),
        (ni_ipd + (nint_max * (ni_agd_arm + ni_agd_contrast))), nX);
      {
        std::vector<local_scalar_t__> X_flat__;
        current_statement__ = 424;
        X_flat__ = context__.vals_r("X");
        current_statement__ = 424;
        pos__ = 1;
        current_statement__ = 424;
        for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
          current_statement__ = 424;
          for (int sym2__ = 1; sym2__ <= (ni_ipd + (nint_max * (ni_agd_arm +
               ni_agd_contrast))); ++sym2__) {
            current_statement__ = 424;
            stan::model::assign(X, X_flat__[(pos__ - 1)],
              "assigning variable X", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 424;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 425;
      stan::math::validate_non_negative_index("R_inv", "QR ? nX : 0",
        (QR ? nX : 0));
      current_statement__ = 426;
      stan::math::validate_non_negative_index("R_inv", "QR ? nX : 0",
        (QR ? nX : 0));
      current_statement__ = 427;
      context__.validate_dims("data initialization", "R_inv", "double",
        std::vector<size_t>{static_cast<size_t>((QR ? nX : 0)),
          static_cast<size_t>((QR ? nX : 0))});
      R_inv_data__ = Eigen::Matrix<double,-1,-1>::Constant((QR ? nX : 0),
                       (QR ? nX : 0),
                       std::numeric_limits<double>::quiet_NaN());
      new (&R_inv)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(R_inv_data__.data(),
        (QR ? nX : 0), (QR ? nX : 0));
      {
        std::vector<local_scalar_t__> R_inv_flat__;
        current_statement__ = 427;
        R_inv_flat__ = context__.vals_r("R_inv");
        current_statement__ = 427;
        pos__ = 1;
        current_statement__ = 427;
        for (int sym1__ = 1; sym1__ <= (QR ? nX : 0); ++sym1__) {
          current_statement__ = 427;
          for (int sym2__ = 1; sym2__ <= (QR ? nX : 0); ++sym2__) {
            current_statement__ = 427;
            stan::model::assign(R_inv, R_inv_flat__[(pos__ - 1)],
              "assigning variable R_inv", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 427;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 428;
      context__.validate_dims("data initialization", "has_offset", "int",
        std::vector<size_t>{});
      has_offset = std::numeric_limits<int>::min();
      current_statement__ = 428;
      has_offset = context__.vals_i("has_offset")[(1 - 1)];
      current_statement__ = 428;
      stan::math::check_greater_or_equal(function__, "has_offset",
        has_offset, 0);
      current_statement__ = 428;
      stan::math::check_less_or_equal(function__, "has_offset", has_offset, 1);
      current_statement__ = 429;
      stan::math::validate_non_negative_index("offsets",
        "has_offset ? ni_ipd + nint_max * (ni_agd_arm + ni_agd_contrast) : 0",
        (has_offset ? (ni_ipd + (nint_max * (ni_agd_arm +
        ni_agd_contrast))) : 0));
      current_statement__ = 430;
      context__.validate_dims("data initialization", "offsets", "double",
        std::vector<size_t>{static_cast<size_t>((has_offset ? (ni_ipd +
                              (nint_max * (ni_agd_arm +
                              ni_agd_contrast))) : 0))});
      offsets_data__ = Eigen::Matrix<double,-1,1>::Constant((has_offset ? (ni_ipd
                         + (nint_max * (ni_agd_arm + ni_agd_contrast))) : 0),
                         std::numeric_limits<double>::quiet_NaN());
      new (&offsets)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(offsets_data__.data(),
        (has_offset ? (ni_ipd + (nint_max * (ni_agd_arm +
        ni_agd_contrast))) : 0));
      {
        std::vector<local_scalar_t__> offsets_flat__;
        current_statement__ = 430;
        offsets_flat__ = context__.vals_r("offsets");
        current_statement__ = 430;
        pos__ = 1;
        current_statement__ = 430;
        for (int sym1__ = 1; sym1__ <= (has_offset ? (ni_ipd + (nint_max *
             (ni_agd_arm + ni_agd_contrast))) : 0); ++sym1__) {
          current_statement__ = 430;
          stan::model::assign(offsets, offsets_flat__[(pos__ - 1)],
            "assigning variable offsets", stan::model::index_uni(sym1__));
          current_statement__ = 430;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 431;
      context__.validate_dims("data initialization", "RE", "int",
        std::vector<size_t>{});
      RE = std::numeric_limits<int>::min();
      current_statement__ = 431;
      RE = context__.vals_i("RE")[(1 - 1)];
      current_statement__ = 431;
      stan::math::check_greater_or_equal(function__, "RE", RE, 0);
      current_statement__ = 431;
      stan::math::check_less_or_equal(function__, "RE", RE, 1);
      current_statement__ = 432;
      stan::math::validate_non_negative_index("which_RE",
        "RE ? narm_ipd + narm_agd_arm + ni_agd_contrast : 0",
        (RE ? ((narm_ipd + narm_agd_arm) + ni_agd_contrast) : 0));
      current_statement__ = 433;
      context__.validate_dims("data initialization", "which_RE", "int",
        std::vector<size_t>{static_cast<size_t>((RE ? ((narm_ipd +
                              narm_agd_arm) + ni_agd_contrast) : 0))});
      which_RE = std::vector<int>((RE ? ((narm_ipd + narm_agd_arm) +
                   ni_agd_contrast) : 0), std::numeric_limits<int>::min());
      current_statement__ = 433;
      which_RE = context__.vals_i("which_RE");
      current_statement__ = 433;
      stan::math::check_greater_or_equal(function__, "which_RE", which_RE, 0);
      current_statement__ = 434;
      stan::math::validate_non_negative_index("RE_cor",
        "RE ? max(which_RE) : 1", (RE ? stan::math::max(which_RE) : 1));
      current_statement__ = 434;
      stan::math::validate_non_negative_index("RE_cor",
        "RE ? max(which_RE) : 1", (RE ? stan::math::max(which_RE) : 1));
      current_statement__ = 435;
      context__.validate_dims("data initialization", "RE_cor", "double",
        std::vector<size_t>{static_cast<size_t>(
                              (RE ? stan::math::max(which_RE) : 1)),
          static_cast<size_t>((RE ? stan::math::max(which_RE) : 1))});
      RE_cor_data__ = Eigen::Matrix<double,-1,-1>::Constant((RE ? stan::math::max(
                                                                    which_RE) : 1),
                        (RE ? stan::math::max(which_RE) : 1),
                        std::numeric_limits<double>::quiet_NaN());
      new (&RE_cor)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(RE_cor_data__.data(),
        (RE ? stan::math::max(which_RE) : 1),
        (RE ? stan::math::max(which_RE) : 1));
      {
        std::vector<local_scalar_t__> RE_cor_flat__;
        current_statement__ = 435;
        RE_cor_flat__ = context__.vals_r("RE_cor");
        current_statement__ = 435;
        pos__ = 1;
        current_statement__ = 435;
        for (int sym1__ = 1; sym1__ <=
             (RE ? stan::math::max(which_RE) : 1); ++sym1__) {
          current_statement__ = 435;
          for (int sym2__ = 1; sym2__ <=
               (RE ? stan::math::max(which_RE) : 1); ++sym2__) {
            current_statement__ = 435;
            stan::model::assign(RE_cor, RE_cor_flat__[(pos__ - 1)],
              "assigning variable RE_cor", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 435;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 435;
      stan::math::check_corr_matrix(function__, "RE_cor", RE_cor);
      current_statement__ = 436;
      context__.validate_dims("data initialization", "nodesplit", "int",
        std::vector<size_t>{});
      nodesplit = std::numeric_limits<int>::min();
      current_statement__ = 436;
      nodesplit = context__.vals_i("nodesplit")[(1 - 1)];
      current_statement__ = 436;
      stan::math::check_greater_or_equal(function__, "nodesplit", nodesplit,
        0);
      current_statement__ = 436;
      stan::math::check_less_or_equal(function__, "nodesplit", nodesplit, 1);
      current_statement__ = 437;
      context__.validate_dims("data initialization", "brmr_n_col", "int",
        std::vector<size_t>{});
      brmr_n_col = std::numeric_limits<int>::min();
      current_statement__ = 437;
      brmr_n_col = context__.vals_i("brmr_n_col")[(1 - 1)];
      current_statement__ = 437;
      stan::math::check_greater_or_equal(function__, "brmr_n_col",
        brmr_n_col, 0);
      current_statement__ = 438;
      stan::math::validate_non_negative_index("brmr_col", "brmr_n_col",
        brmr_n_col);
      current_statement__ = 439;
      context__.validate_dims("data initialization", "brmr_col", "int",
        std::vector<size_t>{static_cast<size_t>(brmr_n_col)});
      brmr_col = std::vector<int>(brmr_n_col,
                   std::numeric_limits<int>::min());
      current_statement__ = 439;
      brmr_col = context__.vals_i("brmr_col");
      current_statement__ = 439;
      stan::math::check_greater_or_equal(function__, "brmr_col", brmr_col, 1);
      current_statement__ = 440;
      context__.validate_dims("data initialization", "xbar_mu", "double",
        std::vector<size_t>{});
      xbar_mu = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 440;
      xbar_mu = context__.vals_r("xbar_mu")[(1 - 1)];
      current_statement__ = 441;
      context__.validate_dims("data initialization", "prior_intercept_dist",
        "int", std::vector<size_t>{});
      prior_intercept_dist = std::numeric_limits<int>::min();
      current_statement__ = 441;
      prior_intercept_dist = context__.vals_i("prior_intercept_dist")[(1 -
        1)];
      current_statement__ = 441;
      stan::math::check_greater_or_equal(function__, "prior_intercept_dist",
        prior_intercept_dist, 0);
      current_statement__ = 441;
      stan::math::check_less_or_equal(function__, "prior_intercept_dist",
        prior_intercept_dist, 3);
      current_statement__ = 442;
      context__.validate_dims("data initialization",
        "prior_intercept_location", "double", std::vector<size_t>{});
      prior_intercept_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 442;
      prior_intercept_location = context__.vals_r("prior_intercept_location")[(1
        - 1)];
      current_statement__ = 443;
      context__.validate_dims("data initialization", "prior_intercept_scale",
        "double", std::vector<size_t>{});
      prior_intercept_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 443;
      prior_intercept_scale = context__.vals_r("prior_intercept_scale")[(1 -
        1)];
      current_statement__ = 443;
      stan::math::check_greater_or_equal(function__, "prior_intercept_scale",
        prior_intercept_scale, 0);
      current_statement__ = 444;
      context__.validate_dims("data initialization", "prior_intercept_df",
        "double", std::vector<size_t>{});
      prior_intercept_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 444;
      prior_intercept_df = context__.vals_r("prior_intercept_df")[(1 - 1)];
      current_statement__ = 444;
      stan::math::check_greater_or_equal(function__, "prior_intercept_df",
        prior_intercept_df, 0);
      current_statement__ = 445;
      context__.validate_dims("data initialization", "prior_trt_dist", "int",
        std::vector<size_t>{});
      prior_trt_dist = std::numeric_limits<int>::min();
      current_statement__ = 445;
      prior_trt_dist = context__.vals_i("prior_trt_dist")[(1 - 1)];
      current_statement__ = 445;
      stan::math::check_greater_or_equal(function__, "prior_trt_dist",
        prior_trt_dist, 0);
      current_statement__ = 445;
      stan::math::check_less_or_equal(function__, "prior_trt_dist",
        prior_trt_dist, 3);
      current_statement__ = 446;
      context__.validate_dims("data initialization", "prior_trt_location",
        "double", std::vector<size_t>{});
      prior_trt_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 446;
      prior_trt_location = context__.vals_r("prior_trt_location")[(1 - 1)];
      current_statement__ = 447;
      context__.validate_dims("data initialization", "prior_trt_scale",
        "double", std::vector<size_t>{});
      prior_trt_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 447;
      prior_trt_scale = context__.vals_r("prior_trt_scale")[(1 - 1)];
      current_statement__ = 447;
      stan::math::check_greater_or_equal(function__, "prior_trt_scale",
        prior_trt_scale, 0);
      current_statement__ = 448;
      context__.validate_dims("data initialization", "prior_trt_df",
        "double", std::vector<size_t>{});
      prior_trt_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 448;
      prior_trt_df = context__.vals_r("prior_trt_df")[(1 - 1)];
      current_statement__ = 448;
      stan::math::check_greater_or_equal(function__, "prior_trt_df",
        prior_trt_df, 0);
      current_statement__ = 449;
      context__.validate_dims("data initialization", "prior_het_dist", "int",
        std::vector<size_t>{});
      prior_het_dist = std::numeric_limits<int>::min();
      current_statement__ = 449;
      prior_het_dist = context__.vals_i("prior_het_dist")[(1 - 1)];
      current_statement__ = 449;
      stan::math::check_greater_or_equal(function__, "prior_het_dist",
        prior_het_dist, 0);
      current_statement__ = 449;
      stan::math::check_less_or_equal(function__, "prior_het_dist",
        prior_het_dist, 6);
      current_statement__ = 450;
      context__.validate_dims("data initialization", "prior_het_type", "int",
        std::vector<size_t>{});
      prior_het_type = std::numeric_limits<int>::min();
      current_statement__ = 450;
      prior_het_type = context__.vals_i("prior_het_type")[(1 - 1)];
      current_statement__ = 450;
      stan::math::check_greater_or_equal(function__, "prior_het_type",
        prior_het_type, 1);
      current_statement__ = 450;
      stan::math::check_less_or_equal(function__, "prior_het_type",
        prior_het_type, 3);
      current_statement__ = 451;
      context__.validate_dims("data initialization", "prior_het_location",
        "double", std::vector<size_t>{});
      prior_het_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 451;
      prior_het_location = context__.vals_r("prior_het_location")[(1 - 1)];
      current_statement__ = 452;
      context__.validate_dims("data initialization", "prior_het_scale",
        "double", std::vector<size_t>{});
      prior_het_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 452;
      prior_het_scale = context__.vals_r("prior_het_scale")[(1 - 1)];
      current_statement__ = 452;
      stan::math::check_greater_or_equal(function__, "prior_het_scale",
        prior_het_scale, 0);
      current_statement__ = 453;
      context__.validate_dims("data initialization", "prior_het_df",
        "double", std::vector<size_t>{});
      prior_het_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 453;
      prior_het_df = context__.vals_r("prior_het_df")[(1 - 1)];
      current_statement__ = 453;
      stan::math::check_greater_or_equal(function__, "prior_het_df",
        prior_het_df, 0);
      current_statement__ = 454;
      context__.validate_dims("data initialization", "prior_reg_dist", "int",
        std::vector<size_t>{});
      prior_reg_dist = std::numeric_limits<int>::min();
      current_statement__ = 454;
      prior_reg_dist = context__.vals_i("prior_reg_dist")[(1 - 1)];
      current_statement__ = 454;
      stan::math::check_greater_or_equal(function__, "prior_reg_dist",
        prior_reg_dist, 0);
      current_statement__ = 454;
      stan::math::check_less_or_equal(function__, "prior_reg_dist",
        prior_reg_dist, 3);
      current_statement__ = 455;
      context__.validate_dims("data initialization", "prior_reg_location",
        "double", std::vector<size_t>{});
      prior_reg_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 455;
      prior_reg_location = context__.vals_r("prior_reg_location")[(1 - 1)];
      current_statement__ = 456;
      context__.validate_dims("data initialization", "prior_reg_scale",
        "double", std::vector<size_t>{});
      prior_reg_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 456;
      prior_reg_scale = context__.vals_r("prior_reg_scale")[(1 - 1)];
      current_statement__ = 456;
      stan::math::check_greater_or_equal(function__, "prior_reg_scale",
        prior_reg_scale, 0);
      current_statement__ = 457;
      context__.validate_dims("data initialization", "prior_reg_df",
        "double", std::vector<size_t>{});
      prior_reg_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 457;
      prior_reg_df = context__.vals_r("prior_reg_df")[(1 - 1)];
      current_statement__ = 457;
      stan::math::check_greater_or_equal(function__, "prior_reg_df",
        prior_reg_df, 0);
      current_statement__ = 458;
      context__.validate_dims("data initialization", "class_effects", "int",
        std::vector<size_t>{});
      class_effects = std::numeric_limits<int>::min();
      current_statement__ = 458;
      class_effects = context__.vals_i("class_effects")[(1 - 1)];
      current_statement__ = 458;
      stan::math::check_greater_or_equal(function__, "class_effects",
        class_effects, 0);
      current_statement__ = 458;
      stan::math::check_less_or_equal(function__, "class_effects",
        class_effects, 1);
      current_statement__ = 459;
      stan::math::validate_non_negative_index("which_CE",
        "class_effects ? nt - 1 : 0", (class_effects ? (nt - 1) : 0));
      current_statement__ = 460;
      context__.validate_dims("data initialization", "which_CE", "int",
        std::vector<size_t>{static_cast<size_t>((class_effects ? (nt -
                              1) : 0))});
      which_CE = std::vector<int>((class_effects ? (nt - 1) : 0),
                   std::numeric_limits<int>::min());
      current_statement__ = 460;
      which_CE = context__.vals_i("which_CE");
      current_statement__ = 460;
      stan::math::check_greater_or_equal(function__, "which_CE", which_CE, 0);
      current_statement__ = 461;
      stan::math::validate_non_negative_index("which_CE_sd",
        "class_effects ? nt - 1 : 0", (class_effects ? (nt - 1) : 0));
      current_statement__ = 462;
      context__.validate_dims("data initialization", "which_CE_sd", "int",
        std::vector<size_t>{static_cast<size_t>((class_effects ? (nt -
                              1) : 0))});
      which_CE_sd = std::vector<int>((class_effects ? (nt - 1) : 0),
                      std::numeric_limits<int>::min());
      current_statement__ = 462;
      which_CE_sd = context__.vals_i("which_CE_sd");
      current_statement__ = 462;
      stan::math::check_greater_or_equal(function__, "which_CE_sd",
        which_CE_sd, 0);
      current_statement__ = 463;
      context__.validate_dims("data initialization", "prior_class_mean_dist",
        "int", std::vector<size_t>{});
      prior_class_mean_dist = std::numeric_limits<int>::min();
      current_statement__ = 463;
      prior_class_mean_dist = context__.vals_i("prior_class_mean_dist")[(1 -
        1)];
      current_statement__ = 463;
      stan::math::check_greater_or_equal(function__, "prior_class_mean_dist",
        prior_class_mean_dist, 0);
      current_statement__ = 463;
      stan::math::check_less_or_equal(function__, "prior_class_mean_dist",
        prior_class_mean_dist, 3);
      current_statement__ = 464;
      context__.validate_dims("data initialization",
        "prior_class_mean_location", "double", std::vector<size_t>{});
      prior_class_mean_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 464;
      prior_class_mean_location = context__.vals_r("prior_class_mean_location")[(1
        - 1)];
      current_statement__ = 465;
      context__.validate_dims("data initialization",
        "prior_class_mean_scale", "double", std::vector<size_t>{});
      prior_class_mean_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 465;
      prior_class_mean_scale = context__.vals_r("prior_class_mean_scale")[(1
        - 1)];
      current_statement__ = 465;
      stan::math::check_greater_or_equal(function__,
        "prior_class_mean_scale", prior_class_mean_scale, 0);
      current_statement__ = 466;
      context__.validate_dims("data initialization", "prior_class_mean_df",
        "double", std::vector<size_t>{});
      prior_class_mean_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 466;
      prior_class_mean_df = context__.vals_r("prior_class_mean_df")[(1 - 1)];
      current_statement__ = 466;
      stan::math::check_greater_or_equal(function__, "prior_class_mean_df",
        prior_class_mean_df, 0);
      current_statement__ = 467;
      context__.validate_dims("data initialization", "prior_class_sd_dist",
        "int", std::vector<size_t>{});
      prior_class_sd_dist = std::numeric_limits<int>::min();
      current_statement__ = 467;
      prior_class_sd_dist = context__.vals_i("prior_class_sd_dist")[(1 - 1)];
      current_statement__ = 467;
      stan::math::check_greater_or_equal(function__, "prior_class_sd_dist",
        prior_class_sd_dist, 0);
      current_statement__ = 467;
      stan::math::check_less_or_equal(function__, "prior_class_sd_dist",
        prior_class_sd_dist, 6);
      current_statement__ = 468;
      context__.validate_dims("data initialization",
        "prior_class_sd_location", "double", std::vector<size_t>{});
      prior_class_sd_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 468;
      prior_class_sd_location = context__.vals_r("prior_class_sd_location")[(1
        - 1)];
      current_statement__ = 469;
      context__.validate_dims("data initialization", "prior_class_sd_scale",
        "double", std::vector<size_t>{});
      prior_class_sd_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 469;
      prior_class_sd_scale = context__.vals_r("prior_class_sd_scale")[(1 -
        1)];
      current_statement__ = 469;
      stan::math::check_greater_or_equal(function__, "prior_class_sd_scale",
        prior_class_sd_scale, 0);
      current_statement__ = 470;
      context__.validate_dims("data initialization", "prior_class_sd_df",
        "double", std::vector<size_t>{});
      prior_class_sd_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 470;
      prior_class_sd_df = context__.vals_r("prior_class_sd_df")[(1 - 1)];
      current_statement__ = 470;
      stan::math::check_greater_or_equal(function__, "prior_class_sd_df",
        prior_class_sd_df, 0);
      current_statement__ = 471;
      context__.validate_dims("data initialization", "prior_aux_dist", "int",
        std::vector<size_t>{});
      prior_aux_dist = std::numeric_limits<int>::min();
      current_statement__ = 471;
      prior_aux_dist = context__.vals_i("prior_aux_dist")[(1 - 1)];
      current_statement__ = 471;
      stan::math::check_greater_or_equal(function__, "prior_aux_dist",
        prior_aux_dist, 0);
      current_statement__ = 471;
      stan::math::check_less_or_equal(function__, "prior_aux_dist",
        prior_aux_dist, 6);
      current_statement__ = 472;
      context__.validate_dims("data initialization", "prior_aux_location",
        "double", std::vector<size_t>{});
      prior_aux_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 472;
      prior_aux_location = context__.vals_r("prior_aux_location")[(1 - 1)];
      current_statement__ = 473;
      context__.validate_dims("data initialization", "prior_aux_scale",
        "double", std::vector<size_t>{});
      prior_aux_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 473;
      prior_aux_scale = context__.vals_r("prior_aux_scale")[(1 - 1)];
      current_statement__ = 473;
      stan::math::check_greater_or_equal(function__, "prior_aux_scale",
        prior_aux_scale, 0);
      current_statement__ = 474;
      context__.validate_dims("data initialization", "prior_aux_df",
        "double", std::vector<size_t>{});
      prior_aux_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 474;
      prior_aux_df = context__.vals_r("prior_aux_df")[(1 - 1)];
      current_statement__ = 474;
      stan::math::check_greater_or_equal(function__, "prior_aux_df",
        prior_aux_df, 0);
      current_statement__ = 475;
      context__.validate_dims("data initialization", "prior_aux2_dist",
        "int", std::vector<size_t>{});
      prior_aux2_dist = std::numeric_limits<int>::min();
      current_statement__ = 475;
      prior_aux2_dist = context__.vals_i("prior_aux2_dist")[(1 - 1)];
      current_statement__ = 475;
      stan::math::check_greater_or_equal(function__, "prior_aux2_dist",
        prior_aux2_dist, 0);
      current_statement__ = 475;
      stan::math::check_less_or_equal(function__, "prior_aux2_dist",
        prior_aux2_dist, 6);
      current_statement__ = 476;
      context__.validate_dims("data initialization", "prior_aux2_location",
        "double", std::vector<size_t>{});
      prior_aux2_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 476;
      prior_aux2_location = context__.vals_r("prior_aux2_location")[(1 - 1)];
      current_statement__ = 477;
      context__.validate_dims("data initialization", "prior_aux2_scale",
        "double", std::vector<size_t>{});
      prior_aux2_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 477;
      prior_aux2_scale = context__.vals_r("prior_aux2_scale")[(1 - 1)];
      current_statement__ = 477;
      stan::math::check_greater_or_equal(function__, "prior_aux2_scale",
        prior_aux2_scale, 0);
      current_statement__ = 478;
      context__.validate_dims("data initialization", "prior_aux2_df",
        "double", std::vector<size_t>{});
      prior_aux2_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 478;
      prior_aux2_df = context__.vals_r("prior_aux2_df")[(1 - 1)];
      current_statement__ = 478;
      stan::math::check_greater_or_equal(function__, "prior_aux2_df",
        prior_aux2_df, 0);
      current_statement__ = 479;
      context__.validate_dims("data initialization", "dist", "int",
        std::vector<size_t>{});
      dist = std::numeric_limits<int>::min();
      current_statement__ = 479;
      dist = context__.vals_i("dist")[(1 - 1)];
      current_statement__ = 479;
      stan::math::check_greater_or_equal(function__, "dist", dist, 1);
      current_statement__ = 480;
      stan::math::validate_non_negative_index("agd_arm_arm", "ni_agd_arm",
        ni_agd_arm);
      current_statement__ = 481;
      context__.validate_dims("data initialization", "agd_arm_arm", "int",
        std::vector<size_t>{static_cast<size_t>(ni_agd_arm)});
      agd_arm_arm = std::vector<int>(ni_agd_arm,
                      std::numeric_limits<int>::min());
      current_statement__ = 481;
      agd_arm_arm = context__.vals_i("agd_arm_arm");
      current_statement__ = 481;
      stan::math::check_greater_or_equal(function__, "agd_arm_arm",
        agd_arm_arm, 1);
      current_statement__ = 482;
      stan::math::validate_non_negative_index("ipd_time", "ni_ipd", ni_ipd);
      current_statement__ = 483;
      context__.validate_dims("data initialization", "ipd_time", "double",
        std::vector<size_t>{static_cast<size_t>(ni_ipd)});
      ipd_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
                          std::numeric_limits<double>::quiet_NaN());
      new (&ipd_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(ipd_time_data__.data(),
        ni_ipd);
      {
        std::vector<local_scalar_t__> ipd_time_flat__;
        current_statement__ = 483;
        ipd_time_flat__ = context__.vals_r("ipd_time");
        current_statement__ = 483;
        pos__ = 1;
        current_statement__ = 483;
        for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
          current_statement__ = 483;
          stan::model::assign(ipd_time, ipd_time_flat__[(pos__ - 1)],
            "assigning variable ipd_time", stan::model::index_uni(sym1__));
          current_statement__ = 483;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 484;
      stan::math::validate_non_negative_index("ipd_start_time", "ni_ipd",
        ni_ipd);
      current_statement__ = 485;
      context__.validate_dims("data initialization", "ipd_start_time",
        "double", std::vector<size_t>{static_cast<size_t>(ni_ipd)});
      ipd_start_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
                                std::numeric_limits<double>::quiet_NaN());
      new (&ipd_start_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(ipd_start_time_data__.data(),
        ni_ipd);
      {
        std::vector<local_scalar_t__> ipd_start_time_flat__;
        current_statement__ = 485;
        ipd_start_time_flat__ = context__.vals_r("ipd_start_time");
        current_statement__ = 485;
        pos__ = 1;
        current_statement__ = 485;
        for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
          current_statement__ = 485;
          stan::model::assign(ipd_start_time, ipd_start_time_flat__[(pos__ -
            1)], "assigning variable ipd_start_time",
            stan::model::index_uni(sym1__));
          current_statement__ = 485;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 486;
      stan::math::validate_non_negative_index("ipd_delay_time", "ni_ipd",
        ni_ipd);
      current_statement__ = 487;
      context__.validate_dims("data initialization", "ipd_delay_time",
        "double", std::vector<size_t>{static_cast<size_t>(ni_ipd)});
      ipd_delay_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
                                std::numeric_limits<double>::quiet_NaN());
      new (&ipd_delay_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(ipd_delay_time_data__.data(),
        ni_ipd);
      {
        std::vector<local_scalar_t__> ipd_delay_time_flat__;
        current_statement__ = 487;
        ipd_delay_time_flat__ = context__.vals_r("ipd_delay_time");
        current_statement__ = 487;
        pos__ = 1;
        current_statement__ = 487;
        for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
          current_statement__ = 487;
          stan::model::assign(ipd_delay_time, ipd_delay_time_flat__[(pos__ -
            1)], "assigning variable ipd_delay_time",
            stan::model::index_uni(sym1__));
          current_statement__ = 487;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 488;
      stan::math::validate_non_negative_index("ipd_status", "ni_ipd", ni_ipd);
      current_statement__ = 489;
      context__.validate_dims("data initialization", "ipd_status", "int",
        std::vector<size_t>{static_cast<size_t>(ni_ipd)});
      ipd_status = std::vector<int>(ni_ipd, std::numeric_limits<int>::min());
      current_statement__ = 489;
      ipd_status = context__.vals_i("ipd_status");
      current_statement__ = 489;
      stan::math::check_greater_or_equal(function__, "ipd_status",
        ipd_status, 0);
      current_statement__ = 489;
      stan::math::check_less_or_equal(function__, "ipd_status", ipd_status, 3);
      current_statement__ = 490;
      stan::math::validate_non_negative_index("agd_arm_time", "ni_agd_arm",
        ni_agd_arm);
      current_statement__ = 491;
      context__.validate_dims("data initialization", "agd_arm_time",
        "double", std::vector<size_t>{static_cast<size_t>(ni_agd_arm)});
      agd_arm_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
                              std::numeric_limits<double>::quiet_NaN());
      new (&agd_arm_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(agd_arm_time_data__.data(),
        ni_agd_arm);
      {
        std::vector<local_scalar_t__> agd_arm_time_flat__;
        current_statement__ = 491;
        agd_arm_time_flat__ = context__.vals_r("agd_arm_time");
        current_statement__ = 491;
        pos__ = 1;
        current_statement__ = 491;
        for (int sym1__ = 1; sym1__ <= ni_agd_arm; ++sym1__) {
          current_statement__ = 491;
          stan::model::assign(agd_arm_time, agd_arm_time_flat__[(pos__ - 1)],
            "assigning variable agd_arm_time", stan::model::index_uni(sym1__));
          current_statement__ = 491;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 492;
      stan::math::validate_non_negative_index("agd_arm_start_time",
        "ni_agd_arm", ni_agd_arm);
      current_statement__ = 493;
      context__.validate_dims("data initialization", "agd_arm_start_time",
        "double", std::vector<size_t>{static_cast<size_t>(ni_agd_arm)});
      agd_arm_start_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
                                    std::numeric_limits<double>::quiet_NaN());
      new (&agd_arm_start_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(agd_arm_start_time_data__.data(),
        ni_agd_arm);
      {
        std::vector<local_scalar_t__> agd_arm_start_time_flat__;
        current_statement__ = 493;
        agd_arm_start_time_flat__ = context__.vals_r("agd_arm_start_time");
        current_statement__ = 493;
        pos__ = 1;
        current_statement__ = 493;
        for (int sym1__ = 1; sym1__ <= ni_agd_arm; ++sym1__) {
          current_statement__ = 493;
          stan::model::assign(agd_arm_start_time,
            agd_arm_start_time_flat__[(pos__ - 1)],
            "assigning variable agd_arm_start_time",
            stan::model::index_uni(sym1__));
          current_statement__ = 493;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 494;
      stan::math::validate_non_negative_index("agd_arm_delay_time",
        "ni_agd_arm", ni_agd_arm);
      current_statement__ = 495;
      context__.validate_dims("data initialization", "agd_arm_delay_time",
        "double", std::vector<size_t>{static_cast<size_t>(ni_agd_arm)});
      agd_arm_delay_time_data__ = Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
                                    std::numeric_limits<double>::quiet_NaN());
      new (&agd_arm_delay_time)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(agd_arm_delay_time_data__.data(),
        ni_agd_arm);
      {
        std::vector<local_scalar_t__> agd_arm_delay_time_flat__;
        current_statement__ = 495;
        agd_arm_delay_time_flat__ = context__.vals_r("agd_arm_delay_time");
        current_statement__ = 495;
        pos__ = 1;
        current_statement__ = 495;
        for (int sym1__ = 1; sym1__ <= ni_agd_arm; ++sym1__) {
          current_statement__ = 495;
          stan::model::assign(agd_arm_delay_time,
            agd_arm_delay_time_flat__[(pos__ - 1)],
            "assigning variable agd_arm_delay_time",
            stan::model::index_uni(sym1__));
          current_statement__ = 495;
          pos__ = (pos__ + 1);
        }
      }
      current_statement__ = 496;
      stan::math::validate_non_negative_index("agd_arm_status", "ni_agd_arm",
        ni_agd_arm);
      current_statement__ = 497;
      context__.validate_dims("data initialization", "agd_arm_status", "int",
        std::vector<size_t>{static_cast<size_t>(ni_agd_arm)});
      agd_arm_status = std::vector<int>(ni_agd_arm,
                         std::numeric_limits<int>::min());
      current_statement__ = 497;
      agd_arm_status = context__.vals_i("agd_arm_status");
      current_statement__ = 497;
      stan::math::check_greater_or_equal(function__, "agd_arm_status",
        agd_arm_status, 0);
      current_statement__ = 497;
      stan::math::check_less_or_equal(function__, "agd_arm_status",
        agd_arm_status, 3);
      current_statement__ = 498;
      context__.validate_dims("data initialization", "aux_int", "int",
        std::vector<size_t>{});
      aux_int = std::numeric_limits<int>::min();
      current_statement__ = 498;
      aux_int = context__.vals_i("aux_int")[(1 - 1)];
      current_statement__ = 498;
      stan::math::check_greater_or_equal(function__, "aux_int", aux_int, 0);
      current_statement__ = 498;
      stan::math::check_less_or_equal(function__, "aux_int", aux_int, 1);
      current_statement__ = 499;
      stan::math::validate_non_negative_index("aux_id",
        "ni_ipd + ni_agd_arm * (aux_int ? nint_max : 1)", (ni_ipd +
        (ni_agd_arm * (aux_int ? nint_max : 1))));
      current_statement__ = 500;
      context__.validate_dims("data initialization", "aux_id", "int",
        std::vector<size_t>{static_cast<size_t>((ni_ipd + (ni_agd_arm *
                              (aux_int ? nint_max : 1))))});
      aux_id = std::vector<int>((ni_ipd + (ni_agd_arm *
                 (aux_int ? nint_max : 1))), std::numeric_limits<int>::min());
      current_statement__ = 500;
      aux_id = context__.vals_i("aux_id");
      current_statement__ = 500;
      stan::math::check_greater_or_equal(function__, "aux_id", aux_id, 1);
      current_statement__ = 501;
      stan::math::validate_non_negative_index("aux_group",
        "ni_ipd + ni_agd_arm * (aux_int ? nint_max : 1)", (ni_ipd +
        (ni_agd_arm * (aux_int ? nint_max : 1))));
      current_statement__ = 502;
      context__.validate_dims("data initialization", "aux_group", "int",
        std::vector<size_t>{static_cast<size_t>((ni_ipd + (ni_agd_arm *
                              (aux_int ? nint_max : 1))))});
      aux_group = std::vector<int>((ni_ipd + (ni_agd_arm *
                    (aux_int ? nint_max : 1))),
                    std::numeric_limits<int>::min());
      current_statement__ = 502;
      aux_group = context__.vals_i("aux_group");
      current_statement__ = 502;
      stan::math::check_greater_or_equal(function__, "aux_group", aux_group,
        1);
      current_statement__ = 503;
      context__.validate_dims("data initialization", "nX_aux", "int",
        std::vector<size_t>{});
      nX_aux = std::numeric_limits<int>::min();
      current_statement__ = 503;
      nX_aux = context__.vals_i("nX_aux")[(1 - 1)];
      current_statement__ = 503;
      stan::math::check_greater_or_equal(function__, "nX_aux", nX_aux, 0);
      current_statement__ = 504;
      stan::math::validate_non_negative_index("X_aux",
        "ni_ipd + (aux_int ? nint_max : 1) * ni_agd_arm", (ni_ipd +
        ((aux_int ? nint_max : 1) * ni_agd_arm)));
      current_statement__ = 505;
      stan::math::validate_non_negative_index("X_aux", "nX_aux", nX_aux);
      current_statement__ = 506;
      context__.validate_dims("data initialization", "X_aux", "double",
        std::vector<size_t>{static_cast<size_t>((ni_ipd +
                              ((aux_int ? nint_max : 1) * ni_agd_arm))),
          static_cast<size_t>(nX_aux)});
      X_aux_data__ = Eigen::Matrix<double,-1,-1>::Constant((ni_ipd +
                       ((aux_int ? nint_max : 1) * ni_agd_arm)), nX_aux,
                       std::numeric_limits<double>::quiet_NaN());
      new (&X_aux)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_aux_data__.data(), (ni_ipd
        + ((aux_int ? nint_max : 1) * ni_agd_arm)), nX_aux);
      {
        std::vector<local_scalar_t__> X_aux_flat__;
        current_statement__ = 506;
        X_aux_flat__ = context__.vals_r("X_aux");
        current_statement__ = 506;
        pos__ = 1;
        current_statement__ = 506;
        for (int sym1__ = 1; sym1__ <= nX_aux; ++sym1__) {
          current_statement__ = 506;
          for (int sym2__ = 1; sym2__ <= (ni_ipd + ((aux_int ? nint_max : 1)
               * ni_agd_arm)); ++sym2__) {
            current_statement__ = 506;
            stan::model::assign(X_aux, X_aux_flat__[(pos__ - 1)],
              "assigning variable X_aux", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 506;
            pos__ = (pos__ + 1);
          }
        }
      }
      current_statement__ = 507;
      context__.validate_dims("data initialization", "aux_reg_trt", "int",
        std::vector<size_t>{});
      aux_reg_trt = std::numeric_limits<int>::min();
      current_statement__ = 507;
      aux_reg_trt = context__.vals_i("aux_reg_trt")[(1 - 1)];
      current_statement__ = 507;
      stan::math::check_greater_or_equal(function__, "aux_reg_trt",
        aux_reg_trt, 0);
      current_statement__ = 507;
      stan::math::check_less_or_equal(function__, "aux_reg_trt", aux_reg_trt,
        1);
      current_statement__ = 508;
      context__.validate_dims("data initialization", "prior_aux_reg_dist",
        "int", std::vector<size_t>{});
      prior_aux_reg_dist = std::numeric_limits<int>::min();
      current_statement__ = 508;
      prior_aux_reg_dist = context__.vals_i("prior_aux_reg_dist")[(1 - 1)];
      current_statement__ = 508;
      stan::math::check_greater_or_equal(function__, "prior_aux_reg_dist",
        prior_aux_reg_dist, 0);
      current_statement__ = 508;
      stan::math::check_less_or_equal(function__, "prior_aux_reg_dist",
        prior_aux_reg_dist, 6);
      current_statement__ = 509;
      context__.validate_dims("data initialization",
        "prior_aux_reg_location", "double", std::vector<size_t>{});
      prior_aux_reg_location = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 509;
      prior_aux_reg_location = context__.vals_r("prior_aux_reg_location")[(1
        - 1)];
      current_statement__ = 509;
      stan::math::check_greater_or_equal(function__,
        "prior_aux_reg_location", prior_aux_reg_location, 0);
      current_statement__ = 510;
      context__.validate_dims("data initialization", "prior_aux_reg_scale",
        "double", std::vector<size_t>{});
      prior_aux_reg_scale = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 510;
      prior_aux_reg_scale = context__.vals_r("prior_aux_reg_scale")[(1 - 1)];
      current_statement__ = 510;
      stan::math::check_greater_or_equal(function__, "prior_aux_reg_scale",
        prior_aux_reg_scale, 0);
      current_statement__ = 511;
      context__.validate_dims("data initialization", "prior_aux_reg_df",
        "double", std::vector<size_t>{});
      prior_aux_reg_df = std::numeric_limits<double>::quiet_NaN();
      current_statement__ = 511;
      prior_aux_reg_df = context__.vals_r("prior_aux_reg_df")[(1 - 1)];
      current_statement__ = 511;
      stan::math::check_greater_or_equal(function__, "prior_aux_reg_df",
        prior_aux_reg_df, 0);
      current_statement__ = 512;
      nonexp = std::numeric_limits<int>::min();
      current_statement__ = 512;
      nonexp = ((stan::math::primitive_value(stan::math::logical_eq(dist, 1))
        ||
        stan::math::primitive_value(stan::math::logical_eq(dist, 4))) ? 0 : 1);
      current_statement__ = 513;
      gengamma = std::numeric_limits<int>::min();
      current_statement__ = 513;
      gengamma = (stan::math::logical_gte(dist, 9) ? 1 : 0);
      current_statement__ = 514;
      n_aux = std::numeric_limits<int>::min();
      current_statement__ = 514;
      n_aux = (nonexp ? stan::math::max(aux_id) : 0);
      current_statement__ = 515;
      n_aux_group = std::numeric_limits<int>::min();
      current_statement__ = 515;
      n_aux_group = (nonexp ? stan::math::max(aux_group) : 0);
      current_statement__ = 516;
      stan::math::validate_non_negative_index("agd_arm_arm2", "ni_agd_arm",
        ni_agd_arm);
      current_statement__ = 517;
      agd_arm_arm2 = std::vector<int>(ni_agd_arm,
                       std::numeric_limits<int>::min());
      current_statement__ = 518;
      stan::math::validate_non_negative_index("aux_id_ipd", "ni_ipd", ni_ipd);
      current_statement__ = 519;
      aux_id_ipd = std::vector<int>(ni_ipd, std::numeric_limits<int>::min());
      current_statement__ = 519;
      stan::model::assign(aux_id_ipd,
        stan::model::rvalue(aux_id, "aux_id",
          stan::model::index_min_max(1, ni_ipd)),
        "assigning variable aux_id_ipd");
      current_statement__ = 520;
      stan::math::validate_non_negative_index("aux_id_agd_arm",
        "ni_agd_arm * (aux_int ? nint_max : 1)", (ni_agd_arm *
        (aux_int ? nint_max : 1)));
      current_statement__ = 521;
      aux_id_agd_arm = std::vector<int>((ni_agd_arm *
                         (aux_int ? nint_max : 1)),
                         std::numeric_limits<int>::min());
      current_statement__ = 521;
      stan::model::assign(aux_id_agd_arm,
        stan::model::rvalue(aux_id, "aux_id",
          stan::model::index_min_max((ni_ipd + 1), (ni_ipd + (ni_agd_arm *
            (aux_int ? nint_max : 1))))), "assigning variable aux_id_agd_arm");
      current_statement__ = 522;
      stan::math::validate_non_negative_index("aux_group_ipd", "ni_ipd",
        ni_ipd);
      current_statement__ = 523;
      aux_group_ipd = std::vector<int>(ni_ipd,
                        std::numeric_limits<int>::min());
      current_statement__ = 523;
      stan::model::assign(aux_group_ipd,
        stan::model::rvalue(aux_group, "aux_group",
          stan::model::index_min_max(1, ni_ipd)),
        "assigning variable aux_group_ipd");
      current_statement__ = 524;
      stan::math::validate_non_negative_index("aux_group_agd_arm",
        "ni_agd_arm * (aux_int ? nint_max : 1)", (ni_agd_arm *
        (aux_int ? nint_max : 1)));
      current_statement__ = 525;
      aux_group_agd_arm = std::vector<int>((ni_agd_arm *
                            (aux_int ? nint_max : 1)),
                            std::numeric_limits<int>::min());
      current_statement__ = 525;
      stan::model::assign(aux_group_agd_arm,
        stan::model::rvalue(aux_group, "aux_group",
          stan::model::index_min_max((ni_ipd + 1), (ni_ipd + (ni_agd_arm *
            (aux_int ? nint_max : 1))))),
        "assigning variable aux_group_agd_arm");
      current_statement__ = 526;
      stan::math::validate_non_negative_index("ni_aux_group_ipd",
        "(nonexp && aux_int == 0) ? n_aux_group : 1",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 1));
      current_statement__ = 527;
      ni_aux_group_ipd = std::vector<int>(((stan::math::primitive_value(
                                              nonexp) &&
                           stan::math::primitive_value(
                             stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 1),
                           std::numeric_limits<int>::min());
      current_statement__ = 527;
      stan::model::assign(ni_aux_group_ipd,
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? 
        nwhich_all(aux_group_ipd, n_aux_group, pstream__) : std::vector<int>{0}),
        "assigning variable ni_aux_group_ipd");
      current_statement__ = 528;
      stan::math::validate_non_negative_index("wi_aux_group_ipd",
        "(nonexp && aux_int == 0) ? n_aux_group : 0",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 0));
      current_statement__ = 529;
      stan::math::validate_non_negative_index("wi_aux_group_ipd",
        "(nonexp && aux_int == 0) ? max(ni_aux_group_ipd) : 0",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? 
        stan::math::max(ni_aux_group_ipd) : 0));
      current_statement__ = 530;
      wi_aux_group_ipd = std::vector<std::vector<int>>(((stan::math::primitive_value(
                                                           nonexp) &&
                           stan::math::primitive_value(
                             stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 0),
                           std::vector<int>(((stan::math::primitive_value(
                                                nonexp) &&
                             stan::math::primitive_value(
                               stan::math::logical_eq(aux_int, 0))) ? 
                             stan::math::max(ni_aux_group_ipd) : 0),
                             std::numeric_limits<int>::min()));
      current_statement__ = 531;
      stan::math::validate_non_negative_index("ni_aux_group_agd_arm",
        "(nonexp && aux_int == 0) ? n_aux_group : 1",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 1));
      current_statement__ = 532;
      ni_aux_group_agd_arm = std::vector<int>(((stan::math::primitive_value(
                                                  nonexp) &&
                               stan::math::primitive_value(
                                 stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 1),
                               std::numeric_limits<int>::min());
      current_statement__ = 532;
      stan::model::assign(ni_aux_group_agd_arm,
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? 
        nwhich_all(aux_group_agd_arm, n_aux_group, pstream__) : std::vector<
                                                                  int>{0}),
        "assigning variable ni_aux_group_agd_arm");
      current_statement__ = 533;
      stan::math::validate_non_negative_index("wi_aux_group_agd_arm",
        "(nonexp && aux_int == 0) ? n_aux_group : 0",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 0));
      current_statement__ = 534;
      stan::math::validate_non_negative_index("wi_aux_group_agd_arm",
        "(nonexp && aux_int == 0) ? max(ni_aux_group_agd_arm) : 0",
        ((stan::math::primitive_value(nonexp) &&
        stan::math::primitive_value(stan::math::logical_eq(aux_int, 0))) ? 
        stan::math::max(ni_aux_group_agd_arm) : 0));
      current_statement__ = 535;
      wi_aux_group_agd_arm = std::vector<std::vector<int>>(((stan::math::primitive_value(
                                                               nonexp) &&
                               stan::math::primitive_value(
                                 stan::math::logical_eq(aux_int, 0))) ? n_aux_group : 0),
                               std::vector<int>(((stan::math::primitive_value(
                                                    nonexp) &&
                                 stan::math::primitive_value(
                                   stan::math::logical_eq(aux_int, 0))) ? 
                                 stan::math::max(ni_aux_group_agd_arm) : 0),
                                 std::numeric_limits<int>::min()));
      current_statement__ = 536;
      stan::math::validate_non_negative_index("Xauxdummy", "nX_aux", nX_aux);
      current_statement__ = 537;
      Xauxdummy_data__ = Eigen::Matrix<double,-1,-1>::Constant(0, nX_aux,
                           std::numeric_limits<double>::quiet_NaN());
      new (&Xauxdummy)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(Xauxdummy_data__.data(), 0,
        nX_aux);
      current_statement__ = 538;
      stan::math::validate_non_negative_index("X_aux_ipd", "ni_ipd", ni_ipd);
      current_statement__ = 539;
      stan::math::validate_non_negative_index("X_aux_ipd", "nX_aux", nX_aux);
      current_statement__ = 540;
      X_aux_ipd_data__ = Eigen::Matrix<double,-1,-1>::Constant(ni_ipd,
                           nX_aux, std::numeric_limits<double>::quiet_NaN());
      new (&X_aux_ipd)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_aux_ipd_data__.data(),
        ni_ipd, nX_aux);
      current_statement__ = 540;
      stan::model::assign(X_aux_ipd,
        (ni_ipd ? stan::math::eval(
                    stan::model::rvalue(X_aux, "X_aux",
                      stan::model::index_min_max(1, ni_ipd))) : stan::math::eval(
                                                                  Xauxdummy)),
        "assigning variable X_aux_ipd");
      current_statement__ = 541;
      stan::math::validate_non_negative_index("X_aux_agd_arm",
        "(aux_int ? nint_max : 1) * ni_agd_arm", ((aux_int ? nint_max : 1) *
        ni_agd_arm));
      current_statement__ = 542;
      stan::math::validate_non_negative_index("X_aux_agd_arm", "nX_aux",
        nX_aux);
      current_statement__ = 543;
      X_aux_agd_arm_data__ = Eigen::Matrix<double,-1,-1>::Constant(((aux_int ? nint_max : 1)
                               * ni_agd_arm), nX_aux,
                               std::numeric_limits<double>::quiet_NaN());
      new (&X_aux_agd_arm)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_aux_agd_arm_data__.data(),
        ((aux_int ? nint_max : 1) * ni_agd_arm), nX_aux);
      current_statement__ = 543;
      stan::model::assign(X_aux_agd_arm,
        (ni_agd_arm ? stan::math::eval(
                        stan::model::rvalue(X_aux, "X_aux",
                          stan::model::index_min_max((ni_ipd + 1), (ni_ipd +
                            ((aux_int ? nint_max : 1) * ni_agd_arm))))) : 
        stan::math::eval(Xauxdummy)), "assigning variable X_aux_agd_arm");
      current_statement__ = 544;
      nint = std::numeric_limits<int>::min();
      current_statement__ = 544;
      nint = stan::model::rvalue(nint_vec, "nint_vec",
               stan::model::index_uni(CHAIN_ID));
      current_statement__ = 545;
      n_delta = std::numeric_limits<int>::min();
      current_statement__ = 545;
      n_delta = (RE ? stan::math::max(which_RE) : 0);
      current_statement__ = 546;
      stan::math::validate_non_negative_index("RE_mu", "n_delta", n_delta);
      current_statement__ = 547;
      RE_mu_data__ = Eigen::Matrix<double,-1,1>::Constant(n_delta,
                       std::numeric_limits<double>::quiet_NaN());
      new (&RE_mu)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(RE_mu_data__.data(), n_delta);
      current_statement__ = 547;
      stan::model::assign(RE_mu, stan::math::rep_vector(0, n_delta),
        "assigning variable RE_mu");
      current_statement__ = 548;
      REdummy_data__ = Eigen::Matrix<double,-1,-1>::Constant(0, 0,
                         std::numeric_limits<double>::quiet_NaN());
      new (&REdummy)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(REdummy_data__.data(), 0, 0);
      current_statement__ = 549;
      stan::math::validate_non_negative_index("RE_L", "n_delta", n_delta);
      current_statement__ = 549;
      stan::math::validate_non_negative_index("RE_L", "n_delta", n_delta);
      current_statement__ = 550;
      RE_L_data__ = Eigen::Matrix<double,-1,-1>::Constant(n_delta, n_delta,
                      std::numeric_limits<double>::quiet_NaN());
      new (&RE_L) Eigen::Map<Eigen::Matrix<double,-1,-1>>(RE_L_data__.data(),
        n_delta, n_delta);
      current_statement__ = 550;
      stan::model::assign(RE_L,
        (n_delta ? stan::math::eval(stan::math::cholesky_decompose(RE_cor)) : 
        stan::math::eval(REdummy)), "assigning variable RE_L");
      current_statement__ = 551;
      wdummy_data__ = Eigen::Matrix<double,-1,1>::Constant(0,
                        std::numeric_limits<double>::quiet_NaN());
      new (&wdummy)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(wdummy_data__.data(), 0);
      current_statement__ = 552;
      vudummy = std::vector<int>(0, std::numeric_limits<int>::min());
      current_statement__ = 553;
      RE_L_nz = std::numeric_limits<int>::min();
      current_statement__ = 553;
      RE_L_nz = count_nonzero(RE_L, pstream__);
      current_statement__ = 554;
      RE_sparse = std::numeric_limits<int>::min();
      current_statement__ = 554;
      RE_sparse = stan::math::logical_lte(((RE_L_nz * 1.0) /
                    stan::math::num_elements(RE_L)), 0.1);
      current_statement__ = 555;
      stan::math::validate_non_negative_index("RE_L_w",
        "RE_sparse ? RE_L_nz : 0", (RE_sparse ? RE_L_nz : 0));
      current_statement__ = 556;
      RE_L_w_data__ = Eigen::Matrix<double,-1,1>::Constant((RE_sparse ? RE_L_nz : 0),
                        std::numeric_limits<double>::quiet_NaN());
      new (&RE_L_w)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(RE_L_w_data__.data(),
        (RE_sparse ? RE_L_nz : 0));
      current_statement__ = 556;
      stan::model::assign(RE_L_w,
        (RE_sparse ? stan::math::eval(stan::math::csr_extract_w(RE_L)) : 
        stan::math::eval(wdummy)), "assigning variable RE_L_w");
      current_statement__ = 557;
      stan::math::validate_non_negative_index("RE_L_v",
        "RE_sparse ? RE_L_nz : 0", (RE_sparse ? RE_L_nz : 0));
      current_statement__ = 558;
      RE_L_v = std::vector<int>((RE_sparse ? RE_L_nz : 0),
                 std::numeric_limits<int>::min());
      current_statement__ = 558;
      stan::model::assign(RE_L_v,
        (RE_sparse ? stan::math::csr_extract_v(RE_L) : vudummy),
        "assigning variable RE_L_v");
      current_statement__ = 559;
      stan::math::validate_non_negative_index("RE_L_u",
        "RE_sparse ? n_delta + 1 : 0", (RE_sparse ? (n_delta + 1) : 0));
      current_statement__ = 560;
      RE_L_u = std::vector<int>((RE_sparse ? (n_delta + 1) : 0),
                 std::numeric_limits<int>::min());
      current_statement__ = 560;
      stan::model::assign(RE_L_u,
        (RE_sparse ? stan::math::csr_extract_u(RE_L) : vudummy),
        "assigning variable RE_L_u");
      current_statement__ = 561;
      totns = std::numeric_limits<int>::min();
      current_statement__ = 561;
      totns = (ns_ipd + ns_agd_arm);
      current_statement__ = 562;
      stan::math::validate_non_negative_index("trt",
        "narm_ipd + narm_agd_arm + ni_agd_contrast", ((narm_ipd +
        narm_agd_arm) + ni_agd_contrast));
      current_statement__ = 563;
      trt = std::vector<int>(((narm_ipd + narm_agd_arm) + ni_agd_contrast),
              std::numeric_limits<int>::min());
      current_statement__ = 563;
      stan::model::assign(trt,
        stan::math::append_array(
          stan::math::append_array(ipd_trt, agd_arm_trt), agd_contrast_trt),
        "assigning variable trt");
      current_statement__ = 564;
      stan::math::validate_non_negative_index("Xdummy", "nX", nX);
      current_statement__ = 565;
      Xdummy_data__ = Eigen::Matrix<double,-1,-1>::Constant(0, nX,
                        std::numeric_limits<double>::quiet_NaN());
      new (&Xdummy)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(Xdummy_data__.data(), 0, nX);
      current_statement__ = 566;
      stan::math::validate_non_negative_index("X_ipd", "ni_ipd", ni_ipd);
      current_statement__ = 567;
      stan::math::validate_non_negative_index("X_ipd", "nX", nX);
      current_statement__ = 568;
      X_ipd_data__ = Eigen::Matrix<double,-1,-1>::Constant(ni_ipd, nX,
                       std::numeric_limits<double>::quiet_NaN());
      new (&X_ipd)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_ipd_data__.data(), ni_ipd,
        nX);
      current_statement__ = 568;
      stan::model::assign(X_ipd,
        (ni_ipd ? stan::math::eval(
                    stan::model::rvalue(X, "X",
                      stan::model::index_min_max(1, ni_ipd))) : stan::math::eval(
                                                                  Xdummy)),
        "assigning variable X_ipd");
      current_statement__ = 569;
      stan::math::validate_non_negative_index("X_agd_arm",
        "nint_max * ni_agd_arm", (nint_max * ni_agd_arm));
      current_statement__ = 570;
      stan::math::validate_non_negative_index("X_agd_arm", "nX", nX);
      current_statement__ = 571;
      X_agd_arm_data__ = Eigen::Matrix<double,-1,-1>::Constant((nint_max *
                           ni_agd_arm), nX,
                           std::numeric_limits<double>::quiet_NaN());
      new (&X_agd_arm)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_agd_arm_data__.data(),
        (nint_max * ni_agd_arm), nX);
      current_statement__ = 571;
      stan::model::assign(X_agd_arm,
        (ni_agd_arm ? stan::math::eval(
                        stan::model::rvalue(X, "X",
                          stan::model::index_min_max((ni_ipd + 1), (ni_ipd +
                            (nint_max * ni_agd_arm))))) : stan::math::eval(
                                                            Xdummy)),
        "assigning variable X_agd_arm");
      current_statement__ = 572;
      stan::math::validate_non_negative_index("X_agd_contrast",
        "nint_max * ni_agd_contrast", (nint_max * ni_agd_contrast));
      current_statement__ = 573;
      stan::math::validate_non_negative_index("X_agd_contrast", "nX", nX);
      current_statement__ = 574;
      X_agd_contrast_data__ = Eigen::Matrix<double,-1,-1>::Constant((nint_max
                                * ni_agd_contrast), nX,
                                std::numeric_limits<double>::quiet_NaN());
      new (&X_agd_contrast)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_agd_contrast_data__.data(),
        (nint_max * ni_agd_contrast), nX);
      current_statement__ = 574;
      stan::model::assign(X_agd_contrast,
        (ni_agd_contrast ? stan::math::eval(
                             stan::model::rvalue(X, "X",
                               stan::model::index_min_max(((ni_ipd +
                                 (nint_max * ni_agd_arm)) + 1), (ni_ipd +
                                 (nint_max * (ni_agd_arm + ni_agd_contrast)))))) : 
        stan::math::eval(Xdummy)), "assigning variable X_agd_contrast");
      current_statement__ = 575;
      odummy_data__ = Eigen::Matrix<double,-1,1>::Constant(0,
                        std::numeric_limits<double>::quiet_NaN());
      new (&odummy)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(odummy_data__.data(), 0);
      current_statement__ = 576;
      stan::math::validate_non_negative_index("offset_ipd",
        "has_offset && ni_ipd ? ni_ipd : 0",
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_ipd)) ? ni_ipd : 0));
      current_statement__ = 577;
      offset_ipd_data__ = Eigen::Matrix<double,-1,1>::Constant(((stan::math::primitive_value(
                                                                   has_offset)
                            &&
                            stan::math::primitive_value(ni_ipd)) ? ni_ipd : 0),
                            std::numeric_limits<double>::quiet_NaN());
      new (&offset_ipd)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(offset_ipd_data__.data(),
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_ipd)) ? ni_ipd : 0));
      current_statement__ = 577;
      stan::model::assign(offset_ipd,
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_ipd)) ? stan::math::eval(
                                                 stan::model::rvalue(offsets,
                                                   "offsets",
                                                   stan::model::index_min_max(
                                                     1, ni_ipd))) : stan::math::eval(
                                                                    odummy)),
        "assigning variable offset_ipd");
      current_statement__ = 578;
      stan::math::validate_non_negative_index("offset_agd_arm",
        "has_offset && ni_agd_arm ? nint_max * ni_agd_arm : 0",
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_arm)) ? (nint_max *
        ni_agd_arm) : 0));
      current_statement__ = 579;
      offset_agd_arm_data__ = Eigen::Matrix<double,-1,1>::Constant(((
                                stan::math::primitive_value(has_offset) &&
                                stan::math::primitive_value(ni_agd_arm)) ? (nint_max
                                * ni_agd_arm) : 0),
                                std::numeric_limits<double>::quiet_NaN());
      new (&offset_agd_arm)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(offset_agd_arm_data__.data(),
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_arm)) ? (nint_max *
        ni_agd_arm) : 0));
      current_statement__ = 579;
      stan::model::assign(offset_agd_arm,
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_arm)) ? stan::math::eval(
                                                     stan::model::rvalue(
                                                       offsets, "offsets",
                                                       stan::model::index_min_max(
                                                         (ni_ipd + 1),
                                                         (ni_ipd + (nint_max
                                                         * ni_agd_arm))))) : 
        stan::math::eval(odummy)), "assigning variable offset_agd_arm");
      current_statement__ = 580;
      stan::math::validate_non_negative_index("offset_agd_contrast",
        "has_offset && ni_agd_contrast ? nint_max * ni_agd_contrast : 0",
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_contrast)) ? (nint_max *
        ni_agd_contrast) : 0));
      current_statement__ = 581;
      offset_agd_contrast_data__ = Eigen::Matrix<double,-1,1>::Constant(((
                                     stan::math::primitive_value(has_offset)
                                     &&
                                     stan::math::primitive_value(
                                       ni_agd_contrast)) ? (nint_max *
                                     ni_agd_contrast) : 0),
                                     std::numeric_limits<double>::quiet_NaN());
      new (&offset_agd_contrast)
        Eigen::Map<Eigen::Matrix<double,-1,1>>(offset_agd_contrast_data__.data(),
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_contrast)) ? (nint_max *
        ni_agd_contrast) : 0));
      current_statement__ = 581;
      stan::model::assign(offset_agd_contrast,
        ((stan::math::primitive_value(has_offset) &&
        stan::math::primitive_value(ni_agd_contrast)) ? stan::math::eval(
                                                          stan::model::rvalue(
                                                            offsets,
                                                            "offsets",
                                                            stan::model::index_min_max(
                                                              ((ni_ipd +
                                                              (nint_max *
                                                              ni_agd_arm)) +
                                                              1), (ni_ipd +
                                                              (nint_max *
                                                              (ni_agd_arm +
                                                              ni_agd_contrast)))))) : 
        stan::math::eval(odummy)), "assigning variable offset_agd_contrast");
      current_statement__ = 582;
      n_int_thin = std::numeric_limits<int>::min();
      current_statement__ = 582;
      n_int_thin = ((stan::math::primitive_value(
                       stan::math::logical_gt(nint_max, 1))
        &&
        stan::math::primitive_value(stan::math::logical_gt(int_thin, 0))) ? (nint
        / int_thin) : 0);
      current_statement__ = 583;
      stan::math::validate_non_negative_index("inv_Sigma",
        "ni_agd_contrast ? ni_agd_contrast : 1",
        (ni_agd_contrast ? ni_agd_contrast : 1));
      current_statement__ = 584;
      stan::math::validate_non_negative_index("inv_Sigma",
        "ni_agd_contrast ? ni_agd_contrast : 1",
        (ni_agd_contrast ? ni_agd_contrast : 1));
      current_statement__ = 585;
      inv_Sigma_data__ = Eigen::Matrix<double,-1,-1>::Constant((ni_agd_contrast ? ni_agd_contrast : 1),
                           (ni_agd_contrast ? ni_agd_contrast : 1),
                           std::numeric_limits<double>::quiet_NaN());
      new (&inv_Sigma)
        Eigen::Map<Eigen::Matrix<double,-1,-1>>(inv_Sigma_data__.data(),
        (ni_agd_contrast ? ni_agd_contrast : 1),
        (ni_agd_contrast ? ni_agd_contrast : 1));
      current_statement__ = 585;
      stan::model::assign(inv_Sigma,
        stan::math::inverse_spd(agd_contrast_Sigma),
        "assigning variable inv_Sigma");
      current_statement__ = 586;
      stan::math::validate_non_negative_index("nc_agd_contrast",
        "ns_agd_contrast", ns_agd_contrast);
      current_statement__ = 587;
      nc_agd_contrast = std::vector<int>(ns_agd_contrast,
                          std::numeric_limits<int>::min());
      current_statement__ = 601;
      if (ns_agd_contrast) {
        int s = std::numeric_limits<int>::min();
        current_statement__ = 588;
        s = 1;
        int c = std::numeric_limits<int>::min();
        current_statement__ = 589;
        c = 1;
        current_statement__ = 598;
        for (int i = 1; i <= (ni_agd_contrast - 1); ++i) {
          current_statement__ = 596;
          if (stan::math::logical_eq(
                stan::model::rvalue(agd_contrast_Sigma, "agd_contrast_Sigma",
                  stan::model::index_uni(i), stan::model::index_uni((i + 1))),
                0)) {
            current_statement__ = 592;
            stan::model::assign(nc_agd_contrast, c,
              "assigning variable nc_agd_contrast", stan::model::index_uni(s));
            current_statement__ = 593;
            s = (s + 1);
            current_statement__ = 594;
            c = 1;
          } else {
            current_statement__ = 590;
            c = (c + 1);
          }
        }
        current_statement__ = 599;
        stan::model::assign(nc_agd_contrast, c,
          "assigning variable nc_agd_contrast", stan::model::index_uni(s));
      }
      current_statement__ = 602;
      n_class_trts = std::numeric_limits<int>::min();
      current_statement__ = 602;
      n_class_trts = stan::math::num_elements(which_gt0a(which_CE, pstream__));
      current_statement__ = 603;
      stan::math::validate_non_negative_index("which_class_trt",
        "n_class_trts", n_class_trts);
      current_statement__ = 604;
      which_class_trt = std::vector<int>(n_class_trts,
                          std::numeric_limits<int>::min());
      current_statement__ = 604;
      stan::model::assign(which_class_trt, which_gt0a(which_CE, pstream__),
        "assigning variable which_class_trt");
      current_statement__ = 605;
      n_class = std::numeric_limits<int>::min();
      current_statement__ = 605;
      n_class = (class_effects ? stan::math::max(which_CE) : 0);
      current_statement__ = 606;
      stan::math::validate_non_negative_index("which_fclass",
        "class_effects ? nt - 1 : 0", (class_effects ? (nt - 1) : 0));
      current_statement__ = 607;
      which_fclass = std::vector<int>((class_effects ? (nt - 1) : 0),
                       std::numeric_limits<int>::min());
      current_statement__ = 618;
      if (class_effects) {
        int count = std::numeric_limits<int>::min();
        current_statement__ = 608;
        count = 1;
        current_statement__ = 616;
        for (int t = 1; t <= (nt - 1); ++t) {
          current_statement__ = 614;
          if (stan::math::logical_gt(
                stan::model::rvalue(which_CE_sd, "which_CE_sd",
                  stan::model::index_uni(t)), 0)) {
            current_statement__ = 611;
            stan::model::assign(which_fclass, count,
              "assigning variable which_fclass", stan::model::index_uni(t));
            current_statement__ = 612;
            count = (count + 1);
          } else {
            current_statement__ = 609;
            stan::model::assign(which_fclass, 0,
              "assigning variable which_fclass", stan::model::index_uni(t));
          }
        }
      }
      current_statement__ = 620;
      for (int i = 1; i <= ni_agd_arm; ++i) {
        current_statement__ = 619;
        stan::model::assign(agd_arm_arm2, (narm_ipd +
          stan::model::rvalue(agd_arm_arm, "agd_arm_arm",
            stan::model::index_uni(i))), "assigning variable agd_arm_arm2",
          stan::model::index_uni(i));
      }
      current_statement__ = 627;
      if ((stan::math::primitive_value(nonexp) &&
          stan::math::primitive_value(stan::math::logical_eq(aux_int, 0)))) {
        current_statement__ = 626;
        for (int i = 1; i <= n_aux_group; ++i) {
          current_statement__ = 622;
          if (stan::model::rvalue(ni_aux_group_ipd, "ni_aux_group_ipd",
                stan::model::index_uni(i))) {
            current_statement__ = 621;
            stan::model::assign(wi_aux_group_ipd,
              which(aux_group_ipd, i, pstream__),
              "assigning variable wi_aux_group_ipd",
              stan::model::index_uni(i),
              stan::model::index_min_max(1,
                stan::model::rvalue(ni_aux_group_ipd, "ni_aux_group_ipd",
                  stan::model::index_uni(i))));
          }
          current_statement__ = 624;
          if (stan::model::rvalue(ni_aux_group_agd_arm,
                "ni_aux_group_agd_arm", stan::model::index_uni(i))) {
            current_statement__ = 623;
            stan::model::assign(wi_aux_group_agd_arm,
              which(aux_group_agd_arm, i, pstream__),
              "assigning variable wi_aux_group_agd_arm",
              stan::model::index_uni(i),
              stan::model::index_min_max(1,
                stan::model::rvalue(ni_aux_group_agd_arm,
                  "ni_aux_group_agd_arm", stan::model::index_uni(i))));
          }
        }
      }
      current_statement__ = 512;
      stan::math::check_greater_or_equal(function__, "nonexp", nonexp, 0);
      current_statement__ = 512;
      stan::math::check_less_or_equal(function__, "nonexp", nonexp, 1);
      current_statement__ = 513;
      stan::math::check_greater_or_equal(function__, "gengamma", gengamma, 0);
      current_statement__ = 513;
      stan::math::check_less_or_equal(function__, "gengamma", gengamma, 1);
      current_statement__ = 519;
      stan::math::check_greater_or_equal(function__, "aux_id_ipd",
        aux_id_ipd, 1);
      current_statement__ = 521;
      stan::math::check_greater_or_equal(function__, "aux_id_agd_arm",
        aux_id_agd_arm, 1);
      current_statement__ = 523;
      stan::math::check_greater_or_equal(function__, "aux_group_ipd",
        aux_group_ipd, 1);
      current_statement__ = 525;
      stan::math::check_greater_or_equal(function__, "aux_group_agd_arm",
        aux_group_agd_arm, 1);
      current_statement__ = 544;
      stan::math::check_greater_or_equal(function__, "nint", nint, 1);
      current_statement__ = 544;
      stan::math::check_less_or_equal(function__, "nint", nint, nint_max);
      current_statement__ = 545;
      stan::math::check_greater_or_equal(function__, "n_delta", n_delta, 0);
      current_statement__ = 550;
      stan::math::check_cholesky_factor_corr(function__, "RE_L", RE_L);
      current_statement__ = 563;
      stan::math::check_greater_or_equal(function__, "trt", trt, 1);
      current_statement__ = 602;
      stan::math::check_greater_or_equal(function__, "n_class_trts",
        n_class_trts, 0);
      current_statement__ = 605;
      stan::math::check_greater_or_equal(function__, "n_class", n_class, 0);
      current_statement__ = 607;
      stan::math::check_greater_or_equal(function__, "which_fclass",
        which_fclass, 0);
      current_statement__ = 628;
      stan::math::validate_non_negative_index("beta_tilde", "nX", nX);
      current_statement__ = 629;
      stan::math::validate_non_negative_index("u_delta", "n_delta", n_delta);
      current_statement__ = 630;
      tau_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 630;
      tau_1dim__ = (RE ? 1 : 0);
      current_statement__ = 630;
      stan::math::validate_non_negative_index("tau", "RE ? 1 : 0", tau_1dim__);
      current_statement__ = 631;
      class_mean_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 631;
      class_mean_1dim__ = (class_effects ? stan::math::max(which_CE) : 0);
      current_statement__ = 631;
      stan::math::validate_non_negative_index("class_mean",
        "class_effects ? max(which_CE) : 0", class_mean_1dim__);
      current_statement__ = 632;
      class_sd_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 632;
      class_sd_1dim__ = (class_effects ? stan::math::max(which_CE_sd) : 0);
      current_statement__ = 632;
      stan::math::validate_non_negative_index("class_sd",
        "class_effects ? max(which_CE_sd) : 0", class_sd_1dim__);
      current_statement__ = 633;
      z_class_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 633;
      z_class_1dim__ = (class_effects ? n_class_trts : 0);
      current_statement__ = 633;
      stan::math::validate_non_negative_index("z_class",
        "class_effects ? n_class_trts : 0", z_class_1dim__);
      current_statement__ = 634;
      stan::math::validate_non_negative_index("aux", "n_aux", n_aux);
      current_statement__ = 635;
      aux2_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 635;
      aux2_1dim__ = (n_aux * gengamma);
      current_statement__ = 635;
      stan::math::validate_non_negative_index("aux2", "n_aux * gengamma",
        aux2_1dim__);
      current_statement__ = 636;
      beta_aux_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 636;
      beta_aux_1dim__ = (nonexp ? nX_aux : 0);
      current_statement__ = 636;
      stan::math::validate_non_negative_index("beta_aux",
        "nonexp ? nX_aux : 0", beta_aux_1dim__);
      current_statement__ = 637;
      beta_aux_2dim__ = std::numeric_limits<int>::min();
      current_statement__ = 637;
      beta_aux_2dim__ = (nonexp + gengamma);
      current_statement__ = 637;
      stan::math::validate_non_negative_index("beta_aux",
        "nonexp + gengamma", beta_aux_2dim__);
      current_statement__ = 638;
      stan::math::validate_non_negative_index("log_L_ipd", "ni_ipd", ni_ipd);
      current_statement__ = 639;
      stan::math::validate_non_negative_index("log_L_agd_arm", "ni_agd_arm",
        ni_agd_arm);
      current_statement__ = 640;
      stan::math::validate_non_negative_index("eta_ipd", "ni_ipd", ni_ipd);
      current_statement__ = 641;
      stan::math::validate_non_negative_index("f_delta", "n_delta", n_delta);
      current_statement__ = 642;
      f_class_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 642;
      f_class_1dim__ = (class_effects ? stan::math::max(which_fclass) : 0);
      current_statement__ = 642;
      stan::math::validate_non_negative_index("f_class",
        "class_effects ? max(which_fclass) : 0", f_class_1dim__);
      current_statement__ = 643;
      stan::math::validate_non_negative_index("allbeta", "nX", nX);
      current_statement__ = 644;
      stan::math::validate_non_negative_index("mu", "totns", totns);
      current_statement__ = 645;
      d_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 645;
      d_1dim__ = (nt - 1);
      current_statement__ = 645;
      stan::math::validate_non_negative_index("d", "nt - 1", d_1dim__);
      current_statement__ = 646;
      stan::math::validate_non_negative_index("omega", "nodesplit", nodesplit);
      current_statement__ = 647;
      beta_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 647;
      beta_1dim__ = (((nX - totns) - (nt - 1)) - nodesplit);
      current_statement__ = 647;
      stan::math::validate_non_negative_index("beta",
        "nX - totns - (nt - 1) - nodesplit", beta_1dim__);
      current_statement__ = 648;
      eta_agd_contrast_ii_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 648;
      eta_agd_contrast_ii_1dim__ = (stan::math::logical_gt(nint_max, 1) ? (nint
        * ni_agd_contrast) : 0);
      current_statement__ = 648;
      stan::math::validate_non_negative_index("eta_agd_contrast_ii",
        "nint_max > 1 ? nint * ni_agd_contrast : 0",
        eta_agd_contrast_ii_1dim__);
      current_statement__ = 649;
      stan::math::validate_non_negative_index("eta_agd_contrast_bar",
        "ni_agd_contrast", ni_agd_contrast);
      current_statement__ = 650;
      shape_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 650;
      shape_1dim__ = ((stan::math::primitive_value(
                         (stan::math::primitive_value(
                            (stan::math::primitive_value(
                               stan::math::logical_neq(dist, 1)) &&
                            stan::math::primitive_value(
                              stan::math::logical_neq(dist, 4)))) &&
                         stan::math::primitive_value(
                           stan::math::logical_neq(dist, 6))))
        &&
        stan::math::primitive_value(stan::math::logical_neq(dist, 9))) ? n_aux : 0);
      current_statement__ = 650;
      stan::math::validate_non_negative_index("shape",
        "(dist != 1 && dist != 4 && dist != 6 && dist != 9) ? n_aux : 0",
        shape_1dim__);
      current_statement__ = 651;
      sdlog_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 651;
      sdlog_1dim__ = (stan::math::logical_eq(dist, 6) ? n_aux : 0);
      current_statement__ = 651;
      stan::math::validate_non_negative_index("sdlog",
        "dist == 6 ? n_aux : 0", sdlog_1dim__);
      current_statement__ = 652;
      sigma_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 652;
      sigma_1dim__ = (stan::math::logical_eq(dist, 9) ? n_aux : 0);
      current_statement__ = 652;
      stan::math::validate_non_negative_index("sigma",
        "dist == 9 ? n_aux : 0", sigma_1dim__);
      current_statement__ = 653;
      k_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 653;
      k_1dim__ = (stan::math::logical_eq(dist, 9) ? n_aux : 0);
      current_statement__ = 653;
      stan::math::validate_non_negative_index("k", "dist == 9 ? n_aux : 0",
        k_1dim__);
      current_statement__ = 654;
      d_aux_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 654;
      d_aux_1dim__ = (aux_reg_trt ? (nt - 1) : 0);
      current_statement__ = 654;
      stan::math::validate_non_negative_index("d_aux",
        "aux_reg_trt ? nt - 1 : 0", d_aux_1dim__);
      current_statement__ = 655;
      d_aux_2dim__ = std::numeric_limits<int>::min();
      current_statement__ = 655;
      d_aux_2dim__ = (nonexp + gengamma);
      current_statement__ = 655;
      stan::math::validate_non_negative_index("d_aux", "nonexp + gengamma",
        d_aux_2dim__);
      current_statement__ = 656;
      log_lik_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 656;
      log_lik_1dim__ = ((ni_ipd + ni_agd_arm) + ns_agd_contrast);
      current_statement__ = 656;
      stan::math::validate_non_negative_index("log_lik",
        "ni_ipd + ni_agd_arm + ns_agd_contrast", log_lik_1dim__);
      current_statement__ = 657;
      resdev_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 657;
      resdev_1dim__ = ((ni_ipd + ni_agd_arm) + ns_agd_contrast);
      current_statement__ = 657;
      stan::math::validate_non_negative_index("resdev",
        "ni_ipd + ni_agd_arm + ns_agd_contrast", resdev_1dim__);
      current_statement__ = 658;
      stan::math::validate_non_negative_index("fitted_agd_contrast",
        "ni_agd_contrast", ni_agd_contrast);
      current_statement__ = 659;
      theta_bar_cum_agd_contrast_1dim__ = std::numeric_limits<int>::min();
      current_statement__ = 659;
      theta_bar_cum_agd_contrast_1dim__ = (ni_agd_contrast * n_int_thin);
      current_statement__ = 659;
      stan::math::validate_non_negative_index("theta_bar_cum_agd_contrast",
        "ni_agd_contrast * n_int_thin", theta_bar_cum_agd_contrast_1dim__);
      current_statement__ = 660;
      stan::math::validate_non_negative_index("delta", "n_delta", n_delta);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    num_params_r__ = nX + n_delta + tau_1dim__ + class_mean_1dim__ +
      class_sd_1dim__ + z_class_1dim__ + n_aux + aux2_1dim__ +
      (beta_aux_1dim__ * beta_aux_2dim__);
  }
  inline std::string model_name() const final {
    return "model_survival_param";
  }
  inline std::vector<std::string> model_compile_info() const noexcept {
    return std::vector<std::string>{"stanc_version = stanc3 v2.32.2",
             "stancflags = --allow-undefined"};
  }
  template <bool propto__, bool jacobian__, typename VecR, typename VecI,
            stan::require_vector_like_t<VecR>* = nullptr,
            stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr>
  inline stan::scalar_type_t<VecR>
  log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream*
                pstream__ = nullptr) const {
    using T__ = stan::scalar_type_t<VecR>;
    using local_scalar_t__ = T__;
    T__ lp__(0.0);
    stan::math::accumulator<T__> lp_accum__;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    int current_statement__ = 0;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    static constexpr const char* function__ =
      "model_survival_param_namespace::log_prob";
    // suppress unused var warning
    (void) function__;
    try {
      Eigen::Matrix<local_scalar_t__,-1,1> beta_tilde =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nX, DUMMY_VAR__);
      current_statement__ = 1;
      beta_tilde = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(nX);
      Eigen::Matrix<local_scalar_t__,-1,1> u_delta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_delta, DUMMY_VAR__);
      current_statement__ = 2;
      u_delta = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(n_delta);
      Eigen::Matrix<local_scalar_t__,-1,1> tau =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(tau_1dim__,
          DUMMY_VAR__);
      current_statement__ = 3;
      tau = in__.template read_constrain_lb<
              Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
              tau_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> class_mean =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_mean_1dim__,
          DUMMY_VAR__);
      current_statement__ = 4;
      class_mean = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(class_mean_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> class_sd =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_sd_1dim__,
          DUMMY_VAR__);
      current_statement__ = 5;
      class_sd = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   class_sd_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> z_class =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(z_class_1dim__,
          DUMMY_VAR__);
      current_statement__ = 6;
      z_class = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(z_class_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> aux =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_aux, DUMMY_VAR__);
      current_statement__ = 7;
      aux = in__.template read_constrain_lb<
              Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
              n_aux);
      Eigen::Matrix<local_scalar_t__,-1,1> aux2 =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(aux2_1dim__,
          DUMMY_VAR__);
      current_statement__ = 8;
      aux2 = in__.template read_constrain_lb<
               Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
               aux2_1dim__);
      Eigen::Matrix<local_scalar_t__,-1,-1> beta_aux =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(beta_aux_1dim__,
          beta_aux_2dim__, DUMMY_VAR__);
      current_statement__ = 9;
      beta_aux = in__.template read<
                   Eigen::Matrix<local_scalar_t__,-1,-1>>(beta_aux_1dim__,
                   beta_aux_2dim__);
      Eigen::Matrix<local_scalar_t__,-1,1> log_L_ipd =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_ipd, DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> log_L_agd_arm =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_agd_arm,
          DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> eta_ipd =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_ipd, DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> f_delta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_delta, DUMMY_VAR__);
      current_statement__ = 13;
      stan::model::assign(f_delta,
        (RE ? stan::math::eval(
                (RE_sparse ? stan::math::eval(
                               stan::math::multiply(
                                 stan::model::rvalue(tau, "tau",
                                   stan::model::index_uni(1)),
                                 stan::math::csr_matrix_times_vector(n_delta,
                                   n_delta, RE_L_w, RE_L_v, RE_L_u, u_delta))) : 
                stan::math::eval(
                  stan::math::multiply(
                    stan::math::multiply(
                      stan::model::rvalue(tau, "tau",
                        stan::model::index_uni(1)), RE_L), u_delta)))) : 
        stan::math::eval(u_delta)), "assigning variable f_delta");
      Eigen::Matrix<local_scalar_t__,-1,1> f_class =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(f_class_1dim__,
          DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> allbeta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nX, DUMMY_VAR__);
      current_statement__ = 15;
      stan::model::assign(allbeta,
        (QR ? stan::math::eval(stan::math::multiply(R_inv, beta_tilde)) : 
        stan::math::eval(beta_tilde)), "assigning variable allbeta");
      Eigen::Matrix<local_scalar_t__,-1,1> mu =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(totns, DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> d =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(d_1dim__, DUMMY_VAR__);
      current_statement__ = 17;
      stan::model::assign(d,
        stan::model::rvalue(allbeta, "allbeta",
          stan::model::index_min_max((totns + 1), ((totns + nt) - 1))),
        "assigning variable d");
      Eigen::Matrix<local_scalar_t__,-1,1> omega =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nodesplit,
          DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> beta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(beta_1dim__,
          DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_contrast_ii =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(eta_agd_contrast_ii_1dim__,
          DUMMY_VAR__);
      Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_contrast_bar =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_agd_contrast,
          DUMMY_VAR__);
      current_statement__ = 34;
      if (totns) {
        current_statement__ = 32;
        stan::model::assign(mu,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_min_max(1, totns)), "assigning variable mu");
      }
      current_statement__ = 37;
      if ((((nX - totns) - (nt - 1)) - nodesplit)) {
        current_statement__ = 35;
        stan::model::assign(beta,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_min(((totns + nt) + nodesplit))),
          "assigning variable beta");
      }
      current_statement__ = 40;
      if (nodesplit) {
        current_statement__ = 38;
        stan::model::assign(omega,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_uni((totns + nt))),
          "assigning variable omega", stan::model::index_uni(1));
      }
      current_statement__ = 44;
      if (class_effects) {
        current_statement__ = 41;
        stan::model::assign(f_class,
          stan::math::add(
            stan::math::subtract(
              stan::model::rvalue(class_mean, "class_mean",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_multi(which_class_trt)))),
              stan::model::rvalue(d, "d",
                stan::model::index_multi(which_class_trt))),
            stan::math::elt_multiply(
              stan::model::rvalue(class_sd, "class_sd",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE_sd, "which_CE_sd",
                    stan::model::index_multi(which_class_trt)))), z_class)),
          "assigning variable f_class");
        current_statement__ = 42;
        stan::model::assign(d,
          stan::math::add(
            stan::model::rvalue(class_mean, "class_mean",
              stan::model::index_multi(
                stan::model::rvalue(which_CE, "which_CE",
                  stan::model::index_multi(which_class_trt)))),
            stan::math::elt_multiply(
              stan::model::rvalue(class_sd, "class_sd",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE_sd, "which_CE_sd",
                    stan::model::index_multi(which_class_trt)))), z_class)),
          "assigning variable d", stan::model::index_multi(which_class_trt));
      }
      current_statement__ = 68;
      if (ni_ipd) {
        current_statement__ = 56;
        if (RE) {
          current_statement__ = 47;
          stan::math::validate_non_negative_index("eta_ipd_noRE", "ni_ipd",
            ni_ipd);
          Eigen::Matrix<local_scalar_t__,-1,1> eta_ipd_noRE =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_ipd,
              DUMMY_VAR__);
          current_statement__ = 48;
          stan::model::assign(eta_ipd_noRE,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_ipd, beta_tilde),
                              offset_ipd)) : stan::math::eval(
                                               stan::math::multiply(X_ipd,
                                                 beta_tilde))),
            "assigning variable eta_ipd_noRE");
          current_statement__ = 53;
          for (int i = 1; i <= ni_ipd; ++i) {
            current_statement__ = 51;
            if (stan::model::rvalue(which_RE, "which_RE",
                  stan::model::index_uni(
                    stan::model::rvalue(ipd_arm, "ipd_arm",
                      stan::model::index_uni(i))))) {
              current_statement__ = 50;
              stan::model::assign(eta_ipd,
                (stan::model::rvalue(eta_ipd_noRE, "eta_ipd_noRE",
                   stan::model::index_uni(i)) +
                stan::model::rvalue(f_delta, "f_delta",
                  stan::model::index_uni(
                    stan::model::rvalue(which_RE, "which_RE",
                      stan::model::index_uni(
                        stan::model::rvalue(ipd_arm, "ipd_arm",
                          stan::model::index_uni(i))))))),
                "assigning variable eta_ipd", stan::model::index_uni(i));
            } else {
              current_statement__ = 49;
              stan::model::assign(eta_ipd,
                stan::model::rvalue(eta_ipd_noRE, "eta_ipd_noRE",
                  stan::model::index_uni(i)), "assigning variable eta_ipd",
                stan::model::index_uni(i));
            }
          }
        } else {
          current_statement__ = 45;
          stan::model::assign(eta_ipd,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_ipd, beta_tilde),
                              offset_ipd)) : stan::math::eval(
                                               stan::math::multiply(X_ipd,
                                                 beta_tilde))),
            "assigning variable eta_ipd");
        }
        current_statement__ = 59;
        if (stan::math::logical_gt(brmr_n_col, 0)) {
          current_statement__ = 57;
          stan::model::assign(eta_ipd,
            stan::math::add(stan::model::deep_copy(eta_ipd),
              stan::math::elt_multiply(
                stan::math::subtract(
                  stan::math::subtract(
                    stan::math::multiply(
                      stan::model::rvalue(X_ipd, "X_ipd",
                        stan::model::index_omni(),
                        stan::model::index_min_max(1, totns)), mu), xbar_mu),
                  1),
                stan::math::multiply(
                  stan::model::rvalue(X_ipd, "X_ipd",
                    stan::model::index_omni(),
                    stan::model::index_multi(brmr_col)),
                  stan::model::rvalue(beta_tilde, "beta_tilde",
                    stan::model::index_multi(brmr_col))))),
            "assigning variable eta_ipd");
        }
        current_statement__ = 66;
        if (class_effects) {
          current_statement__ = 64;
          for (int i = 1; i <= ni_ipd; ++i) {
            current_statement__ = 62;
            if ((stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(ipd_trt, "ipd_trt",
                       stan::model::index_uni(
                         stan::model::rvalue(ipd_arm, "ipd_arm",
                           stan::model::index_uni(i)))), 1))
                &&
                stan::math::primitive_value(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_uni(
                      (stan::model::rvalue(ipd_trt, "ipd_trt",
                         stan::model::index_uni(
                           stan::model::rvalue(ipd_arm, "ipd_arm",
                             stan::model::index_uni(i)))) - 1)))))) {
              current_statement__ = 60;
              stan::model::assign(eta_ipd,
                (stan::model::rvalue(eta_ipd, "eta_ipd",
                   stan::model::index_uni(i)) +
                stan::model::rvalue(f_class, "f_class",
                  stan::model::index_uni(
                    stan::model::rvalue(which_fclass, "which_fclass",
                      stan::model::index_uni(
                        (stan::model::rvalue(ipd_trt, "ipd_trt",
                           stan::model::index_uni(
                             stan::model::rvalue(ipd_arm, "ipd_arm",
                               stan::model::index_uni(i)))) - 1)))))),
                "assigning variable eta_ipd", stan::model::index_uni(i));
            }
          }
        }
      }
      current_statement__ = 123;
      if (ni_agd_contrast) {
        current_statement__ = 121;
        if (stan::math::logical_gt(nint_max, 1)) {
          current_statement__ = 91;
          stan::math::validate_non_negative_index("eta_agd_contrast_noRE",
            "nint_max * ni_agd_contrast", (nint_max * ni_agd_contrast));
          Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_contrast_noRE =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant((nint_max *
              ni_agd_contrast), DUMMY_VAR__);
          current_statement__ = 92;
          stan::model::assign(eta_agd_contrast_noRE,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_agd_contrast, beta_tilde),
                              offset_agd_contrast)) : stan::math::eval(
                                                        stan::math::multiply(
                                                          X_agd_contrast,
                                                          beta_tilde))),
            "assigning variable eta_agd_contrast_noRE");
          current_statement__ = 102;
          if (class_effects) {
            current_statement__ = 100;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 95;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt,
                         "agd_contrast_trt", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt,
                           "agd_contrast_trt", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 93;
                stan::model::assign(eta_agd_contrast_noRE,
                  stan::math::add(
                    stan::model::deep_copy(
                      stan::model::rvalue(eta_agd_contrast_noRE,
                        "eta_agd_contrast_noRE",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)))),
                    stan::model::rvalue(f_class, "f_class",
                      stan::model::index_uni(
                        stan::model::rvalue(which_fclass, "which_fclass",
                          stan::model::index_uni(
                            (stan::model::rvalue(agd_contrast_trt,
                               "agd_contrast_trt", stan::model::index_uni(i))
                            - 1)))))),
                  "assigning variable eta_agd_contrast_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint)));
              }
              current_statement__ = 98;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt_b,
                         "agd_contrast_trt_b", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt_b,
                           "agd_contrast_trt_b", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 96;
                stan::model::assign(eta_agd_contrast_noRE,
                  stan::math::subtract(
                    stan::model::deep_copy(
                      stan::model::rvalue(eta_agd_contrast_noRE,
                        "eta_agd_contrast_noRE",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)))),
                    stan::model::rvalue(f_class, "f_class",
                      stan::model::index_uni(
                        stan::model::rvalue(which_fclass, "which_fclass",
                          stan::model::index_uni(
                            (stan::model::rvalue(agd_contrast_trt_b,
                               "agd_contrast_trt_b",
                               stan::model::index_uni(i)) - 1)))))),
                  "assigning variable eta_agd_contrast_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint)));
              }
            }
          }
          current_statement__ = 119;
          if (RE) {
            current_statement__ = 117;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 114;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i)))) {
                current_statement__ = 113;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::math::add(
                    stan::model::rvalue(eta_agd_contrast_noRE,
                      "eta_agd_contrast_noRE",
                      stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                        (((i - 1) * nint_max) + nint))),
                    stan::model::rvalue(f_delta, "f_delta",
                      stan::model::index_uni(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(((narm_ipd + narm_agd_arm) +
                            i)))))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              } else {
                current_statement__ = 112;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE",
                    stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                      (((i - 1) * nint_max) + nint))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              }
              current_statement__ = 115;
              stan::model::assign(eta_agd_contrast_bar,
                stan::math::mean(
                  stan::model::rvalue(eta_agd_contrast_ii,
                    "eta_agd_contrast_ii",
                    stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                      nint)))), "assigning variable eta_agd_contrast_bar",
                stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 107;
            if (stan::math::logical_eq(nint, nint_max)) {
              current_statement__ = 106;
              stan::model::assign(eta_agd_contrast_ii, eta_agd_contrast_noRE,
                "assigning variable eta_agd_contrast_ii");
            } else {
              current_statement__ = 105;
              for (int i = 1; i <= ni_agd_contrast; ++i) {
                current_statement__ = 103;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE",
                    stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                      (((i - 1) * nint_max) + nint))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              }
            }
            current_statement__ = 110;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 108;
              stan::model::assign(eta_agd_contrast_bar,
                stan::math::mean(
                  stan::model::rvalue(eta_agd_contrast_ii,
                    "eta_agd_contrast_ii",
                    stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                      nint)))), "assigning variable eta_agd_contrast_bar",
                stan::model::index_uni(i));
            }
          }
        } else {
          current_statement__ = 79;
          if (RE) {
            current_statement__ = 71;
            stan::math::validate_non_negative_index("eta_agd_contrast_noRE",
              "nint * ni_agd_contrast", (nint * ni_agd_contrast));
            Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_contrast_noRE =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant((nint *
                ni_agd_contrast), DUMMY_VAR__);
            current_statement__ = 72;
            stan::model::assign(eta_agd_contrast_noRE,
              (has_offset ? stan::math::eval(
                              stan::math::add(
                                stan::math::multiply(X_agd_contrast,
                                  beta_tilde), offset_agd_contrast)) : 
              stan::math::eval(
                stan::math::multiply(X_agd_contrast, beta_tilde))),
              "assigning variable eta_agd_contrast_noRE");
            current_statement__ = 77;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 75;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i)))) {
                current_statement__ = 74;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_noRE,
                     "eta_agd_contrast_noRE", stan::model::index_uni(i)) +
                  stan::model::rvalue(f_delta, "f_delta",
                    stan::model::index_uni(
                      stan::model::rvalue(which_RE, "which_RE",
                        stan::model::index_uni(((narm_ipd + narm_agd_arm) +
                          i)))))), "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              } else {
                current_statement__ = 73;
                stan::model::assign(eta_agd_contrast_bar,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE", stan::model::index_uni(i)),
                  "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
            }
          } else {
            current_statement__ = 69;
            stan::model::assign(eta_agd_contrast_bar,
              (has_offset ? stan::math::eval(
                              stan::math::add(
                                stan::math::multiply(X_agd_contrast,
                                  beta_tilde), offset_agd_contrast)) : 
              stan::math::eval(
                stan::math::multiply(X_agd_contrast, beta_tilde))),
              "assigning variable eta_agd_contrast_bar");
          }
          current_statement__ = 89;
          if (class_effects) {
            current_statement__ = 87;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 82;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt,
                         "agd_contrast_trt", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt,
                           "agd_contrast_trt", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 80;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_bar,
                     "eta_agd_contrast_bar", stan::model::index_uni(i)) +
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_contrast_trt,
                             "agd_contrast_trt", stan::model::index_uni(i)) -
                          1)))))), "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
              current_statement__ = 85;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt_b,
                         "agd_contrast_trt_b", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt_b,
                           "agd_contrast_trt_b", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 83;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_bar,
                     "eta_agd_contrast_bar", stan::model::index_uni(i)) -
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_contrast_trt_b,
                             "agd_contrast_trt_b", stan::model::index_uni(i))
                          - 1)))))),
                  "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
            }
          }
        }
      }
      current_statement__ = 167;
      if (ni_ipd) {
        current_statement__ = 165;
        if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
            || stan::math::primitive_value(aux_int))) {
          current_statement__ = 150;
          stan::math::validate_non_negative_index("auxi", "ni_ipd", ni_ipd);
          Eigen::Matrix<local_scalar_t__,-1,1> auxi =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_ipd,
              DUMMY_VAR__);
          current_statement__ = 152;
          stan::math::validate_non_negative_index("aux2i", "ni_ipd", ni_ipd);
          Eigen::Matrix<local_scalar_t__,-1,1> aux2i =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_ipd,
              DUMMY_VAR__);
          current_statement__ = 154;
          stan::math::validate_non_negative_index("eXbeta",
            "nonexp ? ni_ipd : 0", (nonexp ? ni_ipd : 0));
          current_statement__ = 155;
          stan::math::validate_non_negative_index("eXbeta",
            "nonexp + gengamma", (nonexp + gengamma));
          Eigen::Matrix<local_scalar_t__,-1,-1> eXbeta =
            Eigen::Matrix<local_scalar_t__,-1,-1>::Constant((nonexp ? ni_ipd : 0),
              (nonexp + gengamma), DUMMY_VAR__);
          current_statement__ = 158;
          if (nonexp) {
            current_statement__ = 157;
            stan::model::assign(eXbeta,
              stan::math::exp(stan::math::multiply(X_aux_ipd, beta_aux)),
              "assigning variable eXbeta");
          }
          current_statement__ = 160;
          if (nonexp) {
            current_statement__ = 159;
            stan::model::assign(auxi,
              stan::math::elt_multiply(
                stan::model::rvalue(aux, "aux",
                  stan::model::index_multi(aux_id_ipd)),
                stan::model::rvalue(eXbeta, "eXbeta",
                  stan::model::index_omni(), stan::model::index_uni(1))),
              "assigning variable auxi");
          }
          current_statement__ = 162;
          if (gengamma) {
            current_statement__ = 161;
            stan::model::assign(aux2i,
              stan::math::elt_multiply(
                stan::model::rvalue(aux2, "aux2",
                  stan::model::index_multi(aux_id_ipd)),
                stan::model::rvalue(eXbeta, "eXbeta",
                  stan::model::index_omni(), stan::model::index_uni(2))),
              "assigning variable aux2i");
          }
          current_statement__ = 163;
          stan::model::assign(log_L_ipd,
            loglik(dist, ipd_time, ipd_start_time, ipd_delay_time,
              ipd_status, eta_ipd, auxi, aux2i, pstream__),
            "assigning variable log_L_ipd");
        } else {
          current_statement__ = 148;
          for (int i = 1; i <= n_aux_group; ++i) {
            int ni = std::numeric_limits<int>::min();
            current_statement__ = 124;
            ni = stan::model::rvalue(ni_aux_group_ipd, "ni_aux_group_ipd",
                   stan::model::index_uni(i));
            current_statement__ = 146;
            if (ni) {
              current_statement__ = 125;
              stan::math::validate_non_negative_index("wi", "ni", ni);
              std::vector<int> wi =
                std::vector<int>(ni, std::numeric_limits<int>::min());
              current_statement__ = 126;
              stan::model::assign(wi,
                stan::model::rvalue(wi_aux_group_ipd, "wi_aux_group_ipd",
                  stan::model::index_uni(i),
                  stan::model::index_min_max(1, ni)), "assigning variable wi");
              local_scalar_t__ auxi = DUMMY_VAR__;
              local_scalar_t__ aux2i = DUMMY_VAR__;
              current_statement__ = 129;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp + gengamma", (nonexp + gengamma));
              Eigen::Matrix<local_scalar_t__,1,-1> eXbeta =
                Eigen::Matrix<local_scalar_t__,1,-1>::Constant((nonexp +
                  gengamma), DUMMY_VAR__);
              current_statement__ = 132;
              if (nonexp) {
                current_statement__ = 131;
                stan::model::assign(eXbeta,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X_aux_ipd, "X_aux_ipd",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(1))),
                        stan::model::index_omni()), beta_aux)),
                  "assigning variable eXbeta");
              }
              current_statement__ = 143;
              if (nX_aux) {
                current_statement__ = 139;
                if (nonexp) {
                  current_statement__ = 138;
                  auxi = (stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(
                              stan::model::rvalue(aux_id_ipd, "aux_id_ipd",
                                stan::model::index_uni(
                                  stan::model::rvalue(wi, "wi",
                                    stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(1)));
                }
                current_statement__ = 141;
                if (gengamma) {
                  current_statement__ = 140;
                  aux2i = (stan::model::rvalue(aux2, "aux2",
                             stan::model::index_uni(
                               stan::model::rvalue(aux_id_ipd, "aux_id_ipd",
                                 stan::model::index_uni(
                                   stan::model::rvalue(wi, "wi",
                                     stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(2)));
                }
              } else {
                current_statement__ = 134;
                if (nonexp) {
                  current_statement__ = 133;
                  auxi = stan::model::rvalue(aux, "aux",
                           stan::model::index_uni(i));
                }
                current_statement__ = 136;
                if (gengamma) {
                  current_statement__ = 135;
                  aux2i = stan::model::rvalue(aux2, "aux2",
                            stan::model::index_uni(i));
                }
              }
              current_statement__ = 144;
              stan::model::assign(log_L_ipd,
                loglik2(dist,
                  stan::model::rvalue(ipd_time, "ipd_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_start_time, "ipd_start_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_delay_time, "ipd_delay_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_status, "ipd_status",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(eta_ipd, "eta_ipd",
                    stan::model::index_multi(wi)), auxi, aux2i, pstream__),
                "assigning variable log_L_ipd", stan::model::index_multi(wi));
            }
          }
        }
      }
      current_statement__ = 290;
      if (ni_agd_arm) {
        current_statement__ = 168;
        stan::math::validate_non_negative_index("eta_agd_arm_noRE",
          "nint_max * ni_agd_arm", (nint_max * ni_agd_arm));
        Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_arm_noRE =
          Eigen::Matrix<local_scalar_t__,-1,1>::Constant((nint_max *
            ni_agd_arm), DUMMY_VAR__);
        current_statement__ = 169;
        stan::model::assign(eta_agd_arm_noRE,
          (has_offset ? stan::math::eval(
                          stan::math::add(
                            stan::math::multiply(X_agd_arm, beta_tilde),
                            offset_agd_arm)) : stan::math::eval(
                                                 stan::math::multiply(
                                                   X_agd_arm, beta_tilde))),
          "assigning variable eta_agd_arm_noRE");
        current_statement__ = 172;
        if (stan::math::logical_gt(brmr_n_col, 0)) {
          current_statement__ = 170;
          stan::model::assign(eta_agd_arm_noRE,
            stan::math::add(stan::model::deep_copy(eta_agd_arm_noRE),
              stan::math::elt_multiply(
                stan::math::subtract(
                  stan::math::subtract(
                    stan::math::multiply(
                      stan::model::rvalue(X_agd_arm, "X_agd_arm",
                        stan::model::index_omni(),
                        stan::model::index_min_max(1, totns)), mu), xbar_mu),
                  1),
                stan::math::multiply(
                  stan::model::rvalue(X_agd_arm, "X_agd_arm",
                    stan::model::index_omni(),
                    stan::model::index_multi(brmr_col)),
                  stan::model::rvalue(beta_tilde, "beta_tilde",
                    stan::model::index_multi(brmr_col))))),
            "assigning variable eta_agd_arm_noRE");
        }
        current_statement__ = 179;
        if (class_effects) {
          current_statement__ = 177;
          for (int i = 1; i <= ni_agd_arm; ++i) {
            current_statement__ = 175;
            if ((stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                       stan::model::index_uni(i)), 1))
                &&
                stan::math::primitive_value(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_uni(
                      (stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                         stan::model::index_uni(i)) - 1)))))) {
              current_statement__ = 173;
              stan::model::assign(eta_agd_arm_noRE,
                stan::math::add(
                  stan::model::deep_copy(
                    stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                      stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                        (((i - 1) * nint_max) + nint)))),
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                             stan::model::index_uni(i)) - 1)))))),
                "assigning variable eta_agd_arm_noRE",
                stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i -
                  1) * nint_max) + nint)));
            }
          }
        }
        current_statement__ = 288;
        if (stan::math::logical_gt(nint_max, 1)) {
          current_statement__ = 286;
          if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
              || stan::math::primitive_value(aux_int))) {
            current_statement__ = 284;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 261;
              stan::math::validate_non_negative_index("eta_agd_arm_ii",
                "nint", nint);
              Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_arm_ii =
                Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                  DUMMY_VAR__);
              current_statement__ = 263;
              stan::math::validate_non_negative_index("log_L_ii", "nint",
                nint);
              Eigen::Matrix<local_scalar_t__,-1,1> log_L_ii =
                Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                  DUMMY_VAR__);
              current_statement__ = 265;
              stan::math::validate_non_negative_index("auxi", "nint", nint);
              Eigen::Matrix<local_scalar_t__,-1,1> auxi =
                Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                  DUMMY_VAR__);
              current_statement__ = 267;
              stan::math::validate_non_negative_index("aux2i", "nint", nint);
              Eigen::Matrix<local_scalar_t__,-1,1> aux2i =
                Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                  DUMMY_VAR__);
              current_statement__ = 269;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp ? nint : 0", (nonexp ? nint : 0));
              current_statement__ = 270;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp + gengamma", (nonexp + gengamma));
              Eigen::Matrix<local_scalar_t__,-1,-1> eXbeta =
                Eigen::Matrix<local_scalar_t__,-1,-1>::Constant((nonexp ? nint : 0),
                  (nonexp + gengamma), DUMMY_VAR__);
              current_statement__ = 273;
              if (nonexp) {
                current_statement__ = 272;
                stan::model::assign(eXbeta,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)),
                        stan::model::index_omni()), beta_aux)),
                  "assigning variable eXbeta");
              }
              current_statement__ = 275;
              if (nonexp) {
                current_statement__ = 274;
                stan::model::assign(auxi,
                  stan::math::elt_multiply(
                    stan::model::rvalue(aux, "aux",
                      stan::model::index_multi(
                        stan::model::rvalue(aux_id_agd_arm, "aux_id_agd_arm",
                          stan::model::index_min_max((1 + ((i - 1) *
                            nint_max)), (((i - 1) * nint_max) + nint))))),
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_omni(), stan::model::index_uni(1))),
                  "assigning variable auxi");
              }
              current_statement__ = 277;
              if (gengamma) {
                current_statement__ = 276;
                stan::model::assign(aux2i,
                  stan::math::elt_multiply(
                    stan::model::rvalue(aux2, "aux2",
                      stan::model::index_multi(
                        stan::model::rvalue(aux_id_agd_arm, "aux_id_agd_arm",
                          stan::model::index_min_max((1 + ((i - 1) *
                            nint_max)), (((i - 1) * nint_max) + nint))))),
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_omni(), stan::model::index_uni(2))),
                  "assigning variable aux2i");
              }
              current_statement__ = 278;
              stan::model::assign(eta_agd_arm_ii,
                stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint))),
                "assigning variable eta_agd_arm_ii");
              current_statement__ = 280;
              if ((stan::math::primitive_value(RE) &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_RE, "which_RE",
                      stan::model::index_uni(
                        stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                          stan::model::index_uni(i))))))) {
                current_statement__ = 279;
                stan::model::assign(eta_agd_arm_ii,
                  stan::math::add(stan::model::deep_copy(eta_agd_arm_ii),
                    stan::model::rvalue(f_delta, "f_delta",
                      stan::model::index_uni(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(
                            stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                              stan::model::index_uni(i))))))),
                  "assigning variable eta_agd_arm_ii");
              }
              current_statement__ = 281;
              stan::model::assign(log_L_ii,
                loglik_a2(dist,
                  stan::model::rvalue(agd_arm_time, "agd_arm_time",
                    stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_start_time,
                    "agd_arm_start_time", stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_delay_time,
                    "agd_arm_delay_time", stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_status, "agd_arm_status",
                    stan::model::index_uni(i)), eta_agd_arm_ii, auxi, aux2i,
                  pstream__), "assigning variable log_L_ii");
              current_statement__ = 282;
              stan::model::assign(log_L_agd_arm,
                (stan::math::log_sum_exp(log_L_ii) - stan::math::log(nint)),
                "assigning variable log_L_agd_arm", stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 259;
            for (int i = 1; i <= n_aux_group; ++i) {
              int ni = std::numeric_limits<int>::min();
              current_statement__ = 229;
              ni = stan::model::rvalue(ni_aux_group_agd_arm,
                     "ni_aux_group_agd_arm", stan::model::index_uni(i));
              current_statement__ = 257;
              if (ni) {
                current_statement__ = 230;
                stan::math::validate_non_negative_index("wi", "ni", ni);
                std::vector<int> wi =
                  std::vector<int>(ni, std::numeric_limits<int>::min());
                current_statement__ = 231;
                stan::model::assign(wi,
                  stan::model::rvalue(wi_aux_group_agd_arm,
                    "wi_aux_group_agd_arm", stan::model::index_uni(i),
                    stan::model::index_min_max(1, ni)),
                  "assigning variable wi");
                local_scalar_t__ auxi = DUMMY_VAR__;
                local_scalar_t__ aux2i = DUMMY_VAR__;
                current_statement__ = 234;
                stan::math::validate_non_negative_index("eXbeta",
                  "nonexp + gengamma", (nonexp + gengamma));
                Eigen::Matrix<local_scalar_t__,1,-1> eXbeta =
                  Eigen::Matrix<local_scalar_t__,1,-1>::Constant((nonexp +
                    gengamma), DUMMY_VAR__);
                current_statement__ = 237;
                if (nonexp) {
                  current_statement__ = 236;
                  stan::model::assign(eXbeta,
                    stan::math::exp(
                      stan::math::multiply(
                        stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                          stan::model::index_uni(
                            stan::model::rvalue(wi, "wi",
                              stan::model::index_uni(1))),
                          stan::model::index_omni()), beta_aux)),
                    "assigning variable eXbeta");
                }
                current_statement__ = 244;
                if (nX_aux) {
                  current_statement__ = 241;
                  auxi = (nonexp ? (stan::model::rvalue(aux, "aux",
                                      stan::model::index_uni(
                                        stan::model::rvalue(aux_id_agd_arm,
                                          "aux_id_agd_arm",
                                          stan::model::index_uni(
                                            stan::model::rvalue(wi, "wi",
                                              stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(1))) : 0);
                  current_statement__ = 242;
                  aux2i = (gengamma ? (stan::model::rvalue(aux2, "aux2",
                                         stan::model::index_uni(
                                           stan::model::rvalue(
                                             aux_id_agd_arm,
                                             "aux_id_agd_arm",
                                             stan::model::index_uni(
                                               stan::model::rvalue(wi, "wi",
                                                 stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(2))) : 0);
                } else {
                  current_statement__ = 238;
                  auxi = (nonexp ? stan::model::rvalue(aux, "aux",
                                     stan::model::index_uni(i)) : 0);
                  current_statement__ = 239;
                  aux2i = (gengamma ? stan::model::rvalue(aux2, "aux2",
                                        stan::model::index_uni(i)) : 0);
                }
                current_statement__ = 255;
                for (int j = 1; j <= ni; ++j) {
                  current_statement__ = 245;
                  stan::math::validate_non_negative_index("eta_agd_arm_ii",
                    "nint", nint);
                  Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_arm_ii =
                    Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                      DUMMY_VAR__);
                  current_statement__ = 247;
                  stan::math::validate_non_negative_index("log_L_ii", "nint",
                    nint);
                  Eigen::Matrix<local_scalar_t__,-1,1> log_L_ii =
                    Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nint,
                      DUMMY_VAR__);
                  current_statement__ = 249;
                  stan::model::assign(eta_agd_arm_ii,
                    stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                      stan::model::index_min_max((1 +
                        ((stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)) - 1) * nint_max)),
                        (((stan::model::rvalue(wi, "wi",
                             stan::model::index_uni(j)) - 1) * nint_max) +
                        nint))), "assigning variable eta_agd_arm_ii");
                  current_statement__ = 251;
                  if ((stan::math::primitive_value(RE) &&
                      stan::math::primitive_value(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(
                            stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                              stan::model::index_uni(
                                stan::model::rvalue(wi, "wi",
                                  stan::model::index_uni(j))))))))) {
                    current_statement__ = 250;
                    stan::model::assign(eta_agd_arm_ii,
                      stan::math::add(stan::model::deep_copy(eta_agd_arm_ii),
                        stan::model::rvalue(f_delta, "f_delta",
                          stan::model::index_uni(
                            stan::model::rvalue(which_RE, "which_RE",
                              stan::model::index_uni(
                                stan::model::rvalue(agd_arm_arm2,
                                  "agd_arm_arm2",
                                  stan::model::index_uni(
                                    stan::model::rvalue(wi, "wi",
                                      stan::model::index_uni(j))))))))),
                      "assigning variable eta_agd_arm_ii");
                  }
                  current_statement__ = 252;
                  stan::model::assign(log_L_ii,
                    loglik_a(dist,
                      stan::model::rvalue(agd_arm_time, "agd_arm_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_start_time,
                        "agd_arm_start_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_delay_time,
                        "agd_arm_delay_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_status, "agd_arm_status",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))), eta_agd_arm_ii,
                      auxi, aux2i, pstream__), "assigning variable log_L_ii");
                  current_statement__ = 253;
                  stan::model::assign(log_L_agd_arm,
                    (stan::math::log_sum_exp(log_L_ii) -
                    stan::math::log(nint)),
                    "assigning variable log_L_agd_arm",
                    stan::model::index_uni(
                      stan::model::rvalue(wi, "wi", stan::model::index_uni(j))));
                }
              }
            }
          }
        } else {
          current_statement__ = 180;
          stan::math::validate_non_negative_index("eta_agd_arm",
            "ni_agd_arm", ni_agd_arm);
          Eigen::Matrix<local_scalar_t__,-1,1> eta_agd_arm =
            Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_agd_arm,
              DUMMY_VAR__);
          current_statement__ = 181;
          stan::model::assign(eta_agd_arm, eta_agd_arm_noRE,
            "assigning variable eta_agd_arm");
          current_statement__ = 185;
          if (RE) {
            current_statement__ = 184;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 183;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(
                      stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                        stan::model::index_uni(i))))) {
                current_statement__ = 182;
                stan::model::assign(eta_agd_arm,
                  (stan::model::rvalue(eta_agd_arm, "eta_agd_arm",
                     stan::model::index_uni(i)) +
                  stan::model::rvalue(f_delta, "f_delta",
                    stan::model::index_uni(
                      stan::model::rvalue(which_RE, "which_RE",
                        stan::model::index_uni(
                          stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                            stan::model::index_uni(i))))))),
                  "assigning variable eta_agd_arm", stan::model::index_uni(i));
              }
            }
          }
          current_statement__ = 227;
          if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
              || stan::math::primitive_value(aux_int))) {
            current_statement__ = 212;
            stan::math::validate_non_negative_index("auxi", "ni_agd_arm",
              ni_agd_arm);
            Eigen::Matrix<local_scalar_t__,-1,1> auxi =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_agd_arm,
                DUMMY_VAR__);
            current_statement__ = 214;
            stan::math::validate_non_negative_index("aux2i", "ni_agd_arm",
              ni_agd_arm);
            Eigen::Matrix<local_scalar_t__,-1,1> aux2i =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant(ni_agd_arm,
                DUMMY_VAR__);
            current_statement__ = 216;
            stan::math::validate_non_negative_index("eXbeta", "ni_agd_arm",
              ni_agd_arm);
            current_statement__ = 217;
            stan::math::validate_non_negative_index("eXbeta",
              "nonexp + gengamma", (nonexp + gengamma));
            Eigen::Matrix<local_scalar_t__,-1,-1> eXbeta =
              Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(ni_agd_arm,
                (nonexp + gengamma), DUMMY_VAR__);
            current_statement__ = 220;
            if (nonexp) {
              current_statement__ = 219;
              stan::model::assign(eXbeta,
                stan::math::exp(stan::math::multiply(X_aux_agd_arm, beta_aux)),
                "assigning variable eXbeta");
            }
            current_statement__ = 222;
            if (nonexp) {
              current_statement__ = 221;
              stan::model::assign(auxi,
                stan::math::elt_multiply(
                  stan::model::rvalue(aux, "aux",
                    stan::model::index_multi(aux_id_agd_arm)),
                  stan::model::rvalue(eXbeta, "eXbeta",
                    stan::model::index_omni(), stan::model::index_uni(1))),
                "assigning variable auxi");
            }
            current_statement__ = 224;
            if (gengamma) {
              current_statement__ = 223;
              stan::model::assign(aux2i,
                stan::math::elt_multiply(
                  stan::model::rvalue(aux2, "aux2",
                    stan::model::index_multi(aux_id_agd_arm)),
                  stan::model::rvalue(eXbeta, "eXbeta",
                    stan::model::index_omni(), stan::model::index_uni(2))),
                "assigning variable aux2i");
            }
            current_statement__ = 225;
            stan::model::assign(log_L_agd_arm,
              loglik(dist, agd_arm_time, agd_arm_start_time,
                agd_arm_delay_time, agd_arm_status, eta_agd_arm, auxi, aux2i,
                pstream__), "assigning variable log_L_agd_arm");
          } else {
            current_statement__ = 210;
            for (int i = 1; i <= n_aux_group; ++i) {
              int ni = std::numeric_limits<int>::min();
              current_statement__ = 186;
              ni = stan::model::rvalue(ni_aux_group_agd_arm,
                     "ni_aux_group_agd_arm", stan::model::index_uni(i));
              current_statement__ = 208;
              if (ni) {
                current_statement__ = 187;
                stan::math::validate_non_negative_index("wi", "ni", ni);
                std::vector<int> wi =
                  std::vector<int>(ni, std::numeric_limits<int>::min());
                current_statement__ = 188;
                stan::model::assign(wi,
                  stan::model::rvalue(wi_aux_group_agd_arm,
                    "wi_aux_group_agd_arm", stan::model::index_uni(i),
                    stan::model::index_min_max(1, ni)),
                  "assigning variable wi");
                local_scalar_t__ auxi = DUMMY_VAR__;
                local_scalar_t__ aux2i = DUMMY_VAR__;
                current_statement__ = 191;
                stan::math::validate_non_negative_index("eXbeta",
                  "nonexp + gengamma", (nonexp + gengamma));
                Eigen::Matrix<local_scalar_t__,1,-1> eXbeta =
                  Eigen::Matrix<local_scalar_t__,1,-1>::Constant((nonexp +
                    gengamma), DUMMY_VAR__);
                current_statement__ = 194;
                if (nonexp) {
                  current_statement__ = 193;
                  stan::model::assign(eXbeta,
                    stan::math::exp(
                      stan::math::multiply(
                        stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                          stan::model::index_uni(
                            stan::model::rvalue(wi, "wi",
                              stan::model::index_uni(1))),
                          stan::model::index_omni()), beta_aux)),
                    "assigning variable eXbeta");
                }
                current_statement__ = 205;
                if (nX_aux) {
                  current_statement__ = 201;
                  if (nonexp) {
                    current_statement__ = 200;
                    auxi = (stan::model::rvalue(aux, "aux",
                              stan::model::index_uni(
                                stan::model::rvalue(aux_id_agd_arm,
                                  "aux_id_agd_arm",
                                  stan::model::index_uni(
                                    stan::model::rvalue(wi, "wi",
                                      stan::model::index_uni(1))))))
                      *
                      stan::model::rvalue(eXbeta, "eXbeta",
                        stan::model::index_uni(1)));
                  }
                  current_statement__ = 203;
                  if (gengamma) {
                    current_statement__ = 202;
                    aux2i = (stan::model::rvalue(aux2, "aux2",
                               stan::model::index_uni(
                                 stan::model::rvalue(aux_id_agd_arm,
                                   "aux_id_agd_arm",
                                   stan::model::index_uni(
                                     stan::model::rvalue(wi, "wi",
                                       stan::model::index_uni(1))))))
                      *
                      stan::model::rvalue(eXbeta, "eXbeta",
                        stan::model::index_uni(2)));
                  }
                } else {
                  current_statement__ = 196;
                  if (nonexp) {
                    current_statement__ = 195;
                    auxi = stan::model::rvalue(aux, "aux",
                             stan::model::index_uni(i));
                  }
                  current_statement__ = 198;
                  if (gengamma) {
                    current_statement__ = 197;
                    aux2i = stan::model::rvalue(aux2, "aux2",
                              stan::model::index_uni(i));
                  }
                }
                current_statement__ = 206;
                stan::model::assign(log_L_agd_arm,
                  loglik2(dist,
                    stan::model::rvalue(agd_arm_time, "agd_arm_time",
                      stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_start_time,
                      "agd_arm_start_time", stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_delay_time,
                      "agd_arm_delay_time", stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_status, "agd_arm_status",
                      stan::model::index_multi(wi)),
                    stan::model::rvalue(eta_agd_arm, "eta_agd_arm",
                      stan::model::index_multi(wi)), auxi, aux2i, pstream__),
                  "assigning variable log_L_agd_arm",
                  stan::model::index_multi(wi));
              }
            }
          }
        }
      }
      {
        current_statement__ = 339;
        prior_select_lp<propto__>(mu, prior_intercept_dist,
          prior_intercept_location, prior_intercept_scale,
          prior_intercept_df, lp__, lp_accum__, pstream__);
        current_statement__ = 345;
        if (stan::math::logical_eq(class_effects, 0)) {
          current_statement__ = 343;
          prior_select_lp<propto__>(d, prior_trt_dist, prior_trt_location,
            prior_trt_scale, prior_trt_df, lp__, lp_accum__, pstream__);
        } else {
          current_statement__ = 340;
          prior_select_lp<propto__>(class_mean, prior_class_mean_dist,
            prior_class_mean_location, prior_class_mean_scale,
            prior_class_mean_df, lp__, lp_accum__, pstream__);
          current_statement__ = 341;
          prior_select_lp<propto__>(class_sd, prior_class_sd_dist,
            prior_class_sd_location, prior_class_sd_scale, prior_class_sd_df,
            lp__, lp_accum__, pstream__);
        }
        current_statement__ = 346;
        prior_select_lp<propto__>(beta, prior_reg_dist, prior_reg_location,
          prior_reg_scale, prior_reg_df, lp__, lp_accum__, pstream__);
        current_statement__ = 347;
        prior_select_lp<propto__>(omega, prior_trt_dist, prior_trt_location,
          prior_trt_scale, prior_trt_df, lp__, lp_accum__, pstream__);
        current_statement__ = 365;
        if (RE) {
          current_statement__ = 363;
          if (stan::math::logical_eq(prior_het_type, 1)) {
            current_statement__ = 361;
            prior_select_lp<propto__>(tau, prior_het_dist,
              prior_het_location, prior_het_scale, prior_het_df, lp__,
              lp_accum__, pstream__);
          } else {
            current_statement__ = 348;
            stan::math::validate_non_negative_index("tau_t", "RE ? 1 : 0",
              (RE ? 1 : 0));
            Eigen::Matrix<local_scalar_t__,-1,1> tau_t =
              Eigen::Matrix<local_scalar_t__,-1,1>::Constant((RE ? 1 : 0),
                DUMMY_VAR__);
            current_statement__ = 357;
            if (stan::math::logical_eq(prior_het_type, 2)) {
              current_statement__ = 354;
              stan::model::assign(tau_t,
                stan::math::pow(
                  stan::model::rvalue(tau, "tau", stan::model::index_uni(1)),
                  2), "assigning variable tau_t", stan::model::index_uni(1));
              current_statement__ = 355;
              lp_accum__.add(stan::math::log(tau));
            } else {
              current_statement__ = 353;
              if (stan::math::logical_eq(prior_het_type, 3)) {
                current_statement__ = 350;
                stan::model::assign(tau_t,
                  stan::math::pow(
                    stan::model::rvalue(tau, "tau", stan::model::index_uni(1)),
                    -2), "assigning variable tau_t",
                  stan::model::index_uni(1));
                current_statement__ = 351;
                lp_accum__.add(stan::math::multiply(-3, stan::math::log(tau)));
              }
            }
            current_statement__ = 358;
            prior_select_lp<propto__>(tau_t, prior_het_dist,
              prior_het_location, prior_het_scale, prior_het_df, lp__,
              lp_accum__, pstream__);
          }
        }
        current_statement__ = 366;
        lp_accum__.add(stan::math::std_normal_lpdf<propto__>(u_delta));
        current_statement__ = 369;
        if (ni_agd_contrast) {
          current_statement__ = 367;
          lp_accum__.add(stan::math::multi_normal_lpdf<propto__>(
                           agd_contrast_y, eta_agd_contrast_bar,
                           agd_contrast_Sigma));
        }
        current_statement__ = 378;
        if (class_effects) {
          current_statement__ = 376;
          for (int t = 1; t <= (nt - 1); ++t) {
            current_statement__ = 374;
            if (stan::math::logical_eq(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_uni(t)), 0)) {
              current_statement__ = 372;
              prior_select2_lp<propto__>(
                stan::model::rvalue(d, "d", stan::model::index_uni(t)),
                prior_trt_dist, prior_trt_location, prior_trt_scale,
                prior_trt_df, lp__, lp_accum__, pstream__);
            } else {
              current_statement__ = 370;
              lp_accum__.add(stan::math::std_normal_lpdf<propto__>(
                               stan::model::rvalue(allbeta, "allbeta",
                                 stan::model::index_uni((totns + t)))));
            }
          }
        }
        current_statement__ = 379;
        lp_accum__.add(stan::math::std_normal_lpdf<propto__>(z_class));
        current_statement__ = 381;
        if (nonexp) {
          current_statement__ = 380;
          prior_select_lp<propto__>(aux, prior_aux_dist, prior_aux_location,
            prior_aux_scale, prior_aux_df, lp__, lp_accum__, pstream__);
        }
        current_statement__ = 383;
        if (gengamma) {
          current_statement__ = 382;
          prior_select_lp<propto__>(aux2, prior_aux2_dist,
            prior_aux2_location, prior_aux2_scale, prior_aux2_df, lp__,
            lp_accum__, pstream__);
        }
        current_statement__ = 385;
        if ((stan::math::primitive_value(nonexp) &&
            stan::math::primitive_value(nX_aux))) {
          current_statement__ = 384;
          prior_select_lp<propto__>(
            stan::model::rvalue(beta_aux, "beta_aux",
              stan::model::index_omni(), stan::model::index_uni(1)),
            prior_aux_reg_dist, prior_aux_reg_location, prior_aux_reg_scale,
            prior_aux_reg_df, lp__, lp_accum__, pstream__);
        }
        current_statement__ = 387;
        if ((stan::math::primitive_value(gengamma) &&
            stan::math::primitive_value(nX_aux))) {
          current_statement__ = 386;
          prior_select_lp<propto__>(
            stan::model::rvalue(beta_aux, "beta_aux",
              stan::model::index_omni(), stan::model::index_uni(2)),
            prior_aux_reg_dist, prior_aux_reg_location, prior_aux_reg_scale,
            prior_aux_reg_df, lp__, lp_accum__, pstream__);
        }
        current_statement__ = 388;
        lp_accum__.add(log_L_ipd);
        current_statement__ = 389;
        lp_accum__.add(log_L_agd_arm);
      }
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
    lp_accum__.add(lp__);
    return lp_accum__.sum();
  }
  template <typename RNG, typename VecR, typename VecI, typename VecVar,
            stan::require_vector_like_vt<std::is_floating_point,
            VecR>* = nullptr, stan::require_vector_like_vt<std::is_integral,
            VecI>* = nullptr, stan::require_vector_vt<std::is_floating_point,
            VecVar>* = nullptr>
  inline void
  write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__,
                   VecVar& vars__, const bool
                   emit_transformed_parameters__ = true, const bool
                   emit_generated_quantities__ = true, std::ostream*
                   pstream__ = nullptr) const {
    using local_scalar_t__ = double;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    stan::io::serializer<local_scalar_t__> out__(vars__);
    static constexpr bool propto__ = true;
    // suppress unused var warning
    (void) propto__;
    double lp__ = 0.0;
    // suppress unused var warning
    (void) lp__;
    int current_statement__ = 0;
    stan::math::accumulator<double> lp_accum__;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    constexpr bool jacobian__ = false;
    static constexpr const char* function__ =
      "model_survival_param_namespace::write_array";
    // suppress unused var warning
    (void) function__;
    try {
      Eigen::Matrix<double,-1,1> beta_tilde =
        Eigen::Matrix<double,-1,1>::Constant(nX,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 1;
      beta_tilde = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(nX);
      Eigen::Matrix<double,-1,1> u_delta =
        Eigen::Matrix<double,-1,1>::Constant(n_delta,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 2;
      u_delta = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(n_delta);
      Eigen::Matrix<double,-1,1> tau =
        Eigen::Matrix<double,-1,1>::Constant(tau_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 3;
      tau = in__.template read_constrain_lb<
              Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
              tau_1dim__);
      Eigen::Matrix<double,-1,1> class_mean =
        Eigen::Matrix<double,-1,1>::Constant(class_mean_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 4;
      class_mean = in__.template read<
                     Eigen::Matrix<local_scalar_t__,-1,1>>(class_mean_1dim__);
      Eigen::Matrix<double,-1,1> class_sd =
        Eigen::Matrix<double,-1,1>::Constant(class_sd_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 5;
      class_sd = in__.template read_constrain_lb<
                   Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
                   class_sd_1dim__);
      Eigen::Matrix<double,-1,1> z_class =
        Eigen::Matrix<double,-1,1>::Constant(z_class_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 6;
      z_class = in__.template read<
                  Eigen::Matrix<local_scalar_t__,-1,1>>(z_class_1dim__);
      Eigen::Matrix<double,-1,1> aux =
        Eigen::Matrix<double,-1,1>::Constant(n_aux,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 7;
      aux = in__.template read_constrain_lb<
              Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
              n_aux);
      Eigen::Matrix<double,-1,1> aux2 =
        Eigen::Matrix<double,-1,1>::Constant(aux2_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 8;
      aux2 = in__.template read_constrain_lb<
               Eigen::Matrix<local_scalar_t__,-1,1>, jacobian__>(0, lp__,
               aux2_1dim__);
      Eigen::Matrix<double,-1,-1> beta_aux =
        Eigen::Matrix<double,-1,-1>::Constant(beta_aux_1dim__,
          beta_aux_2dim__, std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 9;
      beta_aux = in__.template read<
                   Eigen::Matrix<local_scalar_t__,-1,-1>>(beta_aux_1dim__,
                   beta_aux_2dim__);
      Eigen::Matrix<double,-1,1> log_L_ipd =
        Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> log_L_agd_arm =
        Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> eta_ipd =
        Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> f_delta =
        Eigen::Matrix<double,-1,1>::Constant(n_delta,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> f_class =
        Eigen::Matrix<double,-1,1>::Constant(f_class_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> allbeta =
        Eigen::Matrix<double,-1,1>::Constant(nX,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> mu =
        Eigen::Matrix<double,-1,1>::Constant(totns,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> d =
        Eigen::Matrix<double,-1,1>::Constant(d_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> omega =
        Eigen::Matrix<double,-1,1>::Constant(nodesplit,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> beta =
        Eigen::Matrix<double,-1,1>::Constant(beta_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> eta_agd_contrast_ii =
        Eigen::Matrix<double,-1,1>::Constant(eta_agd_contrast_ii_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> eta_agd_contrast_bar =
        Eigen::Matrix<double,-1,1>::Constant(ni_agd_contrast,
          std::numeric_limits<double>::quiet_NaN());
      out__.write(beta_tilde);
      out__.write(u_delta);
      out__.write(tau);
      out__.write(class_mean);
      out__.write(class_sd);
      out__.write(z_class);
      out__.write(aux);
      out__.write(aux2);
      out__.write(beta_aux);
      if (stan::math::logical_negation(
            (stan::math::primitive_value(emit_transformed_parameters__) ||
            stan::math::primitive_value(emit_generated_quantities__)))) {
        return ;
      }
      current_statement__ = 13;
      stan::model::assign(f_delta,
        (RE ? stan::math::eval(
                (RE_sparse ? stan::math::eval(
                               stan::math::multiply(
                                 stan::model::rvalue(tau, "tau",
                                   stan::model::index_uni(1)),
                                 stan::math::csr_matrix_times_vector(n_delta,
                                   n_delta, RE_L_w, RE_L_v, RE_L_u, u_delta))) : 
                stan::math::eval(
                  stan::math::multiply(
                    stan::math::multiply(
                      stan::model::rvalue(tau, "tau",
                        stan::model::index_uni(1)), RE_L), u_delta)))) : 
        stan::math::eval(u_delta)), "assigning variable f_delta");
      current_statement__ = 15;
      stan::model::assign(allbeta,
        (QR ? stan::math::eval(stan::math::multiply(R_inv, beta_tilde)) : 
        stan::math::eval(beta_tilde)), "assigning variable allbeta");
      current_statement__ = 17;
      stan::model::assign(d,
        stan::model::rvalue(allbeta, "allbeta",
          stan::model::index_min_max((totns + 1), ((totns + nt) - 1))),
        "assigning variable d");
      current_statement__ = 34;
      if (totns) {
        current_statement__ = 32;
        stan::model::assign(mu,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_min_max(1, totns)), "assigning variable mu");
      }
      current_statement__ = 37;
      if ((((nX - totns) - (nt - 1)) - nodesplit)) {
        current_statement__ = 35;
        stan::model::assign(beta,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_min(((totns + nt) + nodesplit))),
          "assigning variable beta");
      }
      current_statement__ = 40;
      if (nodesplit) {
        current_statement__ = 38;
        stan::model::assign(omega,
          stan::model::rvalue(allbeta, "allbeta",
            stan::model::index_uni((totns + nt))),
          "assigning variable omega", stan::model::index_uni(1));
      }
      current_statement__ = 44;
      if (class_effects) {
        current_statement__ = 41;
        stan::model::assign(f_class,
          stan::math::add(
            stan::math::subtract(
              stan::model::rvalue(class_mean, "class_mean",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_multi(which_class_trt)))),
              stan::model::rvalue(d, "d",
                stan::model::index_multi(which_class_trt))),
            stan::math::elt_multiply(
              stan::model::rvalue(class_sd, "class_sd",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE_sd, "which_CE_sd",
                    stan::model::index_multi(which_class_trt)))), z_class)),
          "assigning variable f_class");
        current_statement__ = 42;
        stan::model::assign(d,
          stan::math::add(
            stan::model::rvalue(class_mean, "class_mean",
              stan::model::index_multi(
                stan::model::rvalue(which_CE, "which_CE",
                  stan::model::index_multi(which_class_trt)))),
            stan::math::elt_multiply(
              stan::model::rvalue(class_sd, "class_sd",
                stan::model::index_multi(
                  stan::model::rvalue(which_CE_sd, "which_CE_sd",
                    stan::model::index_multi(which_class_trt)))), z_class)),
          "assigning variable d", stan::model::index_multi(which_class_trt));
      }
      current_statement__ = 68;
      if (ni_ipd) {
        current_statement__ = 56;
        if (RE) {
          current_statement__ = 47;
          stan::math::validate_non_negative_index("eta_ipd_noRE", "ni_ipd",
            ni_ipd);
          Eigen::Matrix<double,-1,1> eta_ipd_noRE =
            Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 48;
          stan::model::assign(eta_ipd_noRE,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_ipd, beta_tilde),
                              offset_ipd)) : stan::math::eval(
                                               stan::math::multiply(X_ipd,
                                                 beta_tilde))),
            "assigning variable eta_ipd_noRE");
          current_statement__ = 53;
          for (int i = 1; i <= ni_ipd; ++i) {
            current_statement__ = 51;
            if (stan::model::rvalue(which_RE, "which_RE",
                  stan::model::index_uni(
                    stan::model::rvalue(ipd_arm, "ipd_arm",
                      stan::model::index_uni(i))))) {
              current_statement__ = 50;
              stan::model::assign(eta_ipd,
                (stan::model::rvalue(eta_ipd_noRE, "eta_ipd_noRE",
                   stan::model::index_uni(i)) +
                stan::model::rvalue(f_delta, "f_delta",
                  stan::model::index_uni(
                    stan::model::rvalue(which_RE, "which_RE",
                      stan::model::index_uni(
                        stan::model::rvalue(ipd_arm, "ipd_arm",
                          stan::model::index_uni(i))))))),
                "assigning variable eta_ipd", stan::model::index_uni(i));
            } else {
              current_statement__ = 49;
              stan::model::assign(eta_ipd,
                stan::model::rvalue(eta_ipd_noRE, "eta_ipd_noRE",
                  stan::model::index_uni(i)), "assigning variable eta_ipd",
                stan::model::index_uni(i));
            }
          }
        } else {
          current_statement__ = 45;
          stan::model::assign(eta_ipd,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_ipd, beta_tilde),
                              offset_ipd)) : stan::math::eval(
                                               stan::math::multiply(X_ipd,
                                                 beta_tilde))),
            "assigning variable eta_ipd");
        }
        current_statement__ = 59;
        if (stan::math::logical_gt(brmr_n_col, 0)) {
          current_statement__ = 57;
          stan::model::assign(eta_ipd,
            stan::math::add(stan::model::deep_copy(eta_ipd),
              stan::math::elt_multiply(
                stan::math::subtract(
                  stan::math::subtract(
                    stan::math::multiply(
                      stan::model::rvalue(X_ipd, "X_ipd",
                        stan::model::index_omni(),
                        stan::model::index_min_max(1, totns)), mu), xbar_mu),
                  1),
                stan::math::multiply(
                  stan::model::rvalue(X_ipd, "X_ipd",
                    stan::model::index_omni(),
                    stan::model::index_multi(brmr_col)),
                  stan::model::rvalue(beta_tilde, "beta_tilde",
                    stan::model::index_multi(brmr_col))))),
            "assigning variable eta_ipd");
        }
        current_statement__ = 66;
        if (class_effects) {
          current_statement__ = 64;
          for (int i = 1; i <= ni_ipd; ++i) {
            current_statement__ = 62;
            if ((stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(ipd_trt, "ipd_trt",
                       stan::model::index_uni(
                         stan::model::rvalue(ipd_arm, "ipd_arm",
                           stan::model::index_uni(i)))), 1))
                &&
                stan::math::primitive_value(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_uni(
                      (stan::model::rvalue(ipd_trt, "ipd_trt",
                         stan::model::index_uni(
                           stan::model::rvalue(ipd_arm, "ipd_arm",
                             stan::model::index_uni(i)))) - 1)))))) {
              current_statement__ = 60;
              stan::model::assign(eta_ipd,
                (stan::model::rvalue(eta_ipd, "eta_ipd",
                   stan::model::index_uni(i)) +
                stan::model::rvalue(f_class, "f_class",
                  stan::model::index_uni(
                    stan::model::rvalue(which_fclass, "which_fclass",
                      stan::model::index_uni(
                        (stan::model::rvalue(ipd_trt, "ipd_trt",
                           stan::model::index_uni(
                             stan::model::rvalue(ipd_arm, "ipd_arm",
                               stan::model::index_uni(i)))) - 1)))))),
                "assigning variable eta_ipd", stan::model::index_uni(i));
            }
          }
        }
      }
      current_statement__ = 123;
      if (ni_agd_contrast) {
        current_statement__ = 121;
        if (stan::math::logical_gt(nint_max, 1)) {
          current_statement__ = 91;
          stan::math::validate_non_negative_index("eta_agd_contrast_noRE",
            "nint_max * ni_agd_contrast", (nint_max * ni_agd_contrast));
          Eigen::Matrix<double,-1,1> eta_agd_contrast_noRE =
            Eigen::Matrix<double,-1,1>::Constant((nint_max *
              ni_agd_contrast), std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 92;
          stan::model::assign(eta_agd_contrast_noRE,
            (has_offset ? stan::math::eval(
                            stan::math::add(
                              stan::math::multiply(X_agd_contrast, beta_tilde),
                              offset_agd_contrast)) : stan::math::eval(
                                                        stan::math::multiply(
                                                          X_agd_contrast,
                                                          beta_tilde))),
            "assigning variable eta_agd_contrast_noRE");
          current_statement__ = 102;
          if (class_effects) {
            current_statement__ = 100;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 95;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt,
                         "agd_contrast_trt", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt,
                           "agd_contrast_trt", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 93;
                stan::model::assign(eta_agd_contrast_noRE,
                  stan::math::add(
                    stan::model::deep_copy(
                      stan::model::rvalue(eta_agd_contrast_noRE,
                        "eta_agd_contrast_noRE",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)))),
                    stan::model::rvalue(f_class, "f_class",
                      stan::model::index_uni(
                        stan::model::rvalue(which_fclass, "which_fclass",
                          stan::model::index_uni(
                            (stan::model::rvalue(agd_contrast_trt,
                               "agd_contrast_trt", stan::model::index_uni(i))
                            - 1)))))),
                  "assigning variable eta_agd_contrast_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint)));
              }
              current_statement__ = 98;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt_b,
                         "agd_contrast_trt_b", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt_b,
                           "agd_contrast_trt_b", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 96;
                stan::model::assign(eta_agd_contrast_noRE,
                  stan::math::subtract(
                    stan::model::deep_copy(
                      stan::model::rvalue(eta_agd_contrast_noRE,
                        "eta_agd_contrast_noRE",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)))),
                    stan::model::rvalue(f_class, "f_class",
                      stan::model::index_uni(
                        stan::model::rvalue(which_fclass, "which_fclass",
                          stan::model::index_uni(
                            (stan::model::rvalue(agd_contrast_trt_b,
                               "agd_contrast_trt_b",
                               stan::model::index_uni(i)) - 1)))))),
                  "assigning variable eta_agd_contrast_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint)));
              }
            }
          }
          current_statement__ = 119;
          if (RE) {
            current_statement__ = 117;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 114;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i)))) {
                current_statement__ = 113;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::math::add(
                    stan::model::rvalue(eta_agd_contrast_noRE,
                      "eta_agd_contrast_noRE",
                      stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                        (((i - 1) * nint_max) + nint))),
                    stan::model::rvalue(f_delta, "f_delta",
                      stan::model::index_uni(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(((narm_ipd + narm_agd_arm) +
                            i)))))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              } else {
                current_statement__ = 112;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE",
                    stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                      (((i - 1) * nint_max) + nint))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              }
              current_statement__ = 115;
              stan::model::assign(eta_agd_contrast_bar,
                stan::math::mean(
                  stan::model::rvalue(eta_agd_contrast_ii,
                    "eta_agd_contrast_ii",
                    stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                      nint)))), "assigning variable eta_agd_contrast_bar",
                stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 107;
            if (stan::math::logical_eq(nint, nint_max)) {
              current_statement__ = 106;
              stan::model::assign(eta_agd_contrast_ii, eta_agd_contrast_noRE,
                "assigning variable eta_agd_contrast_ii");
            } else {
              current_statement__ = 105;
              for (int i = 1; i <= ni_agd_contrast; ++i) {
                current_statement__ = 103;
                stan::model::assign(eta_agd_contrast_ii,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE",
                    stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                      (((i - 1) * nint_max) + nint))),
                  "assigning variable eta_agd_contrast_ii",
                  stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                    nint)));
              }
            }
            current_statement__ = 110;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 108;
              stan::model::assign(eta_agd_contrast_bar,
                stan::math::mean(
                  stan::model::rvalue(eta_agd_contrast_ii,
                    "eta_agd_contrast_ii",
                    stan::model::index_min_max((1 + ((i - 1) * nint)), (i *
                      nint)))), "assigning variable eta_agd_contrast_bar",
                stan::model::index_uni(i));
            }
          }
        } else {
          current_statement__ = 79;
          if (RE) {
            current_statement__ = 71;
            stan::math::validate_non_negative_index("eta_agd_contrast_noRE",
              "nint * ni_agd_contrast", (nint * ni_agd_contrast));
            Eigen::Matrix<double,-1,1> eta_agd_contrast_noRE =
              Eigen::Matrix<double,-1,1>::Constant((nint * ni_agd_contrast),
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 72;
            stan::model::assign(eta_agd_contrast_noRE,
              (has_offset ? stan::math::eval(
                              stan::math::add(
                                stan::math::multiply(X_agd_contrast,
                                  beta_tilde), offset_agd_contrast)) : 
              stan::math::eval(
                stan::math::multiply(X_agd_contrast, beta_tilde))),
              "assigning variable eta_agd_contrast_noRE");
            current_statement__ = 77;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 75;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i)))) {
                current_statement__ = 74;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_noRE,
                     "eta_agd_contrast_noRE", stan::model::index_uni(i)) +
                  stan::model::rvalue(f_delta, "f_delta",
                    stan::model::index_uni(
                      stan::model::rvalue(which_RE, "which_RE",
                        stan::model::index_uni(((narm_ipd + narm_agd_arm) +
                          i)))))), "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              } else {
                current_statement__ = 73;
                stan::model::assign(eta_agd_contrast_bar,
                  stan::model::rvalue(eta_agd_contrast_noRE,
                    "eta_agd_contrast_noRE", stan::model::index_uni(i)),
                  "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
            }
          } else {
            current_statement__ = 69;
            stan::model::assign(eta_agd_contrast_bar,
              (has_offset ? stan::math::eval(
                              stan::math::add(
                                stan::math::multiply(X_agd_contrast,
                                  beta_tilde), offset_agd_contrast)) : 
              stan::math::eval(
                stan::math::multiply(X_agd_contrast, beta_tilde))),
              "assigning variable eta_agd_contrast_bar");
          }
          current_statement__ = 89;
          if (class_effects) {
            current_statement__ = 87;
            for (int i = 1; i <= ni_agd_contrast; ++i) {
              current_statement__ = 82;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt,
                         "agd_contrast_trt", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt,
                           "agd_contrast_trt", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 80;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_bar,
                     "eta_agd_contrast_bar", stan::model::index_uni(i)) +
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_contrast_trt,
                             "agd_contrast_trt", stan::model::index_uni(i)) -
                          1)))))), "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
              current_statement__ = 85;
              if ((stan::math::primitive_value(
                     stan::math::logical_gt(
                       stan::model::rvalue(agd_contrast_trt_b,
                         "agd_contrast_trt_b", stan::model::index_uni(i)), 1))
                  &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_CE, "which_CE",
                      stan::model::index_uni(
                        (stan::model::rvalue(agd_contrast_trt_b,
                           "agd_contrast_trt_b", stan::model::index_uni(i)) -
                        1)))))) {
                current_statement__ = 83;
                stan::model::assign(eta_agd_contrast_bar,
                  (stan::model::rvalue(eta_agd_contrast_bar,
                     "eta_agd_contrast_bar", stan::model::index_uni(i)) -
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_contrast_trt_b,
                             "agd_contrast_trt_b", stan::model::index_uni(i))
                          - 1)))))),
                  "assigning variable eta_agd_contrast_bar",
                  stan::model::index_uni(i));
              }
            }
          }
        }
      }
      current_statement__ = 167;
      if (ni_ipd) {
        current_statement__ = 165;
        if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
            || stan::math::primitive_value(aux_int))) {
          current_statement__ = 150;
          stan::math::validate_non_negative_index("auxi", "ni_ipd", ni_ipd);
          Eigen::Matrix<double,-1,1> auxi =
            Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 152;
          stan::math::validate_non_negative_index("aux2i", "ni_ipd", ni_ipd);
          Eigen::Matrix<double,-1,1> aux2i =
            Eigen::Matrix<double,-1,1>::Constant(ni_ipd,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 154;
          stan::math::validate_non_negative_index("eXbeta",
            "nonexp ? ni_ipd : 0", (nonexp ? ni_ipd : 0));
          current_statement__ = 155;
          stan::math::validate_non_negative_index("eXbeta",
            "nonexp + gengamma", (nonexp + gengamma));
          Eigen::Matrix<double,-1,-1> eXbeta =
            Eigen::Matrix<double,-1,-1>::Constant((nonexp ? ni_ipd : 0),
              (nonexp + gengamma), std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 158;
          if (nonexp) {
            current_statement__ = 157;
            stan::model::assign(eXbeta,
              stan::math::exp(stan::math::multiply(X_aux_ipd, beta_aux)),
              "assigning variable eXbeta");
          }
          current_statement__ = 160;
          if (nonexp) {
            current_statement__ = 159;
            stan::model::assign(auxi,
              stan::math::elt_multiply(
                stan::model::rvalue(aux, "aux",
                  stan::model::index_multi(aux_id_ipd)),
                stan::model::rvalue(eXbeta, "eXbeta",
                  stan::model::index_omni(), stan::model::index_uni(1))),
              "assigning variable auxi");
          }
          current_statement__ = 162;
          if (gengamma) {
            current_statement__ = 161;
            stan::model::assign(aux2i,
              stan::math::elt_multiply(
                stan::model::rvalue(aux2, "aux2",
                  stan::model::index_multi(aux_id_ipd)),
                stan::model::rvalue(eXbeta, "eXbeta",
                  stan::model::index_omni(), stan::model::index_uni(2))),
              "assigning variable aux2i");
          }
          current_statement__ = 163;
          stan::model::assign(log_L_ipd,
            loglik(dist, ipd_time, ipd_start_time, ipd_delay_time,
              ipd_status, eta_ipd, auxi, aux2i, pstream__),
            "assigning variable log_L_ipd");
        } else {
          current_statement__ = 148;
          for (int i = 1; i <= n_aux_group; ++i) {
            int ni = std::numeric_limits<int>::min();
            current_statement__ = 124;
            ni = stan::model::rvalue(ni_aux_group_ipd, "ni_aux_group_ipd",
                   stan::model::index_uni(i));
            current_statement__ = 146;
            if (ni) {
              current_statement__ = 125;
              stan::math::validate_non_negative_index("wi", "ni", ni);
              std::vector<int> wi =
                std::vector<int>(ni, std::numeric_limits<int>::min());
              current_statement__ = 126;
              stan::model::assign(wi,
                stan::model::rvalue(wi_aux_group_ipd, "wi_aux_group_ipd",
                  stan::model::index_uni(i),
                  stan::model::index_min_max(1, ni)), "assigning variable wi");
              double auxi = std::numeric_limits<double>::quiet_NaN();
              double aux2i = std::numeric_limits<double>::quiet_NaN();
              current_statement__ = 129;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp + gengamma", (nonexp + gengamma));
              Eigen::Matrix<double,1,-1> eXbeta =
                Eigen::Matrix<double,1,-1>::Constant((nonexp + gengamma),
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 132;
              if (nonexp) {
                current_statement__ = 131;
                stan::model::assign(eXbeta,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X_aux_ipd, "X_aux_ipd",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(1))),
                        stan::model::index_omni()), beta_aux)),
                  "assigning variable eXbeta");
              }
              current_statement__ = 143;
              if (nX_aux) {
                current_statement__ = 139;
                if (nonexp) {
                  current_statement__ = 138;
                  auxi = (stan::model::rvalue(aux, "aux",
                            stan::model::index_uni(
                              stan::model::rvalue(aux_id_ipd, "aux_id_ipd",
                                stan::model::index_uni(
                                  stan::model::rvalue(wi, "wi",
                                    stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(1)));
                }
                current_statement__ = 141;
                if (gengamma) {
                  current_statement__ = 140;
                  aux2i = (stan::model::rvalue(aux2, "aux2",
                             stan::model::index_uni(
                               stan::model::rvalue(aux_id_ipd, "aux_id_ipd",
                                 stan::model::index_uni(
                                   stan::model::rvalue(wi, "wi",
                                     stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(2)));
                }
              } else {
                current_statement__ = 134;
                if (nonexp) {
                  current_statement__ = 133;
                  auxi = stan::model::rvalue(aux, "aux",
                           stan::model::index_uni(i));
                }
                current_statement__ = 136;
                if (gengamma) {
                  current_statement__ = 135;
                  aux2i = stan::model::rvalue(aux2, "aux2",
                            stan::model::index_uni(i));
                }
              }
              current_statement__ = 144;
              stan::model::assign(log_L_ipd,
                loglik2(dist,
                  stan::model::rvalue(ipd_time, "ipd_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_start_time, "ipd_start_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_delay_time, "ipd_delay_time",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(ipd_status, "ipd_status",
                    stan::model::index_multi(wi)),
                  stan::model::rvalue(eta_ipd, "eta_ipd",
                    stan::model::index_multi(wi)), auxi, aux2i, pstream__),
                "assigning variable log_L_ipd", stan::model::index_multi(wi));
            }
          }
        }
      }
      current_statement__ = 290;
      if (ni_agd_arm) {
        current_statement__ = 168;
        stan::math::validate_non_negative_index("eta_agd_arm_noRE",
          "nint_max * ni_agd_arm", (nint_max * ni_agd_arm));
        Eigen::Matrix<double,-1,1> eta_agd_arm_noRE =
          Eigen::Matrix<double,-1,1>::Constant((nint_max * ni_agd_arm),
            std::numeric_limits<double>::quiet_NaN());
        current_statement__ = 169;
        stan::model::assign(eta_agd_arm_noRE,
          (has_offset ? stan::math::eval(
                          stan::math::add(
                            stan::math::multiply(X_agd_arm, beta_tilde),
                            offset_agd_arm)) : stan::math::eval(
                                                 stan::math::multiply(
                                                   X_agd_arm, beta_tilde))),
          "assigning variable eta_agd_arm_noRE");
        current_statement__ = 172;
        if (stan::math::logical_gt(brmr_n_col, 0)) {
          current_statement__ = 170;
          stan::model::assign(eta_agd_arm_noRE,
            stan::math::add(stan::model::deep_copy(eta_agd_arm_noRE),
              stan::math::elt_multiply(
                stan::math::subtract(
                  stan::math::subtract(
                    stan::math::multiply(
                      stan::model::rvalue(X_agd_arm, "X_agd_arm",
                        stan::model::index_omni(),
                        stan::model::index_min_max(1, totns)), mu), xbar_mu),
                  1),
                stan::math::multiply(
                  stan::model::rvalue(X_agd_arm, "X_agd_arm",
                    stan::model::index_omni(),
                    stan::model::index_multi(brmr_col)),
                  stan::model::rvalue(beta_tilde, "beta_tilde",
                    stan::model::index_multi(brmr_col))))),
            "assigning variable eta_agd_arm_noRE");
        }
        current_statement__ = 179;
        if (class_effects) {
          current_statement__ = 177;
          for (int i = 1; i <= ni_agd_arm; ++i) {
            current_statement__ = 175;
            if ((stan::math::primitive_value(
                   stan::math::logical_gt(
                     stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                       stan::model::index_uni(i)), 1))
                &&
                stan::math::primitive_value(
                  stan::model::rvalue(which_CE, "which_CE",
                    stan::model::index_uni(
                      (stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                         stan::model::index_uni(i)) - 1)))))) {
              current_statement__ = 173;
              stan::model::assign(eta_agd_arm_noRE,
                stan::math::add(
                  stan::model::deep_copy(
                    stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                      stan::model::index_min_max((1 + ((i - 1) * nint_max)),
                        (((i - 1) * nint_max) + nint)))),
                  stan::model::rvalue(f_class, "f_class",
                    stan::model::index_uni(
                      stan::model::rvalue(which_fclass, "which_fclass",
                        stan::model::index_uni(
                          (stan::model::rvalue(agd_arm_trt, "agd_arm_trt",
                             stan::model::index_uni(i)) - 1)))))),
                "assigning variable eta_agd_arm_noRE",
                stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i -
                  1) * nint_max) + nint)));
            }
          }
        }
        current_statement__ = 288;
        if (stan::math::logical_gt(nint_max, 1)) {
          current_statement__ = 286;
          if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
              || stan::math::primitive_value(aux_int))) {
            current_statement__ = 284;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 261;
              stan::math::validate_non_negative_index("eta_agd_arm_ii",
                "nint", nint);
              Eigen::Matrix<double,-1,1> eta_agd_arm_ii =
                Eigen::Matrix<double,-1,1>::Constant(nint,
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 263;
              stan::math::validate_non_negative_index("log_L_ii", "nint",
                nint);
              Eigen::Matrix<double,-1,1> log_L_ii =
                Eigen::Matrix<double,-1,1>::Constant(nint,
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 265;
              stan::math::validate_non_negative_index("auxi", "nint", nint);
              Eigen::Matrix<double,-1,1> auxi =
                Eigen::Matrix<double,-1,1>::Constant(nint,
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 267;
              stan::math::validate_non_negative_index("aux2i", "nint", nint);
              Eigen::Matrix<double,-1,1> aux2i =
                Eigen::Matrix<double,-1,1>::Constant(nint,
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 269;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp ? nint : 0", (nonexp ? nint : 0));
              current_statement__ = 270;
              stan::math::validate_non_negative_index("eXbeta",
                "nonexp + gengamma", (nonexp + gengamma));
              Eigen::Matrix<double,-1,-1> eXbeta =
                Eigen::Matrix<double,-1,-1>::Constant((nonexp ? nint : 0),
                  (nonexp + gengamma),
                  std::numeric_limits<double>::quiet_NaN());
              current_statement__ = 273;
              if (nonexp) {
                current_statement__ = 272;
                stan::model::assign(eXbeta,
                  stan::math::exp(
                    stan::math::multiply(
                      stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                        stan::model::index_min_max((1 + ((i - 1) *
                          nint_max)), (((i - 1) * nint_max) + nint)),
                        stan::model::index_omni()), beta_aux)),
                  "assigning variable eXbeta");
              }
              current_statement__ = 275;
              if (nonexp) {
                current_statement__ = 274;
                stan::model::assign(auxi,
                  stan::math::elt_multiply(
                    stan::model::rvalue(aux, "aux",
                      stan::model::index_multi(
                        stan::model::rvalue(aux_id_agd_arm, "aux_id_agd_arm",
                          stan::model::index_min_max((1 + ((i - 1) *
                            nint_max)), (((i - 1) * nint_max) + nint))))),
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_omni(), stan::model::index_uni(1))),
                  "assigning variable auxi");
              }
              current_statement__ = 277;
              if (gengamma) {
                current_statement__ = 276;
                stan::model::assign(aux2i,
                  stan::math::elt_multiply(
                    stan::model::rvalue(aux2, "aux2",
                      stan::model::index_multi(
                        stan::model::rvalue(aux_id_agd_arm, "aux_id_agd_arm",
                          stan::model::index_min_max((1 + ((i - 1) *
                            nint_max)), (((i - 1) * nint_max) + nint))))),
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_omni(), stan::model::index_uni(2))),
                  "assigning variable aux2i");
              }
              current_statement__ = 278;
              stan::model::assign(eta_agd_arm_ii,
                stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                  stan::model::index_min_max((1 + ((i - 1) * nint_max)), (((i
                    - 1) * nint_max) + nint))),
                "assigning variable eta_agd_arm_ii");
              current_statement__ = 280;
              if ((stan::math::primitive_value(RE) &&
                  stan::math::primitive_value(
                    stan::model::rvalue(which_RE, "which_RE",
                      stan::model::index_uni(
                        stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                          stan::model::index_uni(i))))))) {
                current_statement__ = 279;
                stan::model::assign(eta_agd_arm_ii,
                  stan::math::add(stan::model::deep_copy(eta_agd_arm_ii),
                    stan::model::rvalue(f_delta, "f_delta",
                      stan::model::index_uni(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(
                            stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                              stan::model::index_uni(i))))))),
                  "assigning variable eta_agd_arm_ii");
              }
              current_statement__ = 281;
              stan::model::assign(log_L_ii,
                loglik_a2(dist,
                  stan::model::rvalue(agd_arm_time, "agd_arm_time",
                    stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_start_time,
                    "agd_arm_start_time", stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_delay_time,
                    "agd_arm_delay_time", stan::model::index_uni(i)),
                  stan::model::rvalue(agd_arm_status, "agd_arm_status",
                    stan::model::index_uni(i)), eta_agd_arm_ii, auxi, aux2i,
                  pstream__), "assigning variable log_L_ii");
              current_statement__ = 282;
              stan::model::assign(log_L_agd_arm,
                (stan::math::log_sum_exp(log_L_ii) - stan::math::log(nint)),
                "assigning variable log_L_agd_arm", stan::model::index_uni(i));
            }
          } else {
            current_statement__ = 259;
            for (int i = 1; i <= n_aux_group; ++i) {
              int ni = std::numeric_limits<int>::min();
              current_statement__ = 229;
              ni = stan::model::rvalue(ni_aux_group_agd_arm,
                     "ni_aux_group_agd_arm", stan::model::index_uni(i));
              current_statement__ = 257;
              if (ni) {
                current_statement__ = 230;
                stan::math::validate_non_negative_index("wi", "ni", ni);
                std::vector<int> wi =
                  std::vector<int>(ni, std::numeric_limits<int>::min());
                current_statement__ = 231;
                stan::model::assign(wi,
                  stan::model::rvalue(wi_aux_group_agd_arm,
                    "wi_aux_group_agd_arm", stan::model::index_uni(i),
                    stan::model::index_min_max(1, ni)),
                  "assigning variable wi");
                double auxi = std::numeric_limits<double>::quiet_NaN();
                double aux2i = std::numeric_limits<double>::quiet_NaN();
                current_statement__ = 234;
                stan::math::validate_non_negative_index("eXbeta",
                  "nonexp + gengamma", (nonexp + gengamma));
                Eigen::Matrix<double,1,-1> eXbeta =
                  Eigen::Matrix<double,1,-1>::Constant((nonexp + gengamma),
                    std::numeric_limits<double>::quiet_NaN());
                current_statement__ = 237;
                if (nonexp) {
                  current_statement__ = 236;
                  stan::model::assign(eXbeta,
                    stan::math::exp(
                      stan::math::multiply(
                        stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                          stan::model::index_uni(
                            stan::model::rvalue(wi, "wi",
                              stan::model::index_uni(1))),
                          stan::model::index_omni()), beta_aux)),
                    "assigning variable eXbeta");
                }
                current_statement__ = 244;
                if (nX_aux) {
                  current_statement__ = 241;
                  auxi = (nonexp ? (stan::model::rvalue(aux, "aux",
                                      stan::model::index_uni(
                                        stan::model::rvalue(aux_id_agd_arm,
                                          "aux_id_agd_arm",
                                          stan::model::index_uni(
                                            stan::model::rvalue(wi, "wi",
                                              stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(1))) : 0);
                  current_statement__ = 242;
                  aux2i = (gengamma ? (stan::model::rvalue(aux2, "aux2",
                                         stan::model::index_uni(
                                           stan::model::rvalue(
                                             aux_id_agd_arm,
                                             "aux_id_agd_arm",
                                             stan::model::index_uni(
                                               stan::model::rvalue(wi, "wi",
                                                 stan::model::index_uni(1))))))
                    *
                    stan::model::rvalue(eXbeta, "eXbeta",
                      stan::model::index_uni(2))) : 0);
                } else {
                  current_statement__ = 238;
                  auxi = (nonexp ? stan::model::rvalue(aux, "aux",
                                     stan::model::index_uni(i)) : 0);
                  current_statement__ = 239;
                  aux2i = (gengamma ? stan::model::rvalue(aux2, "aux2",
                                        stan::model::index_uni(i)) : 0);
                }
                current_statement__ = 255;
                for (int j = 1; j <= ni; ++j) {
                  current_statement__ = 245;
                  stan::math::validate_non_negative_index("eta_agd_arm_ii",
                    "nint", nint);
                  Eigen::Matrix<double,-1,1> eta_agd_arm_ii =
                    Eigen::Matrix<double,-1,1>::Constant(nint,
                      std::numeric_limits<double>::quiet_NaN());
                  current_statement__ = 247;
                  stan::math::validate_non_negative_index("log_L_ii", "nint",
                    nint);
                  Eigen::Matrix<double,-1,1> log_L_ii =
                    Eigen::Matrix<double,-1,1>::Constant(nint,
                      std::numeric_limits<double>::quiet_NaN());
                  current_statement__ = 249;
                  stan::model::assign(eta_agd_arm_ii,
                    stan::model::rvalue(eta_agd_arm_noRE, "eta_agd_arm_noRE",
                      stan::model::index_min_max((1 +
                        ((stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)) - 1) * nint_max)),
                        (((stan::model::rvalue(wi, "wi",
                             stan::model::index_uni(j)) - 1) * nint_max) +
                        nint))), "assigning variable eta_agd_arm_ii");
                  current_statement__ = 251;
                  if ((stan::math::primitive_value(RE) &&
                      stan::math::primitive_value(
                        stan::model::rvalue(which_RE, "which_RE",
                          stan::model::index_uni(
                            stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                              stan::model::index_uni(
                                stan::model::rvalue(wi, "wi",
                                  stan::model::index_uni(j))))))))) {
                    current_statement__ = 250;
                    stan::model::assign(eta_agd_arm_ii,
                      stan::math::add(stan::model::deep_copy(eta_agd_arm_ii),
                        stan::model::rvalue(f_delta, "f_delta",
                          stan::model::index_uni(
                            stan::model::rvalue(which_RE, "which_RE",
                              stan::model::index_uni(
                                stan::model::rvalue(agd_arm_arm2,
                                  "agd_arm_arm2",
                                  stan::model::index_uni(
                                    stan::model::rvalue(wi, "wi",
                                      stan::model::index_uni(j))))))))),
                      "assigning variable eta_agd_arm_ii");
                  }
                  current_statement__ = 252;
                  stan::model::assign(log_L_ii,
                    loglik_a(dist,
                      stan::model::rvalue(agd_arm_time, "agd_arm_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_start_time,
                        "agd_arm_start_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_delay_time,
                        "agd_arm_delay_time",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))),
                      stan::model::rvalue(agd_arm_status, "agd_arm_status",
                        stan::model::index_uni(
                          stan::model::rvalue(wi, "wi",
                            stan::model::index_uni(j)))), eta_agd_arm_ii,
                      auxi, aux2i, pstream__), "assigning variable log_L_ii");
                  current_statement__ = 253;
                  stan::model::assign(log_L_agd_arm,
                    (stan::math::log_sum_exp(log_L_ii) -
                    stan::math::log(nint)),
                    "assigning variable log_L_agd_arm",
                    stan::model::index_uni(
                      stan::model::rvalue(wi, "wi", stan::model::index_uni(j))));
                }
              }
            }
          }
        } else {
          current_statement__ = 180;
          stan::math::validate_non_negative_index("eta_agd_arm",
            "ni_agd_arm", ni_agd_arm);
          Eigen::Matrix<double,-1,1> eta_agd_arm =
            Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
              std::numeric_limits<double>::quiet_NaN());
          current_statement__ = 181;
          stan::model::assign(eta_agd_arm, eta_agd_arm_noRE,
            "assigning variable eta_agd_arm");
          current_statement__ = 185;
          if (RE) {
            current_statement__ = 184;
            for (int i = 1; i <= ni_agd_arm; ++i) {
              current_statement__ = 183;
              if (stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(
                      stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                        stan::model::index_uni(i))))) {
                current_statement__ = 182;
                stan::model::assign(eta_agd_arm,
                  (stan::model::rvalue(eta_agd_arm, "eta_agd_arm",
                     stan::model::index_uni(i)) +
                  stan::model::rvalue(f_delta, "f_delta",
                    stan::model::index_uni(
                      stan::model::rvalue(which_RE, "which_RE",
                        stan::model::index_uni(
                          stan::model::rvalue(agd_arm_arm2, "agd_arm_arm2",
                            stan::model::index_uni(i))))))),
                  "assigning variable eta_agd_arm", stan::model::index_uni(i));
              }
            }
          }
          current_statement__ = 227;
          if ((stan::math::primitive_value(stan::math::logical_eq(nonexp, 0))
              || stan::math::primitive_value(aux_int))) {
            current_statement__ = 212;
            stan::math::validate_non_negative_index("auxi", "ni_agd_arm",
              ni_agd_arm);
            Eigen::Matrix<double,-1,1> auxi =
              Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 214;
            stan::math::validate_non_negative_index("aux2i", "ni_agd_arm",
              ni_agd_arm);
            Eigen::Matrix<double,-1,1> aux2i =
              Eigen::Matrix<double,-1,1>::Constant(ni_agd_arm,
                std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 216;
            stan::math::validate_non_negative_index("eXbeta", "ni_agd_arm",
              ni_agd_arm);
            current_statement__ = 217;
            stan::math::validate_non_negative_index("eXbeta",
              "nonexp + gengamma", (nonexp + gengamma));
            Eigen::Matrix<double,-1,-1> eXbeta =
              Eigen::Matrix<double,-1,-1>::Constant(ni_agd_arm, (nonexp +
                gengamma), std::numeric_limits<double>::quiet_NaN());
            current_statement__ = 220;
            if (nonexp) {
              current_statement__ = 219;
              stan::model::assign(eXbeta,
                stan::math::exp(stan::math::multiply(X_aux_agd_arm, beta_aux)),
                "assigning variable eXbeta");
            }
            current_statement__ = 222;
            if (nonexp) {
              current_statement__ = 221;
              stan::model::assign(auxi,
                stan::math::elt_multiply(
                  stan::model::rvalue(aux, "aux",
                    stan::model::index_multi(aux_id_agd_arm)),
                  stan::model::rvalue(eXbeta, "eXbeta",
                    stan::model::index_omni(), stan::model::index_uni(1))),
                "assigning variable auxi");
            }
            current_statement__ = 224;
            if (gengamma) {
              current_statement__ = 223;
              stan::model::assign(aux2i,
                stan::math::elt_multiply(
                  stan::model::rvalue(aux2, "aux2",
                    stan::model::index_multi(aux_id_agd_arm)),
                  stan::model::rvalue(eXbeta, "eXbeta",
                    stan::model::index_omni(), stan::model::index_uni(2))),
                "assigning variable aux2i");
            }
            current_statement__ = 225;
            stan::model::assign(log_L_agd_arm,
              loglik(dist, agd_arm_time, agd_arm_start_time,
                agd_arm_delay_time, agd_arm_status, eta_agd_arm, auxi, aux2i,
                pstream__), "assigning variable log_L_agd_arm");
          } else {
            current_statement__ = 210;
            for (int i = 1; i <= n_aux_group; ++i) {
              int ni = std::numeric_limits<int>::min();
              current_statement__ = 186;
              ni = stan::model::rvalue(ni_aux_group_agd_arm,
                     "ni_aux_group_agd_arm", stan::model::index_uni(i));
              current_statement__ = 208;
              if (ni) {
                current_statement__ = 187;
                stan::math::validate_non_negative_index("wi", "ni", ni);
                std::vector<int> wi =
                  std::vector<int>(ni, std::numeric_limits<int>::min());
                current_statement__ = 188;
                stan::model::assign(wi,
                  stan::model::rvalue(wi_aux_group_agd_arm,
                    "wi_aux_group_agd_arm", stan::model::index_uni(i),
                    stan::model::index_min_max(1, ni)),
                  "assigning variable wi");
                double auxi = std::numeric_limits<double>::quiet_NaN();
                double aux2i = std::numeric_limits<double>::quiet_NaN();
                current_statement__ = 191;
                stan::math::validate_non_negative_index("eXbeta",
                  "nonexp + gengamma", (nonexp + gengamma));
                Eigen::Matrix<double,1,-1> eXbeta =
                  Eigen::Matrix<double,1,-1>::Constant((nonexp + gengamma),
                    std::numeric_limits<double>::quiet_NaN());
                current_statement__ = 194;
                if (nonexp) {
                  current_statement__ = 193;
                  stan::model::assign(eXbeta,
                    stan::math::exp(
                      stan::math::multiply(
                        stan::model::rvalue(X_aux_agd_arm, "X_aux_agd_arm",
                          stan::model::index_uni(
                            stan::model::rvalue(wi, "wi",
                              stan::model::index_uni(1))),
                          stan::model::index_omni()), beta_aux)),
                    "assigning variable eXbeta");
                }
                current_statement__ = 205;
                if (nX_aux) {
                  current_statement__ = 201;
                  if (nonexp) {
                    current_statement__ = 200;
                    auxi = (stan::model::rvalue(aux, "aux",
                              stan::model::index_uni(
                                stan::model::rvalue(aux_id_agd_arm,
                                  "aux_id_agd_arm",
                                  stan::model::index_uni(
                                    stan::model::rvalue(wi, "wi",
                                      stan::model::index_uni(1))))))
                      *
                      stan::model::rvalue(eXbeta, "eXbeta",
                        stan::model::index_uni(1)));
                  }
                  current_statement__ = 203;
                  if (gengamma) {
                    current_statement__ = 202;
                    aux2i = (stan::model::rvalue(aux2, "aux2",
                               stan::model::index_uni(
                                 stan::model::rvalue(aux_id_agd_arm,
                                   "aux_id_agd_arm",
                                   stan::model::index_uni(
                                     stan::model::rvalue(wi, "wi",
                                       stan::model::index_uni(1))))))
                      *
                      stan::model::rvalue(eXbeta, "eXbeta",
                        stan::model::index_uni(2)));
                  }
                } else {
                  current_statement__ = 196;
                  if (nonexp) {
                    current_statement__ = 195;
                    auxi = stan::model::rvalue(aux, "aux",
                             stan::model::index_uni(i));
                  }
                  current_statement__ = 198;
                  if (gengamma) {
                    current_statement__ = 197;
                    aux2i = stan::model::rvalue(aux2, "aux2",
                              stan::model::index_uni(i));
                  }
                }
                current_statement__ = 206;
                stan::model::assign(log_L_agd_arm,
                  loglik2(dist,
                    stan::model::rvalue(agd_arm_time, "agd_arm_time",
                      stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_start_time,
                      "agd_arm_start_time", stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_delay_time,
                      "agd_arm_delay_time", stan::model::index_multi(wi)),
                    stan::model::rvalue(agd_arm_status, "agd_arm_status",
                      stan::model::index_multi(wi)),
                    stan::model::rvalue(eta_agd_arm, "eta_agd_arm",
                      stan::model::index_multi(wi)), auxi, aux2i, pstream__),
                  "assigning variable log_L_agd_arm",
                  stan::model::index_multi(wi));
              }
            }
          }
        }
      }
      if (emit_transformed_parameters__) {
        out__.write(log_L_ipd);
        out__.write(log_L_agd_arm);
        out__.write(eta_ipd);
        out__.write(f_delta);
        out__.write(f_class);
        out__.write(allbeta);
        out__.write(mu);
        out__.write(d);
        out__.write(omega);
        out__.write(beta);
        out__.write(eta_agd_contrast_ii);
        out__.write(eta_agd_contrast_bar);
      }
      if (stan::math::logical_negation(emit_generated_quantities__)) {
        return ;
      }
      Eigen::Matrix<double,-1,1> shape =
        Eigen::Matrix<double,-1,1>::Constant(shape_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> sdlog =
        Eigen::Matrix<double,-1,1>::Constant(sdlog_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> sigma =
        Eigen::Matrix<double,-1,1>::Constant(sigma_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> k =
        Eigen::Matrix<double,-1,1>::Constant(k_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,-1> d_aux =
        Eigen::Matrix<double,-1,-1>::Constant(d_aux_1dim__, d_aux_2dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> log_lik =
        Eigen::Matrix<double,-1,1>::Constant(log_lik_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> resdev =
        Eigen::Matrix<double,-1,1>::Constant(resdev_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> fitted_agd_contrast =
        Eigen::Matrix<double,-1,1>::Constant(ni_agd_contrast,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> theta_bar_cum_agd_contrast =
        Eigen::Matrix<double,-1,1>::Constant(theta_bar_cum_agd_contrast_1dim__,
          std::numeric_limits<double>::quiet_NaN());
      Eigen::Matrix<double,-1,1> delta =
        Eigen::Matrix<double,-1,1>::Constant(n_delta,
          std::numeric_limits<double>::quiet_NaN());
      current_statement__ = 307;
      if (RE) {
        int s = std::numeric_limits<int>::min();
        current_statement__ = 291;
        s = 1;
        current_statement__ = 297;
        for (int i = 1; i <= (narm_ipd + narm_agd_arm); ++i) {
          current_statement__ = 295;
          if (stan::model::rvalue(which_RE, "which_RE",
                stan::model::index_uni(i))) {
            current_statement__ = 292;
            stan::model::assign(delta,
              ((stan::math::logical_gt(
                  stan::model::rvalue(trt, "trt", stan::model::index_uni(i)),
                  1) ? stan::model::rvalue(d, "d",
                         stan::model::index_uni(
                           (stan::model::rvalue(trt, "trt",
                              stan::model::index_uni(i)) - 1))) : 0) +
              (stan::model::rvalue(which_RE, "which_RE",
                 stan::model::index_uni(i)) ? stan::model::rvalue(f_delta,
                                                "f_delta",
                                                stan::model::index_uni(
                                                  stan::model::rvalue(
                                                    which_RE, "which_RE",
                                                    stan::model::index_uni(i)))) : 0)),
              "assigning variable delta", stan::model::index_uni(s));
            current_statement__ = 293;
            s = (s + 1);
          }
        }
        current_statement__ = 305;
        for (int i = 1; i <= ni_agd_contrast; ++i) {
          current_statement__ = 303;
          if (stan::model::rvalue(which_RE, "which_RE",
                stan::model::index_uni(((narm_ipd + narm_agd_arm) + i)))) {
            current_statement__ = 298;
            stan::model::assign(delta,
              ((stan::math::logical_gt(
                  stan::model::rvalue(trt, "trt",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i))),
                  1) ? stan::model::rvalue(d, "d",
                         stan::model::index_uni(
                           (stan::model::rvalue(trt, "trt",
                              stan::model::index_uni(((narm_ipd +
                                narm_agd_arm) + i))) - 1))) : 0) +
              (stan::model::rvalue(which_RE, "which_RE",
                 stan::model::index_uni(((narm_ipd + narm_agd_arm) + i))) ? 
              stan::model::rvalue(f_delta, "f_delta",
                stan::model::index_uni(
                  stan::model::rvalue(which_RE, "which_RE",
                    stan::model::index_uni(((narm_ipd + narm_agd_arm) + i))))) : 0)),
              "assigning variable delta", stan::model::index_uni(s));
            current_statement__ = 300;
            if (stan::math::logical_gt(
                  stan::model::rvalue(agd_contrast_trt_b,
                    "agd_contrast_trt_b", stan::model::index_uni(i)), 1)) {
              current_statement__ = 299;
              stan::model::assign(delta,
                (stan::model::rvalue(delta, "delta",
                   stan::model::index_uni(s)) -
                stan::model::rvalue(d, "d",
                  stan::model::index_uni(
                    (stan::model::rvalue(agd_contrast_trt_b,
                       "agd_contrast_trt_b", stan::model::index_uni(i)) - 1)))),
                "assigning variable delta", stan::model::index_uni(s));
            }
            current_statement__ = 301;
            s = (s + 1);
          }
        }
      }
      current_statement__ = 312;
      for (int i = 1; i <= ni_agd_contrast; ++i) {
        current_statement__ = 310;
        for (int j = 1; j <= n_int_thin; ++j) {
          current_statement__ = 308;
          stan::model::assign(theta_bar_cum_agd_contrast,
            stan::math::mean(
              stan::model::rvalue(eta_agd_contrast_ii, "eta_agd_contrast_ii",
                stan::model::index_min_max((1 + ((i - 1) * nint)), (((i - 1)
                  * nint) + (j * int_thin))))),
            "assigning variable theta_bar_cum_agd_contrast",
            stan::model::index_uni((((i - 1) * n_int_thin) + j)));
        }
      }
      current_statement__ = 313;
      stan::model::assign(fitted_agd_contrast, eta_agd_contrast_bar,
        "assigning variable fitted_agd_contrast");
      {
        int a = std::numeric_limits<int>::min();
        current_statement__ = 314;
        a = 0;
        int nc = std::numeric_limits<int>::min();
        current_statement__ = 321;
        for (int s = 1; s <= ns_agd_contrast; ++s) {
          current_statement__ = 316;
          nc = stan::model::rvalue(nc_agd_contrast, "nc_agd_contrast",
                 stan::model::index_uni(s));
          current_statement__ = 317;
          stan::model::assign(log_lik,
            stan::math::multi_normal_lpdf<false>(
              stan::model::rvalue(agd_contrast_y, "agd_contrast_y",
                stan::model::index_min_max((a + 1), (a + nc))),
              stan::model::rvalue(eta_agd_contrast_bar,
                "eta_agd_contrast_bar",
                stan::model::index_min_max((a + 1), (a + nc))),
              stan::model::rvalue(agd_contrast_Sigma, "agd_contrast_Sigma",
                stan::model::index_min_max((a + 1), (a + nc)),
                stan::model::index_min_max((a + 1), (a + nc)))),
            "assigning variable log_lik",
            stan::model::index_uni(((ni_ipd + ni_agd_arm) + s)));
          current_statement__ = 318;
          stan::model::assign(resdev,
            stan::math::quad_form(
              stan::model::rvalue(inv_Sigma, "inv_Sigma",
                stan::model::index_min_max((a + 1), (a + nc)),
                stan::model::index_min_max((a + 1), (a + nc))),
              stan::math::subtract(
                stan::model::rvalue(agd_contrast_y, "agd_contrast_y",
                  stan::model::index_min_max((a + 1), (a + nc))),
                stan::model::rvalue(eta_agd_contrast_bar,
                  "eta_agd_contrast_bar",
                  stan::model::index_min_max((a + 1), (a + nc))))),
            "assigning variable resdev",
            stan::model::index_uni(((ni_ipd + ni_agd_arm) + s)));
          current_statement__ = 319;
          a = (a + nc);
        }
      }
      current_statement__ = 324;
      if (ni_ipd) {
        current_statement__ = 323;
        stan::model::assign(log_lik, log_L_ipd, "assigning variable log_lik",
          stan::model::index_min_max(1, ni_ipd));
      }
      current_statement__ = 326;
      if (ni_agd_arm) {
        current_statement__ = 325;
        stan::model::assign(log_lik, log_L_agd_arm,
          "assigning variable log_lik",
          stan::model::index_min_max((ni_ipd + 1), (ni_ipd + ni_agd_arm)));
      }
      current_statement__ = 328;
      if ((ni_ipd + ni_agd_arm)) {
        current_statement__ = 327;
        stan::model::assign(resdev,
          stan::math::multiply(-2,
            stan::model::rvalue(log_lik, "log_lik",
              stan::model::index_min_max(1, (ni_ipd + ni_agd_arm)))),
          "assigning variable resdev",
          stan::model::index_min_max(1, (ni_ipd + ni_agd_arm)));
      }
      current_statement__ = 330;
      if ((stan::math::primitive_value(
             (stan::math::primitive_value(
                (stan::math::primitive_value(stan::math::logical_neq(dist, 1))
                &&
                stan::math::primitive_value(stan::math::logical_neq(dist, 4))))
             &&
             stan::math::primitive_value(stan::math::logical_neq(dist, 6))))
          && stan::math::primitive_value(stan::math::logical_neq(dist, 9)))) {
        current_statement__ = 329;
        stan::model::assign(shape, aux, "assigning variable shape");
      }
      current_statement__ = 332;
      if (stan::math::logical_eq(dist, 6)) {
        current_statement__ = 331;
        stan::model::assign(sdlog, aux, "assigning variable sdlog");
      }
      current_statement__ = 336;
      if (stan::math::logical_eq(dist, 9)) {
        current_statement__ = 333;
        stan::model::assign(sigma, aux, "assigning variable sigma");
        current_statement__ = 334;
        stan::model::assign(k, aux2, "assigning variable k");
      }
      current_statement__ = 338;
      if (aux_reg_trt) {
        current_statement__ = 337;
        stan::model::assign(d_aux,
          stan::model::rvalue(beta_aux, "beta_aux",
            stan::model::index_min_max(1, (nt - 1)),
            stan::model::index_omni()), "assigning variable d_aux");
      }
      out__.write(shape);
      out__.write(sdlog);
      out__.write(sigma);
      out__.write(k);
      out__.write(d_aux);
      out__.write(log_lik);
      out__.write(resdev);
      out__.write(fitted_agd_contrast);
      out__.write(theta_bar_cum_agd_contrast);
      out__.write(delta);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  template <typename VecVar, typename VecI,
            stan::require_vector_t<VecVar>* = nullptr,
            stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr>
  inline void
  unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__,
                         VecVar& vars__, std::ostream* pstream__ = nullptr) const {
    using local_scalar_t__ = double;
    stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
    stan::io::serializer<local_scalar_t__> out__(vars__);
    int current_statement__ = 0;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      Eigen::Matrix<local_scalar_t__,-1,1> beta_tilde =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nX, DUMMY_VAR__);
      current_statement__ = 1;
      stan::model::assign(beta_tilde,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(nX),
        "assigning variable beta_tilde");
      out__.write(beta_tilde);
      Eigen::Matrix<local_scalar_t__,-1,1> u_delta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_delta, DUMMY_VAR__);
      current_statement__ = 2;
      stan::model::assign(u_delta,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(n_delta),
        "assigning variable u_delta");
      out__.write(u_delta);
      Eigen::Matrix<local_scalar_t__,-1,1> tau =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(tau_1dim__,
          DUMMY_VAR__);
      current_statement__ = 3;
      stan::model::assign(tau,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(tau_1dim__),
        "assigning variable tau");
      out__.write_free_lb(0, tau);
      Eigen::Matrix<local_scalar_t__,-1,1> class_mean =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_mean_1dim__,
          DUMMY_VAR__);
      current_statement__ = 4;
      stan::model::assign(class_mean,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(class_mean_1dim__),
        "assigning variable class_mean");
      out__.write(class_mean);
      Eigen::Matrix<local_scalar_t__,-1,1> class_sd =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_sd_1dim__,
          DUMMY_VAR__);
      current_statement__ = 5;
      stan::model::assign(class_sd,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(class_sd_1dim__),
        "assigning variable class_sd");
      out__.write_free_lb(0, class_sd);
      Eigen::Matrix<local_scalar_t__,-1,1> z_class =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(z_class_1dim__,
          DUMMY_VAR__);
      current_statement__ = 6;
      stan::model::assign(z_class,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(z_class_1dim__),
        "assigning variable z_class");
      out__.write(z_class);
      Eigen::Matrix<local_scalar_t__,-1,1> aux =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_aux, DUMMY_VAR__);
      current_statement__ = 7;
      stan::model::assign(aux,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(n_aux),
        "assigning variable aux");
      out__.write_free_lb(0, aux);
      Eigen::Matrix<local_scalar_t__,-1,1> aux2 =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(aux2_1dim__,
          DUMMY_VAR__);
      current_statement__ = 8;
      stan::model::assign(aux2,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,1>>(aux2_1dim__),
        "assigning variable aux2");
      out__.write_free_lb(0, aux2);
      Eigen::Matrix<local_scalar_t__,-1,-1> beta_aux =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(beta_aux_1dim__,
          beta_aux_2dim__, DUMMY_VAR__);
      current_statement__ = 9;
      stan::model::assign(beta_aux,
        in__.read<Eigen::Matrix<local_scalar_t__,-1,-1>>(beta_aux_1dim__,
          beta_aux_2dim__), "assigning variable beta_aux");
      out__.write(beta_aux);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  template <typename VecVar, stan::require_vector_t<VecVar>* = nullptr>
  inline void
  transform_inits_impl(const stan::io::var_context& context__, VecVar&
                       vars__, std::ostream* pstream__ = nullptr) const {
    using local_scalar_t__ = double;
    stan::io::serializer<local_scalar_t__> out__(vars__);
    int current_statement__ = 0;
    local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
    // suppress unused var warning
    (void) DUMMY_VAR__;
    try {
      current_statement__ = 1;
      context__.validate_dims("parameter initialization", "beta_tilde",
        "double", std::vector<size_t>{static_cast<size_t>(nX)});
      current_statement__ = 2;
      context__.validate_dims("parameter initialization", "u_delta",
        "double", std::vector<size_t>{static_cast<size_t>(n_delta)});
      current_statement__ = 3;
      context__.validate_dims("parameter initialization", "tau", "double",
        std::vector<size_t>{static_cast<size_t>(tau_1dim__)});
      current_statement__ = 4;
      context__.validate_dims("parameter initialization", "class_mean",
        "double",
        std::vector<size_t>{static_cast<size_t>(class_mean_1dim__)});
      current_statement__ = 5;
      context__.validate_dims("parameter initialization", "class_sd",
        "double", std::vector<size_t>{static_cast<size_t>(class_sd_1dim__)});
      current_statement__ = 6;
      context__.validate_dims("parameter initialization", "z_class",
        "double", std::vector<size_t>{static_cast<size_t>(z_class_1dim__)});
      current_statement__ = 7;
      context__.validate_dims("parameter initialization", "aux", "double",
        std::vector<size_t>{static_cast<size_t>(n_aux)});
      current_statement__ = 8;
      context__.validate_dims("parameter initialization", "aux2", "double",
        std::vector<size_t>{static_cast<size_t>(aux2_1dim__)});
      current_statement__ = 9;
      context__.validate_dims("parameter initialization", "beta_aux",
        "double",
        std::vector<size_t>{static_cast<size_t>(beta_aux_1dim__),
          static_cast<size_t>(beta_aux_2dim__)});
      int pos__ = std::numeric_limits<int>::min();
      pos__ = 1;
      Eigen::Matrix<local_scalar_t__,-1,1> beta_tilde =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(nX, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> beta_tilde_flat__;
        current_statement__ = 1;
        beta_tilde_flat__ = context__.vals_r("beta_tilde");
        current_statement__ = 1;
        pos__ = 1;
        current_statement__ = 1;
        for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
          current_statement__ = 1;
          stan::model::assign(beta_tilde, beta_tilde_flat__[(pos__ - 1)],
            "assigning variable beta_tilde", stan::model::index_uni(sym1__));
          current_statement__ = 1;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(beta_tilde);
      Eigen::Matrix<local_scalar_t__,-1,1> u_delta =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_delta, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> u_delta_flat__;
        current_statement__ = 2;
        u_delta_flat__ = context__.vals_r("u_delta");
        current_statement__ = 2;
        pos__ = 1;
        current_statement__ = 2;
        for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
          current_statement__ = 2;
          stan::model::assign(u_delta, u_delta_flat__[(pos__ - 1)],
            "assigning variable u_delta", stan::model::index_uni(sym1__));
          current_statement__ = 2;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(u_delta);
      Eigen::Matrix<local_scalar_t__,-1,1> tau =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(tau_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> tau_flat__;
        current_statement__ = 3;
        tau_flat__ = context__.vals_r("tau");
        current_statement__ = 3;
        pos__ = 1;
        current_statement__ = 3;
        for (int sym1__ = 1; sym1__ <= tau_1dim__; ++sym1__) {
          current_statement__ = 3;
          stan::model::assign(tau, tau_flat__[(pos__ - 1)],
            "assigning variable tau", stan::model::index_uni(sym1__));
          current_statement__ = 3;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, tau);
      Eigen::Matrix<local_scalar_t__,-1,1> class_mean =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_mean_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> class_mean_flat__;
        current_statement__ = 4;
        class_mean_flat__ = context__.vals_r("class_mean");
        current_statement__ = 4;
        pos__ = 1;
        current_statement__ = 4;
        for (int sym1__ = 1; sym1__ <= class_mean_1dim__; ++sym1__) {
          current_statement__ = 4;
          stan::model::assign(class_mean, class_mean_flat__[(pos__ - 1)],
            "assigning variable class_mean", stan::model::index_uni(sym1__));
          current_statement__ = 4;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(class_mean);
      Eigen::Matrix<local_scalar_t__,-1,1> class_sd =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(class_sd_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> class_sd_flat__;
        current_statement__ = 5;
        class_sd_flat__ = context__.vals_r("class_sd");
        current_statement__ = 5;
        pos__ = 1;
        current_statement__ = 5;
        for (int sym1__ = 1; sym1__ <= class_sd_1dim__; ++sym1__) {
          current_statement__ = 5;
          stan::model::assign(class_sd, class_sd_flat__[(pos__ - 1)],
            "assigning variable class_sd", stan::model::index_uni(sym1__));
          current_statement__ = 5;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, class_sd);
      Eigen::Matrix<local_scalar_t__,-1,1> z_class =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(z_class_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> z_class_flat__;
        current_statement__ = 6;
        z_class_flat__ = context__.vals_r("z_class");
        current_statement__ = 6;
        pos__ = 1;
        current_statement__ = 6;
        for (int sym1__ = 1; sym1__ <= z_class_1dim__; ++sym1__) {
          current_statement__ = 6;
          stan::model::assign(z_class, z_class_flat__[(pos__ - 1)],
            "assigning variable z_class", stan::model::index_uni(sym1__));
          current_statement__ = 6;
          pos__ = (pos__ + 1);
        }
      }
      out__.write(z_class);
      Eigen::Matrix<local_scalar_t__,-1,1> aux =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(n_aux, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> aux_flat__;
        current_statement__ = 7;
        aux_flat__ = context__.vals_r("aux");
        current_statement__ = 7;
        pos__ = 1;
        current_statement__ = 7;
        for (int sym1__ = 1; sym1__ <= n_aux; ++sym1__) {
          current_statement__ = 7;
          stan::model::assign(aux, aux_flat__[(pos__ - 1)],
            "assigning variable aux", stan::model::index_uni(sym1__));
          current_statement__ = 7;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, aux);
      Eigen::Matrix<local_scalar_t__,-1,1> aux2 =
        Eigen::Matrix<local_scalar_t__,-1,1>::Constant(aux2_1dim__,
          DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> aux2_flat__;
        current_statement__ = 8;
        aux2_flat__ = context__.vals_r("aux2");
        current_statement__ = 8;
        pos__ = 1;
        current_statement__ = 8;
        for (int sym1__ = 1; sym1__ <= aux2_1dim__; ++sym1__) {
          current_statement__ = 8;
          stan::model::assign(aux2, aux2_flat__[(pos__ - 1)],
            "assigning variable aux2", stan::model::index_uni(sym1__));
          current_statement__ = 8;
          pos__ = (pos__ + 1);
        }
      }
      out__.write_free_lb(0, aux2);
      Eigen::Matrix<local_scalar_t__,-1,-1> beta_aux =
        Eigen::Matrix<local_scalar_t__,-1,-1>::Constant(beta_aux_1dim__,
          beta_aux_2dim__, DUMMY_VAR__);
      {
        std::vector<local_scalar_t__> beta_aux_flat__;
        current_statement__ = 9;
        beta_aux_flat__ = context__.vals_r("beta_aux");
        current_statement__ = 9;
        pos__ = 1;
        current_statement__ = 9;
        for (int sym1__ = 1; sym1__ <= beta_aux_2dim__; ++sym1__) {
          current_statement__ = 9;
          for (int sym2__ = 1; sym2__ <= beta_aux_1dim__; ++sym2__) {
            current_statement__ = 9;
            stan::model::assign(beta_aux, beta_aux_flat__[(pos__ - 1)],
              "assigning variable beta_aux", stan::model::index_uni(sym2__),
              stan::model::index_uni(sym1__));
            current_statement__ = 9;
            pos__ = (pos__ + 1);
          }
        }
      }
      out__.write(beta_aux);
    } catch (const std::exception& e) {
      stan::lang::rethrow_located(e, locations_array__[current_statement__]);
    }
  }
  inline void
  get_param_names(std::vector<std::string>& names__, const bool
                  emit_transformed_parameters__ = true, const bool
                  emit_generated_quantities__ = true) const {
    names__ = std::vector<std::string>{"beta_tilde", "u_delta", "tau",
                "class_mean", "class_sd", "z_class", "aux", "aux2",
                "beta_aux"};
    if (emit_transformed_parameters__) {
      std::vector<std::string>
        temp{"log_L_ipd", "log_L_agd_arm", "eta_ipd", "f_delta", "f_class",
             "allbeta", "mu", "d", "omega", "beta", "eta_agd_contrast_ii",
             "eta_agd_contrast_bar"};
      names__.reserve(names__.size() + temp.size());
      names__.insert(names__.end(), temp.begin(), temp.end());
    }
    if (emit_generated_quantities__) {
      std::vector<std::string>
        temp{"shape", "sdlog", "sigma", "k", "d_aux", "log_lik", "resdev",
             "fitted_agd_contrast", "theta_bar_cum_agd_contrast", "delta"};
      names__.reserve(names__.size() + temp.size());
      names__.insert(names__.end(), temp.begin(), temp.end());
    }
  }
  inline void
  get_dims(std::vector<std::vector<size_t>>& dimss__, const bool
           emit_transformed_parameters__ = true, const bool
           emit_generated_quantities__ = true) const {
    dimss__ = std::vector<std::vector<size_t>>{std::vector<size_t>{static_cast<
                                                                    size_t>(
                                                                    nX)},
                std::vector<size_t>{static_cast<size_t>(n_delta)},
                std::vector<size_t>{static_cast<size_t>(tau_1dim__)},
                std::vector<size_t>{static_cast<size_t>(class_mean_1dim__)},
                std::vector<size_t>{static_cast<size_t>(class_sd_1dim__)},
                std::vector<size_t>{static_cast<size_t>(z_class_1dim__)},
                std::vector<size_t>{static_cast<size_t>(n_aux)},
                std::vector<size_t>{static_cast<size_t>(aux2_1dim__)},
                std::vector<size_t>{static_cast<size_t>(beta_aux_1dim__),
                  static_cast<size_t>(beta_aux_2dim__)}};
    if (emit_transformed_parameters__) {
      std::vector<std::vector<size_t>>
        temp{std::vector<size_t>{static_cast<size_t>(ni_ipd)},
             std::vector<size_t>{static_cast<size_t>(ni_agd_arm)},
             std::vector<size_t>{static_cast<size_t>(ni_ipd)},
             std::vector<size_t>{static_cast<size_t>(n_delta)},
             std::vector<size_t>{static_cast<size_t>(f_class_1dim__)},
             std::vector<size_t>{static_cast<size_t>(nX)},
             std::vector<size_t>{static_cast<size_t>(totns)},
             std::vector<size_t>{static_cast<size_t>(d_1dim__)},
             std::vector<size_t>{static_cast<size_t>(nodesplit)},
             std::vector<size_t>{static_cast<size_t>(beta_1dim__)},
             std::vector<size_t>{static_cast<size_t>(
                                   eta_agd_contrast_ii_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ni_agd_contrast)}};
      dimss__.reserve(dimss__.size() + temp.size());
      dimss__.insert(dimss__.end(), temp.begin(), temp.end());
    }
    if (emit_generated_quantities__) {
      std::vector<std::vector<size_t>>
        temp{std::vector<size_t>{static_cast<size_t>(shape_1dim__)},
             std::vector<size_t>{static_cast<size_t>(sdlog_1dim__)},
             std::vector<size_t>{static_cast<size_t>(sigma_1dim__)},
             std::vector<size_t>{static_cast<size_t>(k_1dim__)},
             std::vector<size_t>{static_cast<size_t>(d_aux_1dim__),
               static_cast<size_t>(d_aux_2dim__)},
             std::vector<size_t>{static_cast<size_t>(log_lik_1dim__)},
             std::vector<size_t>{static_cast<size_t>(resdev_1dim__)},
             std::vector<size_t>{static_cast<size_t>(ni_agd_contrast)},
             std::vector<size_t>{static_cast<size_t>(
                                   theta_bar_cum_agd_contrast_1dim__)},
             std::vector<size_t>{static_cast<size_t>(n_delta)}};
      dimss__.reserve(dimss__.size() + temp.size());
      dimss__.insert(dimss__.end(), temp.begin(), temp.end());
    }
  }
  inline void
  constrained_param_names(std::vector<std::string>& param_names__, bool
                          emit_transformed_parameters__ = true, bool
                          emit_generated_quantities__ = true) const final {
    for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
      param_names__.emplace_back(std::string() + "beta_tilde" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
      param_names__.emplace_back(std::string() + "u_delta" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= tau_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "tau" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= class_mean_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "class_mean" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= class_sd_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "class_sd" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= z_class_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "z_class" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= n_aux; ++sym1__) {
      param_names__.emplace_back(std::string() + "aux" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= aux2_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "aux2" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= beta_aux_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= beta_aux_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "beta_aux" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_L_ipd" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_arm; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_L_agd_arm" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_ipd" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
        param_names__.emplace_back(std::string() + "f_delta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= f_class_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "f_class" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
        param_names__.emplace_back(std::string() + "allbeta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= totns; ++sym1__) {
        param_names__.emplace_back(std::string() + "mu" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= d_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "d" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= nodesplit; ++sym1__) {
        param_names__.emplace_back(std::string() + "omega" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= beta_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "beta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= eta_agd_contrast_ii_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_agd_contrast_ii" +
          '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_contrast; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_agd_contrast_bar" +
          '.' + std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      for (int sym1__ = 1; sym1__ <= shape_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "shape" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= sdlog_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "sdlog" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= sigma_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "sigma" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= k_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "k" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= d_aux_2dim__; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= d_aux_1dim__; ++sym2__) {
          param_names__.emplace_back(std::string() + "d_aux" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      for (int sym1__ = 1; sym1__ <= log_lik_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_lik" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= resdev_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "resdev" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_contrast; ++sym1__) {
        param_names__.emplace_back(std::string() + "fitted_agd_contrast" +
          '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <=
           theta_bar_cum_agd_contrast_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() +
          "theta_bar_cum_agd_contrast" + '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
        param_names__.emplace_back(std::string() + "delta" + '.' +
          std::to_string(sym1__));
      }
    }
  }
  inline void
  unconstrained_param_names(std::vector<std::string>& param_names__, bool
                            emit_transformed_parameters__ = true, bool
                            emit_generated_quantities__ = true) const final {
    for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
      param_names__.emplace_back(std::string() + "beta_tilde" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
      param_names__.emplace_back(std::string() + "u_delta" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= tau_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "tau" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= class_mean_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "class_mean" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= class_sd_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "class_sd" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= z_class_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "z_class" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= n_aux; ++sym1__) {
      param_names__.emplace_back(std::string() + "aux" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= aux2_1dim__; ++sym1__) {
      param_names__.emplace_back(std::string() + "aux2" + '.' +
        std::to_string(sym1__));
    }
    for (int sym1__ = 1; sym1__ <= beta_aux_2dim__; ++sym1__) {
      for (int sym2__ = 1; sym2__ <= beta_aux_1dim__; ++sym2__) {
        param_names__.emplace_back(std::string() + "beta_aux" + '.' +
          std::to_string(sym2__) + '.' + std::to_string(sym1__));
      }
    }
    if (emit_transformed_parameters__) {
      for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_L_ipd" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_arm; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_L_agd_arm" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_ipd; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_ipd" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
        param_names__.emplace_back(std::string() + "f_delta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= f_class_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "f_class" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= nX; ++sym1__) {
        param_names__.emplace_back(std::string() + "allbeta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= totns; ++sym1__) {
        param_names__.emplace_back(std::string() + "mu" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= d_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "d" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= nodesplit; ++sym1__) {
        param_names__.emplace_back(std::string() + "omega" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= beta_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "beta" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= eta_agd_contrast_ii_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_agd_contrast_ii" +
          '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_contrast; ++sym1__) {
        param_names__.emplace_back(std::string() + "eta_agd_contrast_bar" +
          '.' + std::to_string(sym1__));
      }
    }
    if (emit_generated_quantities__) {
      for (int sym1__ = 1; sym1__ <= shape_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "shape" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= sdlog_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "sdlog" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= sigma_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "sigma" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= k_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "k" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= d_aux_2dim__; ++sym1__) {
        for (int sym2__ = 1; sym2__ <= d_aux_1dim__; ++sym2__) {
          param_names__.emplace_back(std::string() + "d_aux" + '.' +
            std::to_string(sym2__) + '.' + std::to_string(sym1__));
        }
      }
      for (int sym1__ = 1; sym1__ <= log_lik_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "log_lik" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= resdev_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() + "resdev" + '.' +
          std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= ni_agd_contrast; ++sym1__) {
        param_names__.emplace_back(std::string() + "fitted_agd_contrast" +
          '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <=
           theta_bar_cum_agd_contrast_1dim__; ++sym1__) {
        param_names__.emplace_back(std::string() +
          "theta_bar_cum_agd_contrast" + '.' + std::to_string(sym1__));
      }
      for (int sym1__ = 1; sym1__ <= n_delta; ++sym1__) {
        param_names__.emplace_back(std::string() + "delta" + '.' +
          std::to_string(sym1__));
      }
    }
  }
  inline std::string get_constrained_sizedtypes() const {
    return std::string("[{\"name\":\"beta_tilde\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nX) + "},\"block\":\"parameters\"},{\"name\":\"u_delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(tau_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"class_mean\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(class_mean_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"class_sd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(class_sd_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"z_class\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(z_class_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"aux\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_aux) + "},\"block\":\"parameters\"},{\"name\":\"aux2\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(aux2_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"beta_aux\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(beta_aux_1dim__) + ",\"cols\":" + std::to_string(beta_aux_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"log_L_ipd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_ipd) + "},\"block\":\"transformed_parameters\"},{\"name\":\"log_L_agd_arm\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_arm) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_ipd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_ipd) + "},\"block\":\"transformed_parameters\"},{\"name\":\"f_delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"transformed_parameters\"},{\"name\":\"f_class\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(f_class_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"allbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nX) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(totns) + "},\"block\":\"transformed_parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(d_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"omega\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nodesplit) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(beta_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_agd_contrast_ii\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(eta_agd_contrast_ii_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_agd_contrast_bar\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_contrast) + "},\"block\":\"transformed_parameters\"},{\"name\":\"shape\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(shape_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"sdlog\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sdlog_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"sigma\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sigma_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"k\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"d_aux\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(d_aux_1dim__) + ",\"cols\":" + std::to_string(d_aux_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(log_lik_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"resdev\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(resdev_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"fitted_agd_contrast\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_contrast) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_bar_cum_agd_contrast\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(theta_bar_cum_agd_contrast_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"generated_quantities\"}]");
  }
  inline std::string get_unconstrained_sizedtypes() const {
    return std::string("[{\"name\":\"beta_tilde\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nX) + "},\"block\":\"parameters\"},{\"name\":\"u_delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(tau_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"class_mean\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(class_mean_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"class_sd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(class_sd_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"z_class\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(z_class_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"aux\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_aux) + "},\"block\":\"parameters\"},{\"name\":\"aux2\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(aux2_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"beta_aux\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(beta_aux_1dim__) + ",\"cols\":" + std::to_string(beta_aux_2dim__) + "},\"block\":\"parameters\"},{\"name\":\"log_L_ipd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_ipd) + "},\"block\":\"transformed_parameters\"},{\"name\":\"log_L_agd_arm\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_arm) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_ipd\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_ipd) + "},\"block\":\"transformed_parameters\"},{\"name\":\"f_delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"transformed_parameters\"},{\"name\":\"f_class\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(f_class_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"allbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nX) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(totns) + "},\"block\":\"transformed_parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(d_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"omega\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nodesplit) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(beta_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_agd_contrast_ii\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(eta_agd_contrast_ii_1dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"eta_agd_contrast_bar\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_contrast) + "},\"block\":\"transformed_parameters\"},{\"name\":\"shape\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(shape_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"sdlog\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sdlog_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"sigma\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(sigma_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"k\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"d_aux\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(d_aux_1dim__) + ",\"cols\":" + std::to_string(d_aux_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(log_lik_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"resdev\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(resdev_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"fitted_agd_contrast\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(ni_agd_contrast) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_bar_cum_agd_contrast\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(theta_bar_cum_agd_contrast_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"delta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_delta) + "},\"block\":\"generated_quantities\"}]");
  }
  // Begin method overload boilerplate
  template <typename RNG> inline void
  write_array(RNG& base_rng, Eigen::Matrix<double,-1,1>& params_r,
              Eigen::Matrix<double,-1,1>& vars, const bool
              emit_transformed_parameters = true, const bool
              emit_generated_quantities = true, std::ostream*
              pstream = nullptr) const {
    const size_t num_params__ = ((((((((nX + n_delta) + tau_1dim__) +
      class_mean_1dim__) + class_sd_1dim__) + z_class_1dim__) + n_aux) +
      aux2_1dim__) + (beta_aux_1dim__ * beta_aux_2dim__));
    const size_t num_transformed = emit_transformed_parameters *
      ((((((((((((ni_ipd + ni_agd_arm) + ni_ipd) + n_delta) + f_class_1dim__)
      + nX) + totns) + d_1dim__) + nodesplit) + beta_1dim__) +
      eta_agd_contrast_ii_1dim__) + ni_agd_contrast));
    const size_t num_gen_quantities = emit_generated_quantities *
      ((((((((((shape_1dim__ + sdlog_1dim__) + sigma_1dim__) + k_1dim__) +
      (d_aux_1dim__ * d_aux_2dim__)) + log_lik_1dim__) + resdev_1dim__) +
      ni_agd_contrast) + theta_bar_cum_agd_contrast_1dim__) + n_delta));
    const size_t num_to_write = num_params__ + num_transformed +
      num_gen_quantities;
    std::vector<int> params_i;
    vars = Eigen::Matrix<double,-1,1>::Constant(num_to_write,
             std::numeric_limits<double>::quiet_NaN());
    write_array_impl(base_rng, params_r, params_i, vars,
      emit_transformed_parameters, emit_generated_quantities, pstream);
  }
  template <typename RNG> inline void
  write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
              params_i, std::vector<double>& vars, bool
              emit_transformed_parameters = true, bool
              emit_generated_quantities = true, std::ostream*
              pstream = nullptr) const {
    const size_t num_params__ = ((((((((nX + n_delta) + tau_1dim__) +
      class_mean_1dim__) + class_sd_1dim__) + z_class_1dim__) + n_aux) +
      aux2_1dim__) + (beta_aux_1dim__ * beta_aux_2dim__));
    const size_t num_transformed = emit_transformed_parameters *
      ((((((((((((ni_ipd + ni_agd_arm) + ni_ipd) + n_delta) + f_class_1dim__)
      + nX) + totns) + d_1dim__) + nodesplit) + beta_1dim__) +
      eta_agd_contrast_ii_1dim__) + ni_agd_contrast));
    const size_t num_gen_quantities = emit_generated_quantities *
      ((((((((((shape_1dim__ + sdlog_1dim__) + sigma_1dim__) + k_1dim__) +
      (d_aux_1dim__ * d_aux_2dim__)) + log_lik_1dim__) + resdev_1dim__) +
      ni_agd_contrast) + theta_bar_cum_agd_contrast_1dim__) + n_delta));
    const size_t num_to_write = num_params__ + num_transformed +
      num_gen_quantities;
    vars = std::vector<double>(num_to_write,
             std::numeric_limits<double>::quiet_NaN());
    write_array_impl(base_rng, params_r, params_i, vars,
      emit_transformed_parameters, emit_generated_quantities, pstream);
  }
  template <bool propto__, bool jacobian__, typename T_> inline T_
  log_prob(Eigen::Matrix<T_,-1,1>& params_r, std::ostream* pstream = nullptr) const {
    Eigen::Matrix<int,-1,1> params_i;
    return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
  }
  template <bool propto__, bool jacobian__, typename T_> inline T_
  log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
           std::ostream* pstream = nullptr) const {
    return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
  }
  inline void
  transform_inits(const stan::io::var_context& context,
                  Eigen::Matrix<double,-1,1>& params_r, std::ostream*
                  pstream = nullptr) const final {
    std::vector<double> params_r_vec(params_r.size());
    std::vector<int> params_i;
    transform_inits(context, params_i, params_r_vec, pstream);
    params_r = Eigen::Map<Eigen::Matrix<double,-1,1>>(params_r_vec.data(),
                 params_r_vec.size());
  }
  inline void
  transform_inits(const stan::io::var_context& context, std::vector<int>&
                  params_i, std::vector<double>& vars, std::ostream*
                  pstream__ = nullptr) const {
    vars.resize(num_params_r__);
    transform_inits_impl(context, vars, pstream__);
  }
  inline void
  unconstrain_array(const std::vector<double>& params_constrained,
                    std::vector<double>& params_unconstrained, std::ostream*
                    pstream = nullptr) const {
    const std::vector<int> params_i;
    params_unconstrained = std::vector<double>(num_params_r__,
                             std::numeric_limits<double>::quiet_NaN());
    unconstrain_array_impl(params_constrained, params_i,
      params_unconstrained, pstream);
  }
  inline void
  unconstrain_array(const Eigen::Matrix<double,-1,1>& params_constrained,
                    Eigen::Matrix<double,-1,1>& params_unconstrained,
                    std::ostream* pstream = nullptr) const {
    const std::vector<int> params_i;
    params_unconstrained = Eigen::Matrix<double,-1,1>::Constant(num_params_r__,
                             std::numeric_limits<double>::quiet_NaN());
    unconstrain_array_impl(params_constrained, params_i,
      params_unconstrained, pstream);
  }
};
}
using stan_model = model_survival_param_namespace::model_survival_param;
#ifndef USING_R
// Boilerplate
stan::model::model_base&
new_model(stan::io::var_context& data_context, unsigned int seed,
          std::ostream* msg_stream) {
  stan_model* m = new stan_model(data_context, seed, msg_stream);
  return *m;
}
stan::math::profile_map& get_stan_profile_data() {
  return model_survival_param_namespace::profiles__;
}
#endif
#endif
