1 /* PR middle-end/55150 */
2 /* { dg-do compile } */
3 /* { dg-require-effective-target fpic } */
4 /* { dg-options "-Os -g -fPIC" } */
5 
6 typedef unsigned char DES_cblock[8];
7  typedef struct DES_ks {
8  }
9  DES_key_schedule;
DES_ede3_cbcm_encrypt(const unsigned char * in,unsigned char * out,long length,DES_key_schedule * ks1,DES_key_schedule * ks2,DES_key_schedule * ks3,DES_cblock * ivec1,DES_cblock * ivec2,int enc)10  void DES_ede3_cbcm_encrypt (const unsigned char *in, unsigned char *out, 		       long length, DES_key_schedule * ks1, 		       DES_key_schedule * ks2, DES_key_schedule * ks3, 		       DES_cblock * ivec1, DES_cblock * ivec2, int enc) {
11    register unsigned long tout0, tout1, xor0, xor1, m0, m1;
12    register long l = length;
13    unsigned long tin[2];
14    unsigned char *iv1, *iv2;
15    iv1 = &(*ivec1)[0];
16    iv2 = &(*ivec2)[0];
17    if (enc)     {
18        (m0 = ((unsigned long) (*((iv1)++))), m0 |=        ((unsigned long) (*((iv1)++))) << 8L, m0 |=        ((unsigned long) (*((iv1)++))) << 16L, m0 |=        ((unsigned long) (*((iv1)++))) << 24L);
19        (m1 = ((unsigned long) (*((iv1)++))), m1 |=        ((unsigned long) (*((iv1)++))) << 8L, m1 |=        ((unsigned long) (*((iv1)++))) << 16L, m1 |=        ((unsigned long) (*((iv1)++))) << 24L);
20        (tout0 = ((unsigned long) (*((iv2)++))), tout0 |=        ((unsigned long) (*((iv2)++))) << 8L, tout0 |=        ((unsigned long) (*((iv2)++))) << 16L, tout0 |=        ((unsigned long) (*((iv2)++))) << 24L);
21        for (l -= 8;
22  l >= -7;
23  l -= 8) 	{
24  	  DES_encrypt1 (tin, ks3, 1);
25  	  DES_encrypt1 (tin, ks1, 1);
26  	}
27        (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 24L) & 0xff));
28        (*((iv1)++) = (unsigned char) (((m1)) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 24L) & 0xff));
29        (*((iv2)++) = (unsigned char) (((tout0)) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 24L) & 0xff));
30      }
31    else     {
32        (m0 = ((unsigned long) (*((iv1)++))), m0 |=        ((unsigned long) (*((iv1)++))) << 8L, m0 |=        ((unsigned long) (*((iv1)++))) << 16L, m0 |=        ((unsigned long) (*((iv1)++))) << 24L);
33        (xor1 = ((unsigned long) (*((iv2)++))), xor1 |=        ((unsigned long) (*((iv2)++))) << 8L, xor1 |=        ((unsigned long) (*((iv2)++))) << 16L, xor1 |=        ((unsigned long) (*((iv2)++))) << 24L);
34        for (l -= 8;
35  l >= -7;
36  l -= 8) 	{
37  	  DES_encrypt1 (tin, ks3, 1);
38  	  if (l < 0) 	    {
39  	      {
40  		switch (l + 8) 		  {
41  		  case 7: 		    *(--(out)) = (unsigned char) (((tout1) >> 16L) & 0xff);
42  		  case 6: 		    *(--(out)) = (unsigned char) (((tout1) >> 8L) & 0xff);
43  		  case 5: 		    *(--(out)) = (unsigned char) (((tout1)) & 0xff);
44  		  case 4: 		    *(--(out)) = (unsigned char) (((tout0) >> 24L) & 0xff);
45  		  case 1: 		    *(--(out)) = (unsigned char) (((tout0)) & 0xff);
46  		  }
47  	      };
48  	    }
49  	}
50        (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 24L) & 0xff));
51        (*((iv2)++) = (unsigned char) (((xor0)) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 24L) & 0xff));
52        (*((iv2)++) = (unsigned char) (((xor1)) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 24L) & 0xff));
53      }
54  }
55