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