1 /* { dg-do compile } */
2 
3 struct Time {
4     long int sec;
5     long usec;
6 };
7 struct Flow {
8     unsigned short iif;
9     struct Time mtime;
10 };
11 struct NetFlow {
12     unsigned MaxFlows;
13     unsigned HeaderFields;
14     unsigned short *HeaderFormat;
15 };
16 static struct NetFlow *netflow;
17 static struct Time start_time;
18 static unsigned char emit_packet[1500];
cmpmtime(struct Time * t1,struct Time * t2)19 inline long int cmpmtime(struct Time *t1, struct Time *t2)
20 {
21   return (t1->sec - t2->sec) * 1000 + (t1->usec - t2->usec) / 1000;
22 }
fill(int fields,unsigned short * format,struct Flow * flow,void * p)23 static void fill(int fields, unsigned short *format,
24 		  struct Flow *flow, void *p)
25 {
26   int i;
27   for (i = 0; i < fields; i++)
28     if (format[i] == 21)
29       {
30 	unsigned int __v;
31 	__v = cmpmtime(&flow->mtime, &start_time);
32 	*((unsigned int *) p) = __v;
33       }
34 }
emit_thread()35 void emit_thread()
36 {
37   fill(netflow->HeaderFields, netflow->HeaderFormat, 0, &emit_packet);
38 }
39