1/* { dg-options "-O2 -mcmodel=small -fPIC -fno-builtin" }  */
2/* { dg-do compile } */
3
4typedef long unsigned int size_t;
5enum
6{
7  __LC_TIME = 2,
8};
9enum
10{
11  ABDAY_1 = (((__LC_TIME) << 16) | (0)),
12  DAY_1,
13  ABMON_1,
14  MON_1,
15  D_T_FMT,
16};
17typedef struct __locale_struct
18{
19  struct locale_data *__locales[13];
20} *__locale_t;
21struct tm
22{
23  int tm_sec;
24  int tm_min;
25  int tm_hour;
26};
27struct locale_data
28{
29  const char *name;
30  struct
31  {
32    const char *string;
33  }
34  values [];
35};
36extern const struct locale_data _nl_C_LC_TIME __attribute__ ((visibility ("hidden")));
37extern void *memset (void *s, int c, size_t n);
38extern size_t strlen (const char *s);
39extern int __strncasecmp_l (const char *s1, const char *s2, size_t n, __locale_t locale);
40char *
41__strptime_internal (rp, fmt, tmp, statep , locale)
42     const char *rp;
43     const char *fmt;
44     __locale_t locale;
45     void *statep;
46     int tmp;
47{
48  struct locale_data *const current = locale->__locales[__LC_TIME];
49  const char *rp_backup;
50  const char *rp_longest;
51  int cnt;
52  size_t val;
53  enum ptime_locale_status { not, loc, raw } decided_longest;
54  struct __strptime_state
55  {
56    enum ptime_locale_status decided : 2;
57  } s;
58  struct tm tmb;
59  struct tm *tm;
60  if (statep == ((void *)0))
61    {
62      memset (&s, 0, sizeof (s));
63    }
64    {
65      tm = &tmb;
66    }
67  while (*fmt != '\0')
68    {
69      if (*fmt != '%')
70 {
71   if (*fmt++ != *rp++) return ((void *)0);
72   continue;
73 }
74      if (statep != ((void *)0))
75 {
76     ++fmt;
77 }
78      rp_backup = rp;
79      switch (*fmt++)
80 {
81 case '%':
82   for (cnt = 0; cnt < 7; ++cnt)
83     {
84       const char *trp;
85       if (s.decided !=raw)
86  {
87    if (({ size_t len = strlen ((current->values[((int) (DAY_1 + cnt) & 0xffff)].string)); int result = __strncasecmp_l (((current->values[((int) (DAY_1 + cnt) & 0xffff)].string)), (trp), len, locale) == 0; if (result) (trp) += len; result; })
88        && trp > rp_longest)
89      {
90      }
91    if (({ size_t len = strlen ((current->values[((int) (ABDAY_1 + cnt) & 0xffff)].string)); int result = __strncasecmp_l (((current->values[((int) (ABDAY_1 + cnt) & 0xffff)].string)), (trp), len, locale) == 0; if (result) (trp) += len; result; })
92        && trp > rp_longest)
93      {
94      }
95  }
96       if (s.decided != loc
97    && (((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (DAY_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (DAY_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
98         && trp > rp_longest)
99        || ((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (ABDAY_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (ABDAY_1) & 0xffff)].string)[cnt]), (rp), len, locale) == 0; if (result) (rp) += len; result; }))
100     && trp > rp_longest)))
101  {
102  }
103     }
104     {
105       const char *trp;
106       if (s.decided != loc
107    && (((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (MON_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (MON_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
108         && trp > rp_longest)
109        || ((trp = rp, ({ size_t len = strlen ((&_nl_C_LC_TIME.values[((int) (ABMON_1) & 0xffff)].string)[cnt]); int result = __strncasecmp_l (((&_nl_C_LC_TIME.values[((int) (ABMON_1) & 0xffff)].string)[cnt]), (trp), len, locale) == 0; if (result) (trp) += len; result; }))
110     && trp > rp_longest)))
111  {
112  }
113     }
114 case 'c':
115     {
116       if (!(*((current->values[((int) (D_T_FMT) & 0xffff)].string)) != '\0' && (rp = __strptime_internal (rp, ((current->values[((int) (D_T_FMT) & 0xffff)].string)), tm, &s , locale)) != ((void *)0)))
117  {
118      rp = rp_backup;
119  }
120     }
121 case 'C':
122   do { int __n = 2; val = 0; while (*rp == ' ') ++rp; if (*rp < '0' || *rp > '9') return ((void *)0); do { val *= 10; val += *rp++ - '0'; } while (--__n > 0 && val * 10 <= 99 && *rp >= '0' && *rp <= '9'); if (val < 0 || val > 99) return ((void *)0); } while (0);
123 case 'F':
124   if (!(*("%Y-%m-%d") != '\0' && (rp = __strptime_internal (rp, ("%Y-%m-%d"), tm, &s , locale)) != ((void *)0)))
125   tm->tm_hour = val % 12;
126 }
127    }
128}
129char *
130__strptime_l (buf, format, tm , locale)
131     int buf;
132     int format;
133     int tm;
134     int locale;
135{
136}
137