1 /* { dg-do compile } */
2 /* { dg-options "-O3 -ftree-pre" } */
3 
4 typedef enum
5 {
6   ST_TiemanStyle,
7 }
8 BrailleDisplay;
9 static int pendingCommand;
10 static int currentModifiers;
11 typedef struct
12 {
13   int (*updateKeys) (BrailleDisplay * brl, int *keyPressed);
14 }
15 ProtocolOperations;
16 static const ProtocolOperations *protocol;
17 int
brl_readCommand(BrailleDisplay * brl)18 brl_readCommand (BrailleDisplay * brl)
19 {
20   unsigned long int keys;
21   int command;
22   int keyPressed;
23   unsigned char routingKeys[200];
24   int routingKeyCount;
25   signed char rightVerticalSensor;
26   if (pendingCommand != (-1))
27     {
28       return command;
29     }
30   if (!protocol->updateKeys (brl, &keyPressed))
31     {
32       if (rightVerticalSensor >= 0)
33         keys |= 1;
34       if ((routingKeyCount == 0) && keys)
35         {
36           if (currentModifiers)
37             {
38             doChord:switch (keys);
39             }
40           else
41             {
42             doCharacter:
43               command = 0X2200;
44               if (keys & 0X01UL)
45                 command |= 0001;
46               if (keys & 0X02UL)
47                 command |= 0002;
48               if (keys & 0X04UL)
49                 command |= 0004;
50               if (keys & 0X08UL)
51                 command |= 0010;
52               if (keys & 0X10UL)
53                 command |= 0020;
54               if (keys & 0X20UL)
55                 command |= 0040;
56               if (currentModifiers & (0X0010 | 0X0200))
57                 command |= 0100;
58               if (currentModifiers & 0X0040)
59                 command |= 0200;
60               if (currentModifiers & 0X0100)
61                 command |= 0X020000;
62               if (currentModifiers & 0X0400)
63                 command |= 0X080000;
64               if (currentModifiers & 0X0800)
65                 command |= 0X040000;
66             }
67           unsigned char key1 = routingKeys[0];
68           if (key1 == 0)
69             {
70             }
71           if (key1 == 1)
72             if (keys)
73               {
74                 currentModifiers |= 0X0010;
75                 goto doCharacter;
76               }
77         }
78     }
79   return command;
80 }
81