/* This program is aimed to do the cuda implementation of DESnuts */

#include <cuda.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <inttypes.h>

/**********************************************************************/
/*                                                                    */
/*                            DES TABLES                              */
/*                                                                    */
/**********************************************************************/

#define MAX_THREADS_1D 32
#define MAX_BLOCKS_1D 256
#define CONSTANT_SIZE (sizeof(int) * 8 * 64)
__constant__ int S_TABLE[CONSTANT_SIZE];


/*
 *  S Tables: Introduce nonlinearity and avalanche
 */
static int table_DES_S[8][64] = {
    /* table S[0] */
    {   13,  1,  2, 15,  8, 13,  4,  8,  6, 10, 15,  3, 11,  7,  1,  4,
        10, 12,  9,  5,  3,  6, 14, 11,  5,  0,  0, 14, 12,  9,  7,  2,
        7,  2, 11,  1,  4, 14,  1,  7,  9,  4, 12, 10, 14,  8,  2, 13,
        0, 15,  6, 12, 10,  9, 13,  0, 15,  3,  3,  5,  5,  6,  8, 11  },
    /* table S[1] */
    {    4, 13, 11,  0,  2, 11, 14,  7, 15,  4,  0,  9,  8,  1, 13, 10,
        3, 14, 12,  3,  9,  5,  7, 12,  5,  2, 10, 15,  6,  8,  1,  6,
        1,  6,  4, 11, 11, 13, 13,  8, 12,  1,  3,  4,  7, 10, 14,  7,
        10,  9, 15,  5,  6,  0,  8, 15,  0, 14,  5,  2,  9,  3,  2, 12  },
    /* table S[2] */
    {   12, 10,  1, 15, 10,  4, 15,  2,  9,  7,  2, 12,  6,  9,  8,  5,
        0,  6, 13,  1,  3, 13,  4, 14, 14,  0,  7, 11,  5,  3, 11,  8,
        9,  4, 14,  3, 15,  2,  5, 12,  2,  9,  8,  5, 12, 15,  3, 10,
        7, 11,  0, 14,  4,  1, 10,  7,  1,  6, 13,  0, 11,  8,  6, 13  },
    /* table S[3] */
    {    2, 14, 12, 11,  4,  2,  1, 12,  7,  4, 10,  7, 11, 13,  6,  1,
        8,  5,  5,  0,  3, 15, 15, 10, 13,  3,  0,  9, 14,  8,  9,  6,
        4, 11,  2,  8,  1, 12, 11,  7, 10,  1, 13, 14,  7,  2,  8, 13,
        15,  6,  9, 15, 12,  0,  5,  9,  6, 10,  3,  4,  0,  5, 14,  3  },
    /* table S[4] */
    {    7, 13, 13,  8, 14, 11,  3,  5,  0,  6,  6, 15,  9,  0, 10,  3,
        1,  4,  2,  7,  8,  2,  5, 12, 11,  1, 12, 10,  4, 14, 15,  9,
        10,  3,  6, 15,  9,  0,  0,  6, 12, 10, 11,  1,  7, 13, 13,  8,
        15,  9,  1,  4,  3,  5, 14, 11,  5, 12,  2,  7,  8,  2,  4, 14  },
    /* table S[5] */
    {   10, 13,  0,  7,  9,  0, 14,  9,  6,  3,  3,  4, 15,  6,  5, 10,
        1,  2, 13,  8, 12,  5,  7, 14, 11, 12,  4, 11,  2, 15,  8,  1,
        13,  1,  6, 10,  4, 13,  9,  0,  8,  6, 15,  9,  3,  8,  0,  7,
        11,  4,  1, 15,  2, 14, 12,  3,  5, 11, 10,  5, 14,  2,  7, 12  },
    /* table S[6] */
    {   15,  3,  1, 13,  8,  4, 14,  7,  6, 15, 11,  2,  3,  8,  4, 14,
        9, 12,  7,  0,  2,  1, 13, 10, 12,  6,  0,  9,  5, 11, 10,  5,
        0, 13, 14,  8,  7, 10, 11,  1, 10,  3,  4, 15, 13,  4,  1,  2,
        5, 11,  8,  6, 12,  7,  6, 12,  9,  0,  3,  5,  2, 14, 15,  9  },
    /* table S[7] */
    {   14,  0,  4, 15, 13,  7,  1,  4,  2, 14, 15,  2, 11, 13,  8,  1,
        3, 10, 10,  6,  6, 12, 12, 11,  5,  9,  9,  5,  0,  3,  7,  8,
        4, 15,  1, 12, 14,  8,  8,  2, 13,  4,  6,  9,  2,  1, 11,  7,
        15,  5, 12, 11,  9,  3,  7, 14,  3, 10, 10,  0,  5,  6,  0, 13  }
};

/*
void print_bits_array(uint64_t n) {
    printf("%lX\n", n);
}

void print_bits(uint64_t n) {
    for (int i = 0 ; i < 64; i++) {
        if (i == 32)
            printf("\n");
        printf("%d", ((n) & 0x8000000000000000) >> 63);
        n <<= 1;
    }
    printf("\n");
    printf("\n");
}
*/
        
#define MASK56(n) ((n) & 0x00FFFFFFFFFFFFFF)
#define MASK48(n) ((n) & 0x0000FFFFFFFFFFFF)


#define COMPUTE_ROUND_KEY(roundKey, key)        \
    roundKey |= ((key & ((1UL) << 0)) << (27));     \
    roundKey |= ((key & ((1UL) << 1)) << (18));     \
    roundKey |= ((key & ((1UL) << 2)) << (9));  \
    roundKey |= ((key & ((1UL) << 3)) << (28));     \
    roundKey |= ((key & ((1UL) << 4)) << (35));     \
    roundKey |= ((key & ((1UL) << 5)) << (42));     \
    roundKey |= ((key & ((1UL) << 6)) << (49));     \
    roundKey |= ((key & ((1UL) << 7)) << (19));     \
    roundKey |= ((key & ((1UL) << 8)) << (10));     \
    roundKey |= ((key & ((1UL) << 9)) << (1));  \
    roundKey |= ((key & ((1UL) << 10)) << (20));    \
    roundKey |= ((key & ((1UL) << 11)) << (27));    \
    roundKey |= ((key & ((1UL) << 12)) << (34));    \
    roundKey |= ((key & ((1UL) << 13)) << (41));    \
    roundKey |= ((key & ((1UL) << 14)) << (11));    \
    roundKey |= ((key & ((1UL) << 15)) << (2));     \
    roundKey |= ((key & ((1UL) << 16)) >> (7));     \
    roundKey |= ((key & ((1UL) << 17)) << (12));    \
    roundKey |= ((key & ((1UL) << 18)) << (19));    \
    roundKey |= ((key & ((1UL) << 19)) << (26));    \
    roundKey |= ((key & ((1UL) << 20)) << (33));    \
    roundKey |= ((key & ((1UL) << 21)) << (3));     \
    roundKey |= ((key & ((1UL) << 22)) >> (6));     \
    roundKey |= ((key & ((1UL) << 23)) >> (15));    \
    roundKey |= ((key & ((1UL) << 24)) << (4));     \
    roundKey |= ((key & ((1UL) << 25)) << (11));    \
    roundKey |= ((key & ((1UL) << 26)) << (18));    \
    roundKey |= ((key & ((1UL) << 27)) << (25));    \
    roundKey |= ((key & ((1UL) << 28)) >> (5));     \
    roundKey |= ((key & ((1UL) << 29)) >> (14));    \
    roundKey |= ((key & ((1UL) << 30)) >> (23));    \
    roundKey |= ((key & ((1UL) << 31)) >> (28));    \
    roundKey |= ((key & ((1UL) << 32)) << (3));     \
    roundKey |= ((key & ((1UL) << 33)) << (10));    \
    roundKey |= ((key & ((1UL) << 34)) << (17));    \
    roundKey |= ((key & ((1UL) << 35)) >> (13));    \
    roundKey |= ((key & ((1UL) << 36)) >> (22));    \
    roundKey |= ((key & ((1UL) << 37)) >> (31));    \
    roundKey |= ((key & ((1UL) << 38)) >> (36));    \
    roundKey |= ((key & ((1UL) << 39)) >> (5));     \
    roundKey |= ((key & ((1UL) << 40)) << (2));     \
    roundKey |= ((key & ((1UL) << 41)) << (9));     \
    roundKey |= ((key & ((1UL) << 42)) >> (21));    \
    roundKey |= ((key & ((1UL) << 43)) >> (30));    \
    roundKey |= ((key & ((1UL) << 44)) >> (39));    \
    roundKey |= ((key & ((1UL) << 45)) >> (44));    \
    roundKey |= ((key & ((1UL) << 46)) >> (13));    \
    roundKey |= ((key & ((1UL) << 47)) >> (6));     \
    roundKey |= ((key & ((1UL) << 48)) << (1));     \
    roundKey |= ((key & ((1UL) << 49)) >> (29));    \
    roundKey |= ((key & ((1UL) << 50)) >> (38));    \
    roundKey |= ((key & ((1UL) << 51)) >> (47));    \
    roundKey |= ((key & ((1UL) << 52)) >> (52));    \
    roundKey |= ((key & ((1UL) << 53)) >> (21));    \
    roundKey |= ((key & ((1UL) << 54)) >> (14));    \
    roundKey |= ((key & ((1UL) << 55)) >> (7));     \


#define COMPUTE_IP(L, R, in)            \
    temp = 0UL;                    \
    temp |= ((in & ((1UL) << 63)) >> (39));  \
    temp |= ((in & ((1UL) << 62)) >> (6));  \
    temp |= ((in & ((1UL) << 61)) >> (45));     \
    temp |= ((in & ((1UL) << 60)) >> (12));     \
    temp |= ((in & ((1UL) << 59)) >> (51));     \
    temp |= ((in & ((1UL) << 58)) >> (18));     \
    temp |= ((in & ((1UL) << 57)) >> (57));     \
    temp |= ((in & ((1UL) << 56)) >> (24));     \
    temp |= ((in & ((1UL) << 55)) >> (30));     \
    temp |= ((in & ((1UL) << 54)) << (3));  \
    temp |= ((in & ((1UL) << 53)) >> (36));     \
    temp |= ((in & ((1UL) << 52)) >> (3));  \
    temp |= ((in & ((1UL) << 51)) >> (42));     \
    temp |= ((in & ((1UL) << 50)) >> (9));  \
    temp |= ((in & ((1UL) << 49)) >> (48));     \
    temp |= ((in & ((1UL) << 48)) >> (15));     \
    temp |= ((in & ((1UL) << 47)) >> (21));     \
    temp |= ((in & ((1UL) << 46)) << (12));     \
    temp |= ((in & ((1UL) << 45)) >> (27));     \
    temp |= ((in & ((1UL) << 44)) << (6));  \
    temp |= ((in & ((1UL) << 43)) >> (33));     \
    temp |= ((in & ((1UL) << 42)) << (0));  \
    temp |= ((in & ((1UL) << 41)) >> (39));     \
    temp |= ((in & ((1UL) << 40)) >> (6));  \
    temp |= ((in & ((1UL) << 39)) >> (12));     \
    temp |= ((in & ((1UL) << 38)) << (21));     \
    temp |= ((in & ((1UL) << 37)) >> (18));     \
    temp |= ((in & ((1UL) << 36)) << (15));     \
    temp |= ((in & ((1UL) << 35)) >> (24));     \
    temp |= ((in & ((1UL) << 34)) << (9));  \
    temp |= ((in & ((1UL) << 33)) >> (30));     \
    temp |= ((in & ((1UL) << 32)) << (3));  \
    temp |= ((in & ((1UL) << 31)) >> (3));  \
    temp |= ((in & ((1UL) << 30)) << (30));     \
    temp |= ((in & ((1UL) << 29)) >> (9));  \
    temp |= ((in & ((1UL) << 28)) << (24));     \
    temp |= ((in & ((1UL) << 27)) >> (15));     \
    temp |= ((in & ((1UL) << 26)) << (18));     \
    temp |= ((in & ((1UL) << 25)) >> (21));     \
    temp |= ((in & ((1UL) << 24)) << (12));     \
    temp |= ((in & ((1UL) << 23)) << (6));  \
    temp |= ((in & ((1UL) << 22)) << (39));     \
    temp |= ((in & ((1UL) << 21)) << (0));  \
    temp |= ((in & ((1UL) << 20)) << (33));     \
    temp |= ((in & ((1UL) << 19)) >> (6));  \
    temp |= ((in & ((1UL) << 18)) << (27));     \
    temp |= ((in & ((1UL) << 17)) >> (12));     \
    temp |= ((in & ((1UL) << 16)) << (21));     \
    temp |= ((in & ((1UL) << 15)) << (15));     \
    temp |= ((in & ((1UL) << 14)) << (48));     \
    temp |= ((in & ((1UL) << 13)) << (9));  \
    temp |= ((in & ((1UL) << 12)) << (42));     \
    temp |= ((in & ((1UL) << 11)) << (3));  \
    temp |= ((in & ((1UL) << 10)) << (36));     \
    temp |= ((in & ((1UL) << 9)) >> (3));   \
    temp |= ((in & ((1UL) << 8)) << (30));  \
    temp |= ((in & ((1UL) << 7)) << (24));  \
    temp |= ((in & ((1UL) << 6)) << (57));  \
    temp |= ((in & ((1UL) << 5)) << (18));  \
    temp |= ((in & ((1UL) << 4)) << (51));  \
    temp |= ((in & ((1UL) << 3)) << (12));  \
    temp |= ((in & ((1UL) << 2)) << (45));  \
    temp |= ((in & ((1UL) << 1)) << (6));   \
    temp |= ((in & ((1UL) << 0)) << (39));  \
    L = (temp >> 32) & 0xFFFFFFFF;            \
    R = (temp) & 0xFFFFFFFF;                  \


#define COMPUTE_FP(out, L, R)                   \
    temp = L;                                   \
    temp = (temp << 32) | R;                        \
    out |= ((temp & ((1UL) << 63)) >> (57));    \
    out |= ((temp & ((1UL) << 62)) >> (48));    \
    out |= ((temp & ((1UL) << 61)) >> (39));    \
    out |= ((temp & ((1UL) << 60)) >> (30));    \
    out |= ((temp & ((1UL) << 59)) >> (21));    \
    out |= ((temp & ((1UL) << 58)) >> (12));    \
    out |= ((temp & ((1UL) << 57)) >> (3));     \
    out |= ((temp & ((1UL) << 56)) << (6));     \
    out |= ((temp & ((1UL) << 55)) >> (51));    \
    out |= ((temp & ((1UL) << 54)) >> (42));    \
    out |= ((temp & ((1UL) << 53)) >> (33));    \
    out |= ((temp & ((1UL) << 52)) >> (24));    \
    out |= ((temp & ((1UL) << 51)) >> (15));    \
    out |= ((temp & ((1UL) << 50)) >> (6));     \
    out |= ((temp & ((1UL) << 49)) << (3));     \
    out |= ((temp & ((1UL) << 48)) << (12));    \
    out |= ((temp & ((1UL) << 47)) >> (45));    \
    out |= ((temp & ((1UL) << 46)) >> (36));    \
    out |= ((temp & ((1UL) << 45)) >> (27));    \
    out |= ((temp & ((1UL) << 44)) >> (18));    \
    out |= ((temp & ((1UL) << 43)) >> (9));     \
    out |= ((temp & ((1UL) << 42)) << (0));     \
    out |= ((temp & ((1UL) << 41)) << (9));     \
    out |= ((temp & ((1UL) << 40)) << (18));    \
    out |= ((temp & ((1UL) << 39)) >> (39));    \
    out |= ((temp & ((1UL) << 38)) >> (30));    \
    out |= ((temp & ((1UL) << 37)) >> (21));    \
    out |= ((temp & ((1UL) << 36)) >> (12));    \
    out |= ((temp & ((1UL) << 35)) >> (3));     \
    out |= ((temp & ((1UL) << 34)) << (6));     \
    out |= ((temp & ((1UL) << 33)) << (15));    \
    out |= ((temp & ((1UL) << 32)) << (24));    \
    out |= ((temp & ((1UL) << 31)) >> (24));    \
    out |= ((temp & ((1UL) << 30)) >> (15));    \
    out |= ((temp & ((1UL) << 29)) >> (6));     \
    out |= ((temp & ((1UL) << 28)) << (3));     \
    out |= ((temp & ((1UL) << 27)) << (12));    \
    out |= ((temp & ((1UL) << 26)) << (21));    \
    out |= ((temp & ((1UL) << 25)) << (30));    \
    out |= ((temp & ((1UL) << 24)) << (39));    \
    out |= ((temp & ((1UL) << 23)) >> (18));    \
    out |= ((temp & ((1UL) << 22)) >> (9));     \
    out |= ((temp & ((1UL) << 21)) << (0));     \
    out |= ((temp & ((1UL) << 20)) << (9));     \
    out |= ((temp & ((1UL) << 19)) << (18));    \
    out |= ((temp & ((1UL) << 18)) << (27));    \
    out |= ((temp & ((1UL) << 17)) << (36));    \
    out |= ((temp & ((1UL) << 16)) << (45));    \
    out |= ((temp & ((1UL) << 15)) >> (12));    \
    out |= ((temp & ((1UL) << 14)) >> (3));     \
    out |= ((temp & ((1UL) << 13)) << (6));     \
    out |= ((temp & ((1UL) << 12)) << (15));    \
    out |= ((temp & ((1UL) << 11)) << (24));    \
    out |= ((temp & ((1UL) << 10)) << (33));    \
    out |= ((temp & ((1UL) << 9)) << (42));     \
    out |= ((temp & ((1UL) << 8)) << (51));     \
    out |= ((temp & ((1UL) << 7)) >> (6));  \
    out |= ((temp & ((1UL) << 6)) << (3));  \
    out |= ((temp & ((1UL) << 5)) << (12));     \
    out |= ((temp & ((1UL) << 4)) << (21));     \
    out |= ((temp & ((1UL) << 3)) << (30));     \
    out |= ((temp & ((1UL) << 2)) << (39));     \
    out |= ((temp & ((1UL) << 1)) << (48));     \
    out |= ((temp & ((1UL) << 0)) << (57));     \

#define COMPUTE_P(out, in)  \
    out |= ((in & ((1UL) << 0)) << (11));   \
    out |= ((in & ((1UL) << 1)) << (16));   \
    out |= ((in & ((1UL) << 2)) << (3));    \
    out |= ((in & ((1UL) << 3)) << (24));   \
    out |= ((in & ((1UL) << 4)) << (21));   \
    out |= ((in & ((1UL) << 5)) << (5));    \
    out |= ((in & ((1UL) << 6)) << (14));   \
    out |= ((in & ((1UL) << 7)) >> (7));    \
    out |= ((in & ((1UL) << 8)) << (5));    \
    out |= ((in & ((1UL) << 9)) << (12));   \
    out |= ((in & ((1UL) << 10)) >> (7));   \
    out |= ((in & ((1UL) << 11)) << (17));  \
    out |= ((in & ((1UL) << 12)) << (17));  \
    out |= ((in & ((1UL) << 13)) >> (6));   \
    out |= ((in & ((1UL) << 14)) << (4));   \
    out |= ((in & ((1UL) << 15)) << (9));   \
    out |= ((in & ((1UL) << 16)) << (15));  \
    out |= ((in & ((1UL) << 17)) << (5));   \
    out |= ((in & ((1UL) << 18)) >> (6));   \
    out |= ((in & ((1UL) << 19)) >> (13));  \
    out |= ((in & ((1UL) << 20)) << (6));   \
    out |= ((in & ((1UL) << 21)) >> (19));  \
    out |= ((in & ((1UL) << 22)) >> (6));   \
    out |= ((in & ((1UL) << 23)) >> (15));  \
    out |= ((in & ((1UL) << 24)) >> (10));  \
    out |= ((in & ((1UL) << 25)) << (5));   \
    out |= ((in & ((1UL) << 26)) >> (22));  \
    out |= ((in & ((1UL) << 27)) >> (8));   \
    out |= ((in & ((1UL) << 28)) >> (27));  \
    out |= ((in & ((1UL) << 29)) >> (20));  \
    out |= ((in & ((1UL) << 30)) >> (15));  \
    out |= ((in & ((1UL) << 31)) >> (8));   \


#define COMPUTE_EXPANSION_E(expB, Rin)        \
    expB |= ((R & ((1UL) << 31)) >> (31));  \
    expB |= ((R & ((1UL) << 0)) << (1));    \
    expB |= ((R & ((1UL) << 1)) << (1));    \
    expB |= ((R & ((1UL) << 2)) << (1));    \
    expB |= ((R & ((1UL) << 3)) << (1));    \
    expB |= ((R & ((1UL) << 4)) << (1));    \
    expB |= ((R & ((1UL) << 3)) << (3));    \
    expB |= ((R & ((1UL) << 4)) << (3));    \
    expB |= ((R & ((1UL) << 5)) << (3));    \
    expB |= ((R & ((1UL) << 6)) << (3));    \
    expB |= ((R & ((1UL) << 7)) << (3));    \
    expB |= ((R & ((1UL) << 8)) << (3));    \
    expB |= ((R & ((1UL) << 7)) << (5));    \
    expB |= ((R & ((1UL) << 8)) << (5));    \
    expB |= ((R & ((1UL) << 9)) << (5));    \
    expB |= ((R & ((1UL) << 10)) << (5));   \
    expB |= ((R & ((1UL) << 11)) << (5));   \
    expB |= ((R & ((1UL) << 12)) << (5));   \
    expB |= ((R & ((1UL) << 11)) << (7));   \
    expB |= ((R & ((1UL) << 12)) << (7));   \
    expB |= ((R & ((1UL) << 13)) << (7));   \
    expB |= ((R & ((1UL) << 14)) << (7));   \
    expB |= ((R & ((1UL) << 15)) << (7));   \
    expB |= ((R & ((1UL) << 16)) << (7));   \
    expB |= ((R & ((1UL) << 15)) << (9));   \
    expB |= ((R & ((1UL) << 16)) << (9));   \
    expB |= ((R & ((1UL) << 17)) << (9));   \
    expB |= ((R & ((1UL) << 18)) << (9));   \
    expB |= ((R & ((1UL) << 19)) << (9));   \
    expB |= ((R & ((1UL) << 20)) << (9));   \
    expB |= ((R & ((1UL) << 19)) << (11));  \
    expB |= ((R & ((1UL) << 20)) << (11));  \
    expB |= ((R & ((1UL) << 21)) << (11));  \
    expB |= ((R & ((1UL) << 22)) << (11));  \
    expB |= ((R & ((1UL) << 23)) << (11));  \
    expB |= ((R & ((1UL) << 24)) << (11));  \
    expB |= ((R & ((1UL) << 23)) << (13));  \
    expB |= ((R & ((1UL) << 24)) << (13));  \
    expB |= ((R & ((1UL) << 25)) << (13));  \
    expB |= ((R & ((1UL) << 26)) << (13));  \
    expB |= ((R & ((1UL) << 27)) << (13));  \
    expB |= ((R & ((1UL) << 28)) << (13));  \
    expB |= ((R & ((1UL) << 27)) << (15));  \
    expB |= ((R & ((1UL) << 28)) << (15));  \
    expB |= ((R & ((1UL) << 29)) << (15));  \
    expB |= ((R & ((1UL) << 30)) << (15));  \
    expB |= ((R & ((1UL) << 31)) << (15));  \
    expB |= ((R & ((1UL) << 0)) << (47));   \


#define COMPUTE_PC2(subkey, roundKey)       \
    subkey |= ((roundKey & ((1UL) << 24)) >> (24));     \
    subkey |= ((roundKey & ((1UL) << 27)) >> (26));     \
    subkey |= ((roundKey & ((1UL) << 20)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 6)) >> (3));   \
    subkey |= ((roundKey & ((1UL) << 14)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 10)) >> (5));  \
    subkey |= ((roundKey & ((1UL) << 3)) << (3));   \
    subkey |= ((roundKey & ((1UL) << 22)) >> (15));     \
    subkey |= ((roundKey & ((1UL) << 0)) << (8));   \
    subkey |= ((roundKey & ((1UL) << 17)) >> (8));  \
    subkey |= ((roundKey & ((1UL) << 7)) << (3));   \
    subkey |= ((roundKey & ((1UL) << 12)) >> (1));  \
    subkey |= ((roundKey & ((1UL) << 8)) << (4));   \
    subkey |= ((roundKey & ((1UL) << 23)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 11)) << (3));  \
    subkey |= ((roundKey & ((1UL) << 5)) << (10));  \
    subkey |= ((roundKey & ((1UL) << 16)) >> (0));  \
    subkey |= ((roundKey & ((1UL) << 26)) >> (9));  \
    subkey |= ((roundKey & ((1UL) << 1)) << (17));  \
    subkey |= ((roundKey & ((1UL) << 9)) << (10));  \
    subkey |= ((roundKey & ((1UL) << 19)) << (1));  \
    subkey |= ((roundKey & ((1UL) << 25)) >> (4));  \
    subkey |= ((roundKey & ((1UL) << 4)) << (18));  \
    subkey |= ((roundKey & ((1UL) << 15)) << (8));  \
    subkey |= ((roundKey & ((1UL) << 54)) >> (30));     \
    subkey |= ((roundKey & ((1UL) << 43)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 36)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 29)) >> (2));  \
    subkey |= ((roundKey & ((1UL) << 49)) >> (21));     \
    subkey |= ((roundKey & ((1UL) << 40)) >> (11));     \
    subkey |= ((roundKey & ((1UL) << 48)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 30)) << (1));  \
    subkey |= ((roundKey & ((1UL) << 52)) >> (20));     \
    subkey |= ((roundKey & ((1UL) << 44)) >> (11));     \
    subkey |= ((roundKey & ((1UL) << 37)) >> (3));  \
    subkey |= ((roundKey & ((1UL) << 33)) << (2));  \
    subkey |= ((roundKey & ((1UL) << 46)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 35)) << (2));  \
    subkey |= ((roundKey & ((1UL) << 50)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 41)) >> (2));  \
    subkey |= ((roundKey & ((1UL) << 28)) << (12));     \
    subkey |= ((roundKey & ((1UL) << 53)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 51)) >> (9));  \
    subkey |= ((roundKey & ((1UL) << 55)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 32)) << (12));     \
    subkey |= ((roundKey & ((1UL) << 45)) >> (0));  \
    subkey |= ((roundKey & ((1UL) << 39)) << (7));  \
    subkey |= ((roundKey & ((1UL) << 42)) << (5));  \


#define COMPUTES_LOOKUP(k, sout, expandedBlock)     \
    sout |= S_TABLE[k * 64 + ((expandedBlock >> (6 * k)) & 0x3F)] << (4 * k);      \

/* This is the host code
#define COMPUTES_LOOKUP(k, sout, expandedBlock)     \
    sout |= table_DES_S[k][(expandedBlock >> (6 * k)) & 0x3F] << (4 * k);      \
*/

/*
uint32_t COMPUTE_F(uint32_t fout, uint32_t R, uint64_t roundKey) {
    uint64_t expandedBlock = 0UL, subkey = 0UL;
    uint32_t sout = 0;
    int i, k;

    COMPUTE_EXPANSION_E(expandedBlock, R)

    printf("expanded E is : \n");
    print_bits_array(expandedBlock);

    COMPUTE_PC2(subkey, roundKey)

    printf("subkey is :\n");
    print_bits_array(subkey);

    expandedBlock ^= subkey;
    // Mask expandedBlock
    expandedBlock = MASK48(expandedBlock);
    printf("Expanded E is :\n");
    print_bits_array(expandedBlock);

    for (k = 0; k < 8; k++) {
        COMPUTES_LOOKUP(k, sout, expandedBlock)

        printf("sout @ %d is :\n", k);
        print_bits_array(sout);
    }

    COMPUTE_P(fout, sout)

    printf("fout is :\n");
    print_bits_array(fout);
    printf("sout is :\n");
    print_bits_array(sout);

    return fout;
}
*/


#define ROTATE_ROUND_KEY_LEFT(roundK)         \
    uint64_t bit27 = ((roundK & ((1UL) << 27)) >> 27);\
    uint64_t bit55 = ((roundK & ((1UL) << 55)) >> 27);\
    roundK <<= 1;                             \
    temp = roundK & 0x00FFFFFFEFFFFFFE;            \
    roundK = temp | bit27 | bit55;           \




#define EXCHANGE_L_AND_R(L, R)                  \
    temp = L;                                   \
    L = R;                                      \
    R = temp;                                   \
    

__global__ void EncryptDES_device(uint64_t in, uint64_t expected, uint64_t* result, uint64_t bound) {

    int blockId = blockIdx.x + blockIdx.y * gridDim.x; 
    int threadId = blockId * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
    uint64_t key = threadId * bound;
    uint64_t counter = 0;
    
    while (counter != bound) {

        uint32_t R = 0, L = 0; 
        uint64_t roundKey = 0UL, out = 0UL, temp = 0UL;

        COMPUTE_ROUND_KEY(roundKey, key)

        COMPUTE_IP(L, R, in)

        for (int round = 0; round < 16; round++) {
            uint64_t expandedBlock = 0UL, subkey = 0UL;
            uint32_t sout = 0;
            uint32_t fout = 0;

            ROTATE_ROUND_KEY_LEFT(roundKey)

            if (round != 0 && round != 1 && round != 8 && round != 15) {
                ROTATE_ROUND_KEY_LEFT(roundKey)
            }


            COMPUTE_EXPANSION_E(expandedBlock, R)

            COMPUTE_PC2(subkey, roundKey)


            expandedBlock ^= subkey;
            expandedBlock = MASK48(expandedBlock);

            for (int i = 0; i < 8; i++) {
                COMPUTES_LOOKUP(i, sout, expandedBlock)
            }

            COMPUTE_P(fout, sout)

                L ^= fout;

            EXCHANGE_L_AND_R(L, R)

        }
        EXCHANGE_L_AND_R(L, R)

        COMPUTE_FP(out, L, R)

        if (out == expected) {
            *result = out;
             // asm("trap;");
        }
        counter++;
        key++;
    }
    __syncthreads();
}

/*
void EncryptDES_host(uint64_t key, uint64_t in, uint64_t expected) {
    uint32_t R = 0, L = 0; 
    uint64_t roundKey = 0UL, out = 0UL, temp = 0UL;
    
    printf("sizeof(unsigned long long) is %d\n", sizeof(unsigned long long));

    COMPUTE_ROUND_KEY(roundKey, key)
    
    printf("roundKey is: \n");
    print_bits_array(roundKey);


    COMPUTE_IP(L, R, in)
    
    printf("after IP is: \n");
    printf("\t L:\n");
    print_bits_array(L);
    printf("\t R:\n");
    print_bits_array(R);

    for (int round = 0; round < 16; round++) {
        uint64_t expandedBlock = 0UL, subkey = 0UL;
        uint32_t sout = 0;
        uint32_t fout = 0;

        printf("------------------------- ROUND %d ----------------------\n", round);
    

        ROTATE_ROUND_KEY_LEFT(roundKey)
        
        printf("\t roundKey:\n");
        print_bits_array(roundKey);

        if (round != 0 && round != 1 && round != 8 && round != 15) {
            ROTATE_ROUND_KEY_LEFT(roundKey)
        }


        COMPUTE_EXPANSION_E(expandedBlock, R)

        printf("expanded E is : \n");
        print_bits_array(expandedBlock);

        COMPUTE_PC2(subkey, roundKey)

        printf("subkey is :\n");
        print_bits_array(subkey);

        expandedBlock ^= subkey;
        // Mask expandedBlock
        expandedBlock = MASK48(expandedBlock);
        printf("Expanded E is :\n");
        print_bits_array(expandedBlock);

        for (int i = 0; i < 8; i++) {
               Comment out for compilation of the device code

            COMPUTES_LOOKUP(i, sout, expandedBlock)
            printf("sout @ %d is :\n", i);
            print_bits_array(sout);
        }

        COMPUTE_P(fout, sout)

        printf("fout is :\n");
        print_bits_array(fout);
        printf("sout is :\n");
        print_bits_array(sout);

        printf("f is : \n");
        print_bits_array(fout);

        L ^= fout;

        printf("L^f is : \n");
        print_bits_array(L);
        
        EXCHANGE_L_AND_R(L, R)

        printf("------------------------- ROUND %d end ------------------\n", round);
         
    }
    EXCHANGE_L_AND_R(L, R)

    COMPUTE_FP(out, L, R)
    
    printf("FP out is \n");
    print_bits_array(out);

}
*/


int main(int argc, char **argv) {

    uint64_t random_o = 0xF77D7F53F77D7F53;
    // uint64_t random_k = 0x2FEABF912FEABF;
    uint64_t expected = 0xDF86B0B30BD2530A;

    cudaEvent_t start, stop;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);
    float milliseconds = 0;

    uint64_t *result_host = (uint64_t *)calloc(1, sizeof(uint64_t));
    uint64_t *result_device;
    cudaMalloc(&result_device, sizeof(uint64_t));


    cudaMemcpy(result_device, result_host, sizeof(uint64_t),  cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(S_TABLE, table_DES_S, CONSTANT_SIZE);

    int threads = MAX_THREADS_1D / 2;
    int blocks = (MAX_BLOCKS_1D - 1);

    uint64_t overall_total = 0x0FFFFFFFFFFFFFFFULL;
    uint64_t target_total = 0xFFFFFFFFFFULL;

    dim3 dimGrid(blocks, blocks);
    dim3 dimBlock(threads, threads);

    cudaEventRecord(start, 0);
    cudaEventSynchronize(start);

    EncryptDES_device<<<dimGrid, dimBlock>>>(random_o, expected, result_device, (target_total / (blocks * blocks * threads * threads)));
    cudaDeviceSynchronize();

    cudaEventRecord(stop);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&milliseconds, start, stop);

    printf("Cuda Execution Report: \n");
    printf("Targetting number of testing key - %" PRIu64 "\n", target_total);
    printf("Time spent %0.8f ms\n", milliseconds);
    printf("\n");
    printf("Estimated time to crack DES is %0.8f ms\n", (overall_total * 1.0 / target_total) * milliseconds);

    cudaMemcpy(result_host, result_device, sizeof(uint64_t), cudaMemcpyDeviceToHost);

    if (*result_host != 0x0)
        printf("Key found: %lX\n", *result_host);


    free(result_host);
    cudaFree(result_device);
    cudaEventDestroy(start);
    cudaEventDestroy(stop);

    return 0;
}


	.file	"tmpxft_00242abd_00000000-6_des_cuda.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm
	.type	_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm, @function
_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm:
.LFB2052:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17EncryptDES_devicemmPmm(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2052:
	.size	_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm, .-_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm
	.globl	_Z17EncryptDES_devicemmPmm
	.type	_Z17EncryptDES_devicemmPmm, @function
_Z17EncryptDES_devicemmPmm:
.LFB2053:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm
	.cfi_endproc
.LFE2053:
	.size	_Z17EncryptDES_devicemmPmm, .-_Z17EncryptDES_devicemmPmm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"Cuda Execution Report: \n"
.LC2:
	.string	"Targetting number of testing key - %lu\n"
.LC3:
	.string	"Time spent %0.8f ms\n"
.LC4:
	.string	"\n"
.LC6:
	.string	"Estimated time to crack DES is %0.8f ms\n"
.LC7:
	.string	"Key found: %lX\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	16(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$8, %esi
	movl	$1, %edi
	movl	$0x00000000, 4(%rsp)
	call	calloc@PLT
	leaq	24(%rsp), %rdi
	movl	$8, %esi
	movq	%rax, %rbx
	call	cudaMalloc@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$8, %edx
	call	cudaMemcpy@PLT
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movl	$2048, %edx
	leaq	_ZL11table_DES_S(%rip), %rsi
	leaq	_ZL7S_TABLE(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$1095216660735, %rax
	movq	%rax, 32(%rsp)
	movabsq	$68719476752, %rax
	movl	$1, 40(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	cudaEventRecord@PLT
	movq	8(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	52(%rsp), %ecx
	movl	40(%rsp), %esi
	xorl	%r9d, %r9d
	movq	44(%rsp), %rdx
	movq	32(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	movq	24(%rsp), %rdx
	movl	$66051, %ecx
	movabsq	$-2339988673328426230, %rsi
	movabsq	$-613193975641309357, %rdi
	call	_Z40__device_stub__Z17EncryptDES_devicemmPmmmmPmm
.L9:
	call	cudaDeviceSynchronize@PLT
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	16(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	4(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movabsq	$1099511627775, %rdx
	call	__printf_chk@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	4(%rsp), %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	cvtss2sd	4(%rsp), %xmm0
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	mulsd	.LC5(%rip), %xmm0
	movb	$1, %al
	call	__printf_chk@PLT
	movq	24(%rsp), %rsi
	movl	$8, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	(%rbx), %rdx
	testq	%rdx, %rdx
	je	.L10
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L10:
	movq	%rbx, %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	16(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC8:
	.string	"_Z17EncryptDES_devicemmPmm"
.LC9:
	.string	"S_TABLE"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2055:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17EncryptDES_devicemmPmm(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC9(%rip), %rdx
	movl	$8192, %r9d
	leaq	_ZL7S_TABLE(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2055:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.data
	.align 32
	.type	_ZL11table_DES_S, @object
	.size	_ZL11table_DES_S, 2048
_ZL11table_DES_S:
	.long	13
	.long	1
	.long	2
	.long	15
	.long	8
	.long	13
	.long	4
	.long	8
	.long	6
	.long	10
	.long	15
	.long	3
	.long	11
	.long	7
	.long	1
	.long	4
	.long	10
	.long	12
	.long	9
	.long	5
	.long	3
	.long	6
	.long	14
	.long	11
	.long	5
	.long	0
	.long	0
	.long	14
	.long	12
	.long	9
	.long	7
	.long	2
	.long	7
	.long	2
	.long	11
	.long	1
	.long	4
	.long	14
	.long	1
	.long	7
	.long	9
	.long	4
	.long	12
	.long	10
	.long	14
	.long	8
	.long	2
	.long	13
	.long	0
	.long	15
	.long	6
	.long	12
	.long	10
	.long	9
	.long	13
	.long	0
	.long	15
	.long	3
	.long	3
	.long	5
	.long	5
	.long	6
	.long	8
	.long	11
	.long	4
	.long	13
	.long	11
	.long	0
	.long	2
	.long	11
	.long	14
	.long	7
	.long	15
	.long	4
	.long	0
	.long	9
	.long	8
	.long	1
	.long	13
	.long	10
	.long	3
	.long	14
	.long	12
	.long	3
	.long	9
	.long	5
	.long	7
	.long	12
	.long	5
	.long	2
	.long	10
	.long	15
	.long	6
	.long	8
	.long	1
	.long	6
	.long	1
	.long	6
	.long	4
	.long	11
	.long	11
	.long	13
	.long	13
	.long	8
	.long	12
	.long	1
	.long	3
	.long	4
	.long	7
	.long	10
	.long	14
	.long	7
	.long	10
	.long	9
	.long	15
	.long	5
	.long	6
	.long	0
	.long	8
	.long	15
	.long	0
	.long	14
	.long	5
	.long	2
	.long	9
	.long	3
	.long	2
	.long	12
	.long	12
	.long	10
	.long	1
	.long	15
	.long	10
	.long	4
	.long	15
	.long	2
	.long	9
	.long	7
	.long	2
	.long	12
	.long	6
	.long	9
	.long	8
	.long	5
	.long	0
	.long	6
	.long	13
	.long	1
	.long	3
	.long	13
	.long	4
	.long	14
	.long	14
	.long	0
	.long	7
	.long	11
	.long	5
	.long	3
	.long	11
	.long	8
	.long	9
	.long	4
	.long	14
	.long	3
	.long	15
	.long	2
	.long	5
	.long	12
	.long	2
	.long	9
	.long	8
	.long	5
	.long	12
	.long	15
	.long	3
	.long	10
	.long	7
	.long	11
	.long	0
	.long	14
	.long	4
	.long	1
	.long	10
	.long	7
	.long	1
	.long	6
	.long	13
	.long	0
	.long	11
	.long	8
	.long	6
	.long	13
	.long	2
	.long	14
	.long	12
	.long	11
	.long	4
	.long	2
	.long	1
	.long	12
	.long	7
	.long	4
	.long	10
	.long	7
	.long	11
	.long	13
	.long	6
	.long	1
	.long	8
	.long	5
	.long	5
	.long	0
	.long	3
	.long	15
	.long	15
	.long	10
	.long	13
	.long	3
	.long	0
	.long	9
	.long	14
	.long	8
	.long	9
	.long	6
	.long	4
	.long	11
	.long	2
	.long	8
	.long	1
	.long	12
	.long	11
	.long	7
	.long	10
	.long	1
	.long	13
	.long	14
	.long	7
	.long	2
	.long	8
	.long	13
	.long	15
	.long	6
	.long	9
	.long	15
	.long	12
	.long	0
	.long	5
	.long	9
	.long	6
	.long	10
	.long	3
	.long	4
	.long	0
	.long	5
	.long	14
	.long	3
	.long	7
	.long	13
	.long	13
	.long	8
	.long	14
	.long	11
	.long	3
	.long	5
	.long	0
	.long	6
	.long	6
	.long	15
	.long	9
	.long	0
	.long	10
	.long	3
	.long	1
	.long	4
	.long	2
	.long	7
	.long	8
	.long	2
	.long	5
	.long	12
	.long	11
	.long	1
	.long	12
	.long	10
	.long	4
	.long	14
	.long	15
	.long	9
	.long	10
	.long	3
	.long	6
	.long	15
	.long	9
	.long	0
	.long	0
	.long	6
	.long	12
	.long	10
	.long	11
	.long	1
	.long	7
	.long	13
	.long	13
	.long	8
	.long	15
	.long	9
	.long	1
	.long	4
	.long	3
	.long	5
	.long	14
	.long	11
	.long	5
	.long	12
	.long	2
	.long	7
	.long	8
	.long	2
	.long	4
	.long	14
	.long	10
	.long	13
	.long	0
	.long	7
	.long	9
	.long	0
	.long	14
	.long	9
	.long	6
	.long	3
	.long	3
	.long	4
	.long	15
	.long	6
	.long	5
	.long	10
	.long	1
	.long	2
	.long	13
	.long	8
	.long	12
	.long	5
	.long	7
	.long	14
	.long	11
	.long	12
	.long	4
	.long	11
	.long	2
	.long	15
	.long	8
	.long	1
	.long	13
	.long	1
	.long	6
	.long	10
	.long	4
	.long	13
	.long	9
	.long	0
	.long	8
	.long	6
	.long	15
	.long	9
	.long	3
	.long	8
	.long	0
	.long	7
	.long	11
	.long	4
	.long	1
	.long	15
	.long	2
	.long	14
	.long	12
	.long	3
	.long	5
	.long	11
	.long	10
	.long	5
	.long	14
	.long	2
	.long	7
	.long	12
	.long	15
	.long	3
	.long	1
	.long	13
	.long	8
	.long	4
	.long	14
	.long	7
	.long	6
	.long	15
	.long	11
	.long	2
	.long	3
	.long	8
	.long	4
	.long	14
	.long	9
	.long	12
	.long	7
	.long	0
	.long	2
	.long	1
	.long	13
	.long	10
	.long	12
	.long	6
	.long	0
	.long	9
	.long	5
	.long	11
	.long	10
	.long	5
	.long	0
	.long	13
	.long	14
	.long	8
	.long	7
	.long	10
	.long	11
	.long	1
	.long	10
	.long	3
	.long	4
	.long	15
	.long	13
	.long	4
	.long	1
	.long	2
	.long	5
	.long	11
	.long	8
	.long	6
	.long	12
	.long	7
	.long	6
	.long	12
	.long	9
	.long	0
	.long	3
	.long	5
	.long	2
	.long	14
	.long	15
	.long	9
	.long	14
	.long	0
	.long	4
	.long	15
	.long	13
	.long	7
	.long	1
	.long	4
	.long	2
	.long	14
	.long	15
	.long	2
	.long	11
	.long	13
	.long	8
	.long	1
	.long	3
	.long	10
	.long	10
	.long	6
	.long	6
	.long	12
	.long	12
	.long	11
	.long	5
	.long	9
	.long	9
	.long	5
	.long	0
	.long	3
	.long	7
	.long	8
	.long	4
	.long	15
	.long	1
	.long	12
	.long	14
	.long	8
	.long	8
	.long	2
	.long	13
	.long	4
	.long	6
	.long	9
	.long	2
	.long	1
	.long	11
	.long	7
	.long	15
	.long	5
	.long	12
	.long	11
	.long	9
	.long	3
	.long	7
	.long	14
	.long	3
	.long	10
	.long	10
	.long	0
	.long	5
	.long	6
	.long	0
	.long	13
	.local	_ZL7S_TABLE
	.comm	_ZL7S_TABLE,8192,32
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	4096
	.long	1093664768
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/* This program is aimed to do the cuda implementation of DESnuts */

#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <inttypes.h>

/**********************************************************************/
/*                                                                    */
/*                            DES TABLES                              */
/*                                                                    */
/**********************************************************************/

#define MAX_THREADS_1D 32
#define MAX_BLOCKS_1D 256
#define CONSTANT_SIZE (sizeof(int) * 8 * 64)
__constant__ int S_TABLE[CONSTANT_SIZE];


/*
 *  S Tables: Introduce nonlinearity and avalanche
 */
static int table_DES_S[8][64] = {
    /* table S[0] */
    {   13,  1,  2, 15,  8, 13,  4,  8,  6, 10, 15,  3, 11,  7,  1,  4,
        10, 12,  9,  5,  3,  6, 14, 11,  5,  0,  0, 14, 12,  9,  7,  2,
        7,  2, 11,  1,  4, 14,  1,  7,  9,  4, 12, 10, 14,  8,  2, 13,
        0, 15,  6, 12, 10,  9, 13,  0, 15,  3,  3,  5,  5,  6,  8, 11  },
    /* table S[1] */
    {    4, 13, 11,  0,  2, 11, 14,  7, 15,  4,  0,  9,  8,  1, 13, 10,
        3, 14, 12,  3,  9,  5,  7, 12,  5,  2, 10, 15,  6,  8,  1,  6,
        1,  6,  4, 11, 11, 13, 13,  8, 12,  1,  3,  4,  7, 10, 14,  7,
        10,  9, 15,  5,  6,  0,  8, 15,  0, 14,  5,  2,  9,  3,  2, 12  },
    /* table S[2] */
    {   12, 10,  1, 15, 10,  4, 15,  2,  9,  7,  2, 12,  6,  9,  8,  5,
        0,  6, 13,  1,  3, 13,  4, 14, 14,  0,  7, 11,  5,  3, 11,  8,
        9,  4, 14,  3, 15,  2,  5, 12,  2,  9,  8,  5, 12, 15,  3, 10,
        7, 11,  0, 14,  4,  1, 10,  7,  1,  6, 13,  0, 11,  8,  6, 13  },
    /* table S[3] */
    {    2, 14, 12, 11,  4,  2,  1, 12,  7,  4, 10,  7, 11, 13,  6,  1,
        8,  5,  5,  0,  3, 15, 15, 10, 13,  3,  0,  9, 14,  8,  9,  6,
        4, 11,  2,  8,  1, 12, 11,  7, 10,  1, 13, 14,  7,  2,  8, 13,
        15,  6,  9, 15, 12,  0,  5,  9,  6, 10,  3,  4,  0,  5, 14,  3  },
    /* table S[4] */
    {    7, 13, 13,  8, 14, 11,  3,  5,  0,  6,  6, 15,  9,  0, 10,  3,
        1,  4,  2,  7,  8,  2,  5, 12, 11,  1, 12, 10,  4, 14, 15,  9,
        10,  3,  6, 15,  9,  0,  0,  6, 12, 10, 11,  1,  7, 13, 13,  8,
        15,  9,  1,  4,  3,  5, 14, 11,  5, 12,  2,  7,  8,  2,  4, 14  },
    /* table S[5] */
    {   10, 13,  0,  7,  9,  0, 14,  9,  6,  3,  3,  4, 15,  6,  5, 10,
        1,  2, 13,  8, 12,  5,  7, 14, 11, 12,  4, 11,  2, 15,  8,  1,
        13,  1,  6, 10,  4, 13,  9,  0,  8,  6, 15,  9,  3,  8,  0,  7,
        11,  4,  1, 15,  2, 14, 12,  3,  5, 11, 10,  5, 14,  2,  7, 12  },
    /* table S[6] */
    {   15,  3,  1, 13,  8,  4, 14,  7,  6, 15, 11,  2,  3,  8,  4, 14,
        9, 12,  7,  0,  2,  1, 13, 10, 12,  6,  0,  9,  5, 11, 10,  5,
        0, 13, 14,  8,  7, 10, 11,  1, 10,  3,  4, 15, 13,  4,  1,  2,
        5, 11,  8,  6, 12,  7,  6, 12,  9,  0,  3,  5,  2, 14, 15,  9  },
    /* table S[7] */
    {   14,  0,  4, 15, 13,  7,  1,  4,  2, 14, 15,  2, 11, 13,  8,  1,
        3, 10, 10,  6,  6, 12, 12, 11,  5,  9,  9,  5,  0,  3,  7,  8,
        4, 15,  1, 12, 14,  8,  8,  2, 13,  4,  6,  9,  2,  1, 11,  7,
        15,  5, 12, 11,  9,  3,  7, 14,  3, 10, 10,  0,  5,  6,  0, 13  }
};

/*
void print_bits_array(uint64_t n) {
    printf("%lX\n", n);
}

void print_bits(uint64_t n) {
    for (int i = 0 ; i < 64; i++) {
        if (i == 32)
            printf("\n");
        printf("%d", ((n) & 0x8000000000000000) >> 63);
        n <<= 1;
    }
    printf("\n");
    printf("\n");
}
*/
        
#define MASK56(n) ((n) & 0x00FFFFFFFFFFFFFF)
#define MASK48(n) ((n) & 0x0000FFFFFFFFFFFF)


#define COMPUTE_ROUND_KEY(roundKey, key)        \
    roundKey |= ((key & ((1UL) << 0)) << (27));     \
    roundKey |= ((key & ((1UL) << 1)) << (18));     \
    roundKey |= ((key & ((1UL) << 2)) << (9));  \
    roundKey |= ((key & ((1UL) << 3)) << (28));     \
    roundKey |= ((key & ((1UL) << 4)) << (35));     \
    roundKey |= ((key & ((1UL) << 5)) << (42));     \
    roundKey |= ((key & ((1UL) << 6)) << (49));     \
    roundKey |= ((key & ((1UL) << 7)) << (19));     \
    roundKey |= ((key & ((1UL) << 8)) << (10));     \
    roundKey |= ((key & ((1UL) << 9)) << (1));  \
    roundKey |= ((key & ((1UL) << 10)) << (20));    \
    roundKey |= ((key & ((1UL) << 11)) << (27));    \
    roundKey |= ((key & ((1UL) << 12)) << (34));    \
    roundKey |= ((key & ((1UL) << 13)) << (41));    \
    roundKey |= ((key & ((1UL) << 14)) << (11));    \
    roundKey |= ((key & ((1UL) << 15)) << (2));     \
    roundKey |= ((key & ((1UL) << 16)) >> (7));     \
    roundKey |= ((key & ((1UL) << 17)) << (12));    \
    roundKey |= ((key & ((1UL) << 18)) << (19));    \
    roundKey |= ((key & ((1UL) << 19)) << (26));    \
    roundKey |= ((key & ((1UL) << 20)) << (33));    \
    roundKey |= ((key & ((1UL) << 21)) << (3));     \
    roundKey |= ((key & ((1UL) << 22)) >> (6));     \
    roundKey |= ((key & ((1UL) << 23)) >> (15));    \
    roundKey |= ((key & ((1UL) << 24)) << (4));     \
    roundKey |= ((key & ((1UL) << 25)) << (11));    \
    roundKey |= ((key & ((1UL) << 26)) << (18));    \
    roundKey |= ((key & ((1UL) << 27)) << (25));    \
    roundKey |= ((key & ((1UL) << 28)) >> (5));     \
    roundKey |= ((key & ((1UL) << 29)) >> (14));    \
    roundKey |= ((key & ((1UL) << 30)) >> (23));    \
    roundKey |= ((key & ((1UL) << 31)) >> (28));    \
    roundKey |= ((key & ((1UL) << 32)) << (3));     \
    roundKey |= ((key & ((1UL) << 33)) << (10));    \
    roundKey |= ((key & ((1UL) << 34)) << (17));    \
    roundKey |= ((key & ((1UL) << 35)) >> (13));    \
    roundKey |= ((key & ((1UL) << 36)) >> (22));    \
    roundKey |= ((key & ((1UL) << 37)) >> (31));    \
    roundKey |= ((key & ((1UL) << 38)) >> (36));    \
    roundKey |= ((key & ((1UL) << 39)) >> (5));     \
    roundKey |= ((key & ((1UL) << 40)) << (2));     \
    roundKey |= ((key & ((1UL) << 41)) << (9));     \
    roundKey |= ((key & ((1UL) << 42)) >> (21));    \
    roundKey |= ((key & ((1UL) << 43)) >> (30));    \
    roundKey |= ((key & ((1UL) << 44)) >> (39));    \
    roundKey |= ((key & ((1UL) << 45)) >> (44));    \
    roundKey |= ((key & ((1UL) << 46)) >> (13));    \
    roundKey |= ((key & ((1UL) << 47)) >> (6));     \
    roundKey |= ((key & ((1UL) << 48)) << (1));     \
    roundKey |= ((key & ((1UL) << 49)) >> (29));    \
    roundKey |= ((key & ((1UL) << 50)) >> (38));    \
    roundKey |= ((key & ((1UL) << 51)) >> (47));    \
    roundKey |= ((key & ((1UL) << 52)) >> (52));    \
    roundKey |= ((key & ((1UL) << 53)) >> (21));    \
    roundKey |= ((key & ((1UL) << 54)) >> (14));    \
    roundKey |= ((key & ((1UL) << 55)) >> (7));     \


#define COMPUTE_IP(L, R, in)            \
    temp = 0UL;                    \
    temp |= ((in & ((1UL) << 63)) >> (39));  \
    temp |= ((in & ((1UL) << 62)) >> (6));  \
    temp |= ((in & ((1UL) << 61)) >> (45));     \
    temp |= ((in & ((1UL) << 60)) >> (12));     \
    temp |= ((in & ((1UL) << 59)) >> (51));     \
    temp |= ((in & ((1UL) << 58)) >> (18));     \
    temp |= ((in & ((1UL) << 57)) >> (57));     \
    temp |= ((in & ((1UL) << 56)) >> (24));     \
    temp |= ((in & ((1UL) << 55)) >> (30));     \
    temp |= ((in & ((1UL) << 54)) << (3));  \
    temp |= ((in & ((1UL) << 53)) >> (36));     \
    temp |= ((in & ((1UL) << 52)) >> (3));  \
    temp |= ((in & ((1UL) << 51)) >> (42));     \
    temp |= ((in & ((1UL) << 50)) >> (9));  \
    temp |= ((in & ((1UL) << 49)) >> (48));     \
    temp |= ((in & ((1UL) << 48)) >> (15));     \
    temp |= ((in & ((1UL) << 47)) >> (21));     \
    temp |= ((in & ((1UL) << 46)) << (12));     \
    temp |= ((in & ((1UL) << 45)) >> (27));     \
    temp |= ((in & ((1UL) << 44)) << (6));  \
    temp |= ((in & ((1UL) << 43)) >> (33));     \
    temp |= ((in & ((1UL) << 42)) << (0));  \
    temp |= ((in & ((1UL) << 41)) >> (39));     \
    temp |= ((in & ((1UL) << 40)) >> (6));  \
    temp |= ((in & ((1UL) << 39)) >> (12));     \
    temp |= ((in & ((1UL) << 38)) << (21));     \
    temp |= ((in & ((1UL) << 37)) >> (18));     \
    temp |= ((in & ((1UL) << 36)) << (15));     \
    temp |= ((in & ((1UL) << 35)) >> (24));     \
    temp |= ((in & ((1UL) << 34)) << (9));  \
    temp |= ((in & ((1UL) << 33)) >> (30));     \
    temp |= ((in & ((1UL) << 32)) << (3));  \
    temp |= ((in & ((1UL) << 31)) >> (3));  \
    temp |= ((in & ((1UL) << 30)) << (30));     \
    temp |= ((in & ((1UL) << 29)) >> (9));  \
    temp |= ((in & ((1UL) << 28)) << (24));     \
    temp |= ((in & ((1UL) << 27)) >> (15));     \
    temp |= ((in & ((1UL) << 26)) << (18));     \
    temp |= ((in & ((1UL) << 25)) >> (21));     \
    temp |= ((in & ((1UL) << 24)) << (12));     \
    temp |= ((in & ((1UL) << 23)) << (6));  \
    temp |= ((in & ((1UL) << 22)) << (39));     \
    temp |= ((in & ((1UL) << 21)) << (0));  \
    temp |= ((in & ((1UL) << 20)) << (33));     \
    temp |= ((in & ((1UL) << 19)) >> (6));  \
    temp |= ((in & ((1UL) << 18)) << (27));     \
    temp |= ((in & ((1UL) << 17)) >> (12));     \
    temp |= ((in & ((1UL) << 16)) << (21));     \
    temp |= ((in & ((1UL) << 15)) << (15));     \
    temp |= ((in & ((1UL) << 14)) << (48));     \
    temp |= ((in & ((1UL) << 13)) << (9));  \
    temp |= ((in & ((1UL) << 12)) << (42));     \
    temp |= ((in & ((1UL) << 11)) << (3));  \
    temp |= ((in & ((1UL) << 10)) << (36));     \
    temp |= ((in & ((1UL) << 9)) >> (3));   \
    temp |= ((in & ((1UL) << 8)) << (30));  \
    temp |= ((in & ((1UL) << 7)) << (24));  \
    temp |= ((in & ((1UL) << 6)) << (57));  \
    temp |= ((in & ((1UL) << 5)) << (18));  \
    temp |= ((in & ((1UL) << 4)) << (51));  \
    temp |= ((in & ((1UL) << 3)) << (12));  \
    temp |= ((in & ((1UL) << 2)) << (45));  \
    temp |= ((in & ((1UL) << 1)) << (6));   \
    temp |= ((in & ((1UL) << 0)) << (39));  \
    L = (temp >> 32) & 0xFFFFFFFF;            \
    R = (temp) & 0xFFFFFFFF;                  \


#define COMPUTE_FP(out, L, R)                   \
    temp = L;                                   \
    temp = (temp << 32) | R;                        \
    out |= ((temp & ((1UL) << 63)) >> (57));    \
    out |= ((temp & ((1UL) << 62)) >> (48));    \
    out |= ((temp & ((1UL) << 61)) >> (39));    \
    out |= ((temp & ((1UL) << 60)) >> (30));    \
    out |= ((temp & ((1UL) << 59)) >> (21));    \
    out |= ((temp & ((1UL) << 58)) >> (12));    \
    out |= ((temp & ((1UL) << 57)) >> (3));     \
    out |= ((temp & ((1UL) << 56)) << (6));     \
    out |= ((temp & ((1UL) << 55)) >> (51));    \
    out |= ((temp & ((1UL) << 54)) >> (42));    \
    out |= ((temp & ((1UL) << 53)) >> (33));    \
    out |= ((temp & ((1UL) << 52)) >> (24));    \
    out |= ((temp & ((1UL) << 51)) >> (15));    \
    out |= ((temp & ((1UL) << 50)) >> (6));     \
    out |= ((temp & ((1UL) << 49)) << (3));     \
    out |= ((temp & ((1UL) << 48)) << (12));    \
    out |= ((temp & ((1UL) << 47)) >> (45));    \
    out |= ((temp & ((1UL) << 46)) >> (36));    \
    out |= ((temp & ((1UL) << 45)) >> (27));    \
    out |= ((temp & ((1UL) << 44)) >> (18));    \
    out |= ((temp & ((1UL) << 43)) >> (9));     \
    out |= ((temp & ((1UL) << 42)) << (0));     \
    out |= ((temp & ((1UL) << 41)) << (9));     \
    out |= ((temp & ((1UL) << 40)) << (18));    \
    out |= ((temp & ((1UL) << 39)) >> (39));    \
    out |= ((temp & ((1UL) << 38)) >> (30));    \
    out |= ((temp & ((1UL) << 37)) >> (21));    \
    out |= ((temp & ((1UL) << 36)) >> (12));    \
    out |= ((temp & ((1UL) << 35)) >> (3));     \
    out |= ((temp & ((1UL) << 34)) << (6));     \
    out |= ((temp & ((1UL) << 33)) << (15));    \
    out |= ((temp & ((1UL) << 32)) << (24));    \
    out |= ((temp & ((1UL) << 31)) >> (24));    \
    out |= ((temp & ((1UL) << 30)) >> (15));    \
    out |= ((temp & ((1UL) << 29)) >> (6));     \
    out |= ((temp & ((1UL) << 28)) << (3));     \
    out |= ((temp & ((1UL) << 27)) << (12));    \
    out |= ((temp & ((1UL) << 26)) << (21));    \
    out |= ((temp & ((1UL) << 25)) << (30));    \
    out |= ((temp & ((1UL) << 24)) << (39));    \
    out |= ((temp & ((1UL) << 23)) >> (18));    \
    out |= ((temp & ((1UL) << 22)) >> (9));     \
    out |= ((temp & ((1UL) << 21)) << (0));     \
    out |= ((temp & ((1UL) << 20)) << (9));     \
    out |= ((temp & ((1UL) << 19)) << (18));    \
    out |= ((temp & ((1UL) << 18)) << (27));    \
    out |= ((temp & ((1UL) << 17)) << (36));    \
    out |= ((temp & ((1UL) << 16)) << (45));    \
    out |= ((temp & ((1UL) << 15)) >> (12));    \
    out |= ((temp & ((1UL) << 14)) >> (3));     \
    out |= ((temp & ((1UL) << 13)) << (6));     \
    out |= ((temp & ((1UL) << 12)) << (15));    \
    out |= ((temp & ((1UL) << 11)) << (24));    \
    out |= ((temp & ((1UL) << 10)) << (33));    \
    out |= ((temp & ((1UL) << 9)) << (42));     \
    out |= ((temp & ((1UL) << 8)) << (51));     \
    out |= ((temp & ((1UL) << 7)) >> (6));  \
    out |= ((temp & ((1UL) << 6)) << (3));  \
    out |= ((temp & ((1UL) << 5)) << (12));     \
    out |= ((temp & ((1UL) << 4)) << (21));     \
    out |= ((temp & ((1UL) << 3)) << (30));     \
    out |= ((temp & ((1UL) << 2)) << (39));     \
    out |= ((temp & ((1UL) << 1)) << (48));     \
    out |= ((temp & ((1UL) << 0)) << (57));     \

#define COMPUTE_P(out, in)  \
    out |= ((in & ((1UL) << 0)) << (11));   \
    out |= ((in & ((1UL) << 1)) << (16));   \
    out |= ((in & ((1UL) << 2)) << (3));    \
    out |= ((in & ((1UL) << 3)) << (24));   \
    out |= ((in & ((1UL) << 4)) << (21));   \
    out |= ((in & ((1UL) << 5)) << (5));    \
    out |= ((in & ((1UL) << 6)) << (14));   \
    out |= ((in & ((1UL) << 7)) >> (7));    \
    out |= ((in & ((1UL) << 8)) << (5));    \
    out |= ((in & ((1UL) << 9)) << (12));   \
    out |= ((in & ((1UL) << 10)) >> (7));   \
    out |= ((in & ((1UL) << 11)) << (17));  \
    out |= ((in & ((1UL) << 12)) << (17));  \
    out |= ((in & ((1UL) << 13)) >> (6));   \
    out |= ((in & ((1UL) << 14)) << (4));   \
    out |= ((in & ((1UL) << 15)) << (9));   \
    out |= ((in & ((1UL) << 16)) << (15));  \
    out |= ((in & ((1UL) << 17)) << (5));   \
    out |= ((in & ((1UL) << 18)) >> (6));   \
    out |= ((in & ((1UL) << 19)) >> (13));  \
    out |= ((in & ((1UL) << 20)) << (6));   \
    out |= ((in & ((1UL) << 21)) >> (19));  \
    out |= ((in & ((1UL) << 22)) >> (6));   \
    out |= ((in & ((1UL) << 23)) >> (15));  \
    out |= ((in & ((1UL) << 24)) >> (10));  \
    out |= ((in & ((1UL) << 25)) << (5));   \
    out |= ((in & ((1UL) << 26)) >> (22));  \
    out |= ((in & ((1UL) << 27)) >> (8));   \
    out |= ((in & ((1UL) << 28)) >> (27));  \
    out |= ((in & ((1UL) << 29)) >> (20));  \
    out |= ((in & ((1UL) << 30)) >> (15));  \
    out |= ((in & ((1UL) << 31)) >> (8));   \


#define COMPUTE_EXPANSION_E(expB, Rin)        \
    expB |= ((R & ((1UL) << 31)) >> (31));  \
    expB |= ((R & ((1UL) << 0)) << (1));    \
    expB |= ((R & ((1UL) << 1)) << (1));    \
    expB |= ((R & ((1UL) << 2)) << (1));    \
    expB |= ((R & ((1UL) << 3)) << (1));    \
    expB |= ((R & ((1UL) << 4)) << (1));    \
    expB |= ((R & ((1UL) << 3)) << (3));    \
    expB |= ((R & ((1UL) << 4)) << (3));    \
    expB |= ((R & ((1UL) << 5)) << (3));    \
    expB |= ((R & ((1UL) << 6)) << (3));    \
    expB |= ((R & ((1UL) << 7)) << (3));    \
    expB |= ((R & ((1UL) << 8)) << (3));    \
    expB |= ((R & ((1UL) << 7)) << (5));    \
    expB |= ((R & ((1UL) << 8)) << (5));    \
    expB |= ((R & ((1UL) << 9)) << (5));    \
    expB |= ((R & ((1UL) << 10)) << (5));   \
    expB |= ((R & ((1UL) << 11)) << (5));   \
    expB |= ((R & ((1UL) << 12)) << (5));   \
    expB |= ((R & ((1UL) << 11)) << (7));   \
    expB |= ((R & ((1UL) << 12)) << (7));   \
    expB |= ((R & ((1UL) << 13)) << (7));   \
    expB |= ((R & ((1UL) << 14)) << (7));   \
    expB |= ((R & ((1UL) << 15)) << (7));   \
    expB |= ((R & ((1UL) << 16)) << (7));   \
    expB |= ((R & ((1UL) << 15)) << (9));   \
    expB |= ((R & ((1UL) << 16)) << (9));   \
    expB |= ((R & ((1UL) << 17)) << (9));   \
    expB |= ((R & ((1UL) << 18)) << (9));   \
    expB |= ((R & ((1UL) << 19)) << (9));   \
    expB |= ((R & ((1UL) << 20)) << (9));   \
    expB |= ((R & ((1UL) << 19)) << (11));  \
    expB |= ((R & ((1UL) << 20)) << (11));  \
    expB |= ((R & ((1UL) << 21)) << (11));  \
    expB |= ((R & ((1UL) << 22)) << (11));  \
    expB |= ((R & ((1UL) << 23)) << (11));  \
    expB |= ((R & ((1UL) << 24)) << (11));  \
    expB |= ((R & ((1UL) << 23)) << (13));  \
    expB |= ((R & ((1UL) << 24)) << (13));  \
    expB |= ((R & ((1UL) << 25)) << (13));  \
    expB |= ((R & ((1UL) << 26)) << (13));  \
    expB |= ((R & ((1UL) << 27)) << (13));  \
    expB |= ((R & ((1UL) << 28)) << (13));  \
    expB |= ((R & ((1UL) << 27)) << (15));  \
    expB |= ((R & ((1UL) << 28)) << (15));  \
    expB |= ((R & ((1UL) << 29)) << (15));  \
    expB |= ((R & ((1UL) << 30)) << (15));  \
    expB |= ((R & ((1UL) << 31)) << (15));  \
    expB |= ((R & ((1UL) << 0)) << (47));   \


#define COMPUTE_PC2(subkey, roundKey)       \
    subkey |= ((roundKey & ((1UL) << 24)) >> (24));     \
    subkey |= ((roundKey & ((1UL) << 27)) >> (26));     \
    subkey |= ((roundKey & ((1UL) << 20)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 6)) >> (3));   \
    subkey |= ((roundKey & ((1UL) << 14)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 10)) >> (5));  \
    subkey |= ((roundKey & ((1UL) << 3)) << (3));   \
    subkey |= ((roundKey & ((1UL) << 22)) >> (15));     \
    subkey |= ((roundKey & ((1UL) << 0)) << (8));   \
    subkey |= ((roundKey & ((1UL) << 17)) >> (8));  \
    subkey |= ((roundKey & ((1UL) << 7)) << (3));   \
    subkey |= ((roundKey & ((1UL) << 12)) >> (1));  \
    subkey |= ((roundKey & ((1UL) << 8)) << (4));   \
    subkey |= ((roundKey & ((1UL) << 23)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 11)) << (3));  \
    subkey |= ((roundKey & ((1UL) << 5)) << (10));  \
    subkey |= ((roundKey & ((1UL) << 16)) >> (0));  \
    subkey |= ((roundKey & ((1UL) << 26)) >> (9));  \
    subkey |= ((roundKey & ((1UL) << 1)) << (17));  \
    subkey |= ((roundKey & ((1UL) << 9)) << (10));  \
    subkey |= ((roundKey & ((1UL) << 19)) << (1));  \
    subkey |= ((roundKey & ((1UL) << 25)) >> (4));  \
    subkey |= ((roundKey & ((1UL) << 4)) << (18));  \
    subkey |= ((roundKey & ((1UL) << 15)) << (8));  \
    subkey |= ((roundKey & ((1UL) << 54)) >> (30));     \
    subkey |= ((roundKey & ((1UL) << 43)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 36)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 29)) >> (2));  \
    subkey |= ((roundKey & ((1UL) << 49)) >> (21));     \
    subkey |= ((roundKey & ((1UL) << 40)) >> (11));     \
    subkey |= ((roundKey & ((1UL) << 48)) >> (18));     \
    subkey |= ((roundKey & ((1UL) << 30)) << (1));  \
    subkey |= ((roundKey & ((1UL) << 52)) >> (20));     \
    subkey |= ((roundKey & ((1UL) << 44)) >> (11));     \
    subkey |= ((roundKey & ((1UL) << 37)) >> (3));  \
    subkey |= ((roundKey & ((1UL) << 33)) << (2));  \
    subkey |= ((roundKey & ((1UL) << 46)) >> (10));     \
    subkey |= ((roundKey & ((1UL) << 35)) << (2));  \
    subkey |= ((roundKey & ((1UL) << 50)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 41)) >> (2));  \
    subkey |= ((roundKey & ((1UL) << 28)) << (12));     \
    subkey |= ((roundKey & ((1UL) << 53)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 51)) >> (9));  \
    subkey |= ((roundKey & ((1UL) << 55)) >> (12));     \
    subkey |= ((roundKey & ((1UL) << 32)) << (12));     \
    subkey |= ((roundKey & ((1UL) << 45)) >> (0));  \
    subkey |= ((roundKey & ((1UL) << 39)) << (7));  \
    subkey |= ((roundKey & ((1UL) << 42)) << (5));  \


#define COMPUTES_LOOKUP(k, sout, expandedBlock)     \
    sout |= S_TABLE[k * 64 + ((expandedBlock >> (6 * k)) & 0x3F)] << (4 * k);      \

/* This is the host code
#define COMPUTES_LOOKUP(k, sout, expandedBlock)     \
    sout |= table_DES_S[k][(expandedBlock >> (6 * k)) & 0x3F] << (4 * k);      \
*/

/*
uint32_t COMPUTE_F(uint32_t fout, uint32_t R, uint64_t roundKey) {
    uint64_t expandedBlock = 0UL, subkey = 0UL;
    uint32_t sout = 0;
    int i, k;

    COMPUTE_EXPANSION_E(expandedBlock, R)

    printf("expanded E is : \n");
    print_bits_array(expandedBlock);

    COMPUTE_PC2(subkey, roundKey)

    printf("subkey is :\n");
    print_bits_array(subkey);

    expandedBlock ^= subkey;
    // Mask expandedBlock
    expandedBlock = MASK48(expandedBlock);
    printf("Expanded E is :\n");
    print_bits_array(expandedBlock);

    for (k = 0; k < 8; k++) {
        COMPUTES_LOOKUP(k, sout, expandedBlock)

        printf("sout @ %d is :\n", k);
        print_bits_array(sout);
    }

    COMPUTE_P(fout, sout)

    printf("fout is :\n");
    print_bits_array(fout);
    printf("sout is :\n");
    print_bits_array(sout);

    return fout;
}
*/


#define ROTATE_ROUND_KEY_LEFT(roundK)         \
    uint64_t bit27 = ((roundK & ((1UL) << 27)) >> 27);\
    uint64_t bit55 = ((roundK & ((1UL) << 55)) >> 27);\
    roundK <<= 1;                             \
    temp = roundK & 0x00FFFFFFEFFFFFFE;            \
    roundK = temp | bit27 | bit55;           \




#define EXCHANGE_L_AND_R(L, R)                  \
    temp = L;                                   \
    L = R;                                      \
    R = temp;                                   \
    

__global__ void EncryptDES_device(uint64_t in, uint64_t expected, uint64_t* result, uint64_t bound) {

    int blockId = blockIdx.x + blockIdx.y * gridDim.x; 
    int threadId = blockId * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
    uint64_t key = threadId * bound;
    uint64_t counter = 0;
    
    while (counter != bound) {

        uint32_t R = 0, L = 0; 
        uint64_t roundKey = 0UL, out = 0UL, temp = 0UL;

        COMPUTE_ROUND_KEY(roundKey, key)

        COMPUTE_IP(L, R, in)

        for (int round = 0; round < 16; round++) {
            uint64_t expandedBlock = 0UL, subkey = 0UL;
            uint32_t sout = 0;
            uint32_t fout = 0;

            ROTATE_ROUND_KEY_LEFT(roundKey)

            if (round != 0 && round != 1 && round != 8 && round != 15) {
                ROTATE_ROUND_KEY_LEFT(roundKey)
            }


            COMPUTE_EXPANSION_E(expandedBlock, R)

            COMPUTE_PC2(subkey, roundKey)


            expandedBlock ^= subkey;
            expandedBlock = MASK48(expandedBlock);

            for (int i = 0; i < 8; i++) {
                COMPUTES_LOOKUP(i, sout, expandedBlock)
            }

            COMPUTE_P(fout, sout)

                L ^= fout;

            EXCHANGE_L_AND_R(L, R)

        }
        EXCHANGE_L_AND_R(L, R)

        COMPUTE_FP(out, L, R)

        if (out == expected) {
            *result = out;
             // asm("trap;");
        }
        counter++;
        key++;
    }
    __syncthreads();
}

/*
void EncryptDES_host(uint64_t key, uint64_t in, uint64_t expected) {
    uint32_t R = 0, L = 0; 
    uint64_t roundKey = 0UL, out = 0UL, temp = 0UL;
    
    printf("sizeof(unsigned long long) is %d\n", sizeof(unsigned long long));

    COMPUTE_ROUND_KEY(roundKey, key)
    
    printf("roundKey is: \n");
    print_bits_array(roundKey);


    COMPUTE_IP(L, R, in)
    
    printf("after IP is: \n");
    printf("\t L:\n");
    print_bits_array(L);
    printf("\t R:\n");
    print_bits_array(R);

    for (int round = 0; round < 16; round++) {
        uint64_t expandedBlock = 0UL, subkey = 0UL;
        uint32_t sout = 0;
        uint32_t fout = 0;

        printf("------------------------- ROUND %d ----------------------\n", round);
    

        ROTATE_ROUND_KEY_LEFT(roundKey)
        
        printf("\t roundKey:\n");
        print_bits_array(roundKey);

        if (round != 0 && round != 1 && round != 8 && round != 15) {
            ROTATE_ROUND_KEY_LEFT(roundKey)
        }


        COMPUTE_EXPANSION_E(expandedBlock, R)

        printf("expanded E is : \n");
        print_bits_array(expandedBlock);

        COMPUTE_PC2(subkey, roundKey)

        printf("subkey is :\n");
        print_bits_array(subkey);

        expandedBlock ^= subkey;
        // Mask expandedBlock
        expandedBlock = MASK48(expandedBlock);
        printf("Expanded E is :\n");
        print_bits_array(expandedBlock);

        for (int i = 0; i < 8; i++) {
               Comment out for compilation of the device code

            COMPUTES_LOOKUP(i, sout, expandedBlock)
            printf("sout @ %d is :\n", i);
            print_bits_array(sout);
        }

        COMPUTE_P(fout, sout)

        printf("fout is :\n");
        print_bits_array(fout);
        printf("sout is :\n");
        print_bits_array(sout);

        printf("f is : \n");
        print_bits_array(fout);

        L ^= fout;

        printf("L^f is : \n");
        print_bits_array(L);
        
        EXCHANGE_L_AND_R(L, R)

        printf("------------------------- ROUND %d end ------------------\n", round);
         
    }
    EXCHANGE_L_AND_R(L, R)

    COMPUTE_FP(out, L, R)
    
    printf("FP out is \n");
    print_bits_array(out);

}
*/


int main(int argc, char **argv) {

    uint64_t random_o = 0xF77D7F53F77D7F53;
    // uint64_t random_k = 0x2FEABF912FEABF;
    uint64_t expected = 0xDF86B0B30BD2530A;

    hipEvent_t start, stop;
    hipEventCreate(&start);
    hipEventCreate(&stop);
    float milliseconds = 0;

    uint64_t *result_host = (uint64_t *)calloc(1, sizeof(uint64_t));
    uint64_t *result_device;
    hipMalloc(&result_device, sizeof(uint64_t));


    hipMemcpy(result_device, result_host, sizeof(uint64_t),  hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(S_TABLE), table_DES_S, CONSTANT_SIZE);

    int threads = MAX_THREADS_1D / 2;
    int blocks = (MAX_BLOCKS_1D - 1);

    uint64_t overall_total = 0x0FFFFFFFFFFFFFFFULL;
    uint64_t target_total = 0xFFFFFFFFFFULL;

    dim3 dimGrid(blocks, blocks);
    dim3 dimBlock(threads, threads);

    hipEventRecord(start, 0);
    hipEventSynchronize(start);

    EncryptDES_device<<<dimGrid, dimBlock>>>(random_o, expected, result_device, (target_total / (blocks * blocks * threads * threads)));
    hipDeviceSynchronize();

    hipEventRecord(stop);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&milliseconds, start, stop);

    printf("Cuda Execution Report: \n");
    printf("Targetting number of testing key - %" PRIu64 "\n", target_total);
    printf("Time spent %0.8f ms\n", milliseconds);
    printf("\n");
    printf("Estimated time to crack DES is %0.8f ms\n", (overall_total * 1.0 / target_total) * milliseconds);

    hipMemcpy(result_host, result_device, sizeof(uint64_t), hipMemcpyDeviceToHost);

    if (*result_host != 0x0)
        printf("Key found: %lX\n", *result_host);


    free(result_host);
    hipFree(result_device);
    hipEventDestroy(start);
    hipEventDestroy(stop);

    return 0;
}


	.text
	.file	"des_cuda.hip"
	.globl	_Z32__device_stub__EncryptDES_devicemmPmm # -- Begin function _Z32__device_stub__EncryptDES_devicemmPmm
	.type	_Z32__device_stub__EncryptDES_devicemmPmm,@function
_Z32__device_stub__EncryptDES_devicemmPmm: # @_Z32__device_stub__EncryptDES_devicemmPmm
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	16(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17EncryptDES_devicemmPmm, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z32__device_stub__EncryptDES_devicemmPmm, .Lfunc_end0-_Z32__device_stub__EncryptDES_devicemmPmm
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI1_0:
	.quad	0x4130000000001000              # double 1048576.0000009537
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	%rsp, %rdi
	callq	hipEventCreate
	movl	$0, 20(%rsp)
	movl	$1, %edi
	movl	$8, %esi
	callq	calloc
	movq	%rax, %rbx
	leaq	8(%rsp), %r15
	movl	$8, %esi
	movq	%r15, %rdi
	callq	hipMalloc
	movq	(%r15), %rdi
	movl	$8, %edx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$S_TABLE, %edi
	movl	$_ZL11table_DES_S, %esi
	movl	$2048, %edx                     # imm = 0x800
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r14), %rdi
	callq	hipEventSynchronize
	movabsq	$1095216660735, %rdi            # imm = 0xFF000000FF
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_2
# %bb.1:
	movq	8(%rsp), %rdx
	movabsq	$-613193975641309357, %rdi      # imm = 0xF77D7F53F77D7F53
	movabsq	$-2339988673328426230, %rsi     # imm = 0xDF86B0B30BD2530A
	movl	$66051, %ecx                    # imm = 0x10203
	callq	_Z32__device_stub__EncryptDES_devicemmPmm
.LBB1_2:
	callq	hipDeviceSynchronize
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	24(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	20(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventElapsedTime
	movl	$.Lstr, %edi
	callq	puts@PLT
	movabsq	$1099511627775, %rsi            # imm = 0xFFFFFFFFFF
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	cvtss2sd	(%r14), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14), %xmm0
	mulsd	.LCPI1_0(%rip), %xmm0
	movl	$.L.str.4, %edi
	movb	$1, %al
	callq	printf
	movq	8(%rsp), %rsi
	movl	$8, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rsi
	testq	%rsi, %rsi
	je	.LBB1_4
# %bb.3:
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
.LBB1_4:
	movq	%rbx, %rdi
	callq	free
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipEventDestroy
	movq	(%rsp), %rdi
	callq	hipEventDestroy
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17EncryptDES_devicemmPmm, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$S_TABLE, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movl	$8192, %r9d                     # imm = 0x2000
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB3_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	S_TABLE,@object                 # @S_TABLE
	.local	S_TABLE
	.comm	S_TABLE,8192,16
	.type	_Z17EncryptDES_devicemmPmm,@object # @_Z17EncryptDES_devicemmPmm
	.section	.rodata,"a",@progbits
	.globl	_Z17EncryptDES_devicemmPmm
	.p2align	3, 0x0
_Z17EncryptDES_devicemmPmm:
	.quad	_Z32__device_stub__EncryptDES_devicemmPmm
	.size	_Z17EncryptDES_devicemmPmm, 8

	.type	_ZL11table_DES_S,@object        # @_ZL11table_DES_S
	.data
	.p2align	4, 0x0
_ZL11table_DES_S:
	.long	13                              # 0xd
	.long	1                               # 0x1
	.long	2                               # 0x2
	.long	15                              # 0xf
	.long	8                               # 0x8
	.long	13                              # 0xd
	.long	4                               # 0x4
	.long	8                               # 0x8
	.long	6                               # 0x6
	.long	10                              # 0xa
	.long	15                              # 0xf
	.long	3                               # 0x3
	.long	11                              # 0xb
	.long	7                               # 0x7
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	10                              # 0xa
	.long	12                              # 0xc
	.long	9                               # 0x9
	.long	5                               # 0x5
	.long	3                               # 0x3
	.long	6                               # 0x6
	.long	14                              # 0xe
	.long	11                              # 0xb
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	14                              # 0xe
	.long	12                              # 0xc
	.long	9                               # 0x9
	.long	7                               # 0x7
	.long	2                               # 0x2
	.long	7                               # 0x7
	.long	2                               # 0x2
	.long	11                              # 0xb
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	1                               # 0x1
	.long	7                               # 0x7
	.long	9                               # 0x9
	.long	4                               # 0x4
	.long	12                              # 0xc
	.long	10                              # 0xa
	.long	14                              # 0xe
	.long	8                               # 0x8
	.long	2                               # 0x2
	.long	13                              # 0xd
	.long	0                               # 0x0
	.long	15                              # 0xf
	.long	6                               # 0x6
	.long	12                              # 0xc
	.long	10                              # 0xa
	.long	9                               # 0x9
	.long	13                              # 0xd
	.long	0                               # 0x0
	.long	15                              # 0xf
	.long	3                               # 0x3
	.long	3                               # 0x3
	.long	5                               # 0x5
	.long	5                               # 0x5
	.long	6                               # 0x6
	.long	8                               # 0x8
	.long	11                              # 0xb
	.long	4                               # 0x4
	.long	13                              # 0xd
	.long	11                              # 0xb
	.long	0                               # 0x0
	.long	2                               # 0x2
	.long	11                              # 0xb
	.long	14                              # 0xe
	.long	7                               # 0x7
	.long	15                              # 0xf
	.long	4                               # 0x4
	.long	0                               # 0x0
	.long	9                               # 0x9
	.long	8                               # 0x8
	.long	1                               # 0x1
	.long	13                              # 0xd
	.long	10                              # 0xa
	.long	3                               # 0x3
	.long	14                              # 0xe
	.long	12                              # 0xc
	.long	3                               # 0x3
	.long	9                               # 0x9
	.long	5                               # 0x5
	.long	7                               # 0x7
	.long	12                              # 0xc
	.long	5                               # 0x5
	.long	2                               # 0x2
	.long	10                              # 0xa
	.long	15                              # 0xf
	.long	6                               # 0x6
	.long	8                               # 0x8
	.long	1                               # 0x1
	.long	6                               # 0x6
	.long	1                               # 0x1
	.long	6                               # 0x6
	.long	4                               # 0x4
	.long	11                              # 0xb
	.long	11                              # 0xb
	.long	13                              # 0xd
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	12                              # 0xc
	.long	1                               # 0x1
	.long	3                               # 0x3
	.long	4                               # 0x4
	.long	7                               # 0x7
	.long	10                              # 0xa
	.long	14                              # 0xe
	.long	7                               # 0x7
	.long	10                              # 0xa
	.long	9                               # 0x9
	.long	15                              # 0xf
	.long	5                               # 0x5
	.long	6                               # 0x6
	.long	0                               # 0x0
	.long	8                               # 0x8
	.long	15                              # 0xf
	.long	0                               # 0x0
	.long	14                              # 0xe
	.long	5                               # 0x5
	.long	2                               # 0x2
	.long	9                               # 0x9
	.long	3                               # 0x3
	.long	2                               # 0x2
	.long	12                              # 0xc
	.long	12                              # 0xc
	.long	10                              # 0xa
	.long	1                               # 0x1
	.long	15                              # 0xf
	.long	10                              # 0xa
	.long	4                               # 0x4
	.long	15                              # 0xf
	.long	2                               # 0x2
	.long	9                               # 0x9
	.long	7                               # 0x7
	.long	2                               # 0x2
	.long	12                              # 0xc
	.long	6                               # 0x6
	.long	9                               # 0x9
	.long	8                               # 0x8
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	6                               # 0x6
	.long	13                              # 0xd
	.long	1                               # 0x1
	.long	3                               # 0x3
	.long	13                              # 0xd
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	14                              # 0xe
	.long	0                               # 0x0
	.long	7                               # 0x7
	.long	11                              # 0xb
	.long	5                               # 0x5
	.long	3                               # 0x3
	.long	11                              # 0xb
	.long	8                               # 0x8
	.long	9                               # 0x9
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	3                               # 0x3
	.long	15                              # 0xf
	.long	2                               # 0x2
	.long	5                               # 0x5
	.long	12                              # 0xc
	.long	2                               # 0x2
	.long	9                               # 0x9
	.long	8                               # 0x8
	.long	5                               # 0x5
	.long	12                              # 0xc
	.long	15                              # 0xf
	.long	3                               # 0x3
	.long	10                              # 0xa
	.long	7                               # 0x7
	.long	11                              # 0xb
	.long	0                               # 0x0
	.long	14                              # 0xe
	.long	4                               # 0x4
	.long	1                               # 0x1
	.long	10                              # 0xa
	.long	7                               # 0x7
	.long	1                               # 0x1
	.long	6                               # 0x6
	.long	13                              # 0xd
	.long	0                               # 0x0
	.long	11                              # 0xb
	.long	8                               # 0x8
	.long	6                               # 0x6
	.long	13                              # 0xd
	.long	2                               # 0x2
	.long	14                              # 0xe
	.long	12                              # 0xc
	.long	11                              # 0xb
	.long	4                               # 0x4
	.long	2                               # 0x2
	.long	1                               # 0x1
	.long	12                              # 0xc
	.long	7                               # 0x7
	.long	4                               # 0x4
	.long	10                              # 0xa
	.long	7                               # 0x7
	.long	11                              # 0xb
	.long	13                              # 0xd
	.long	6                               # 0x6
	.long	1                               # 0x1
	.long	8                               # 0x8
	.long	5                               # 0x5
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	3                               # 0x3
	.long	15                              # 0xf
	.long	15                              # 0xf
	.long	10                              # 0xa
	.long	13                              # 0xd
	.long	3                               # 0x3
	.long	0                               # 0x0
	.long	9                               # 0x9
	.long	14                              # 0xe
	.long	8                               # 0x8
	.long	9                               # 0x9
	.long	6                               # 0x6
	.long	4                               # 0x4
	.long	11                              # 0xb
	.long	2                               # 0x2
	.long	8                               # 0x8
	.long	1                               # 0x1
	.long	12                              # 0xc
	.long	11                              # 0xb
	.long	7                               # 0x7
	.long	10                              # 0xa
	.long	1                               # 0x1
	.long	13                              # 0xd
	.long	14                              # 0xe
	.long	7                               # 0x7
	.long	2                               # 0x2
	.long	8                               # 0x8
	.long	13                              # 0xd
	.long	15                              # 0xf
	.long	6                               # 0x6
	.long	9                               # 0x9
	.long	15                              # 0xf
	.long	12                              # 0xc
	.long	0                               # 0x0
	.long	5                               # 0x5
	.long	9                               # 0x9
	.long	6                               # 0x6
	.long	10                              # 0xa
	.long	3                               # 0x3
	.long	4                               # 0x4
	.long	0                               # 0x0
	.long	5                               # 0x5
	.long	14                              # 0xe
	.long	3                               # 0x3
	.long	7                               # 0x7
	.long	13                              # 0xd
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	14                              # 0xe
	.long	11                              # 0xb
	.long	3                               # 0x3
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	6                               # 0x6
	.long	6                               # 0x6
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	0                               # 0x0
	.long	10                              # 0xa
	.long	3                               # 0x3
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	2                               # 0x2
	.long	7                               # 0x7
	.long	8                               # 0x8
	.long	2                               # 0x2
	.long	5                               # 0x5
	.long	12                              # 0xc
	.long	11                              # 0xb
	.long	1                               # 0x1
	.long	12                              # 0xc
	.long	10                              # 0xa
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	10                              # 0xa
	.long	3                               # 0x3
	.long	6                               # 0x6
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	6                               # 0x6
	.long	12                              # 0xc
	.long	10                              # 0xa
	.long	11                              # 0xb
	.long	1                               # 0x1
	.long	7                               # 0x7
	.long	13                              # 0xd
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	3                               # 0x3
	.long	5                               # 0x5
	.long	14                              # 0xe
	.long	11                              # 0xb
	.long	5                               # 0x5
	.long	12                              # 0xc
	.long	2                               # 0x2
	.long	7                               # 0x7
	.long	8                               # 0x8
	.long	2                               # 0x2
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	10                              # 0xa
	.long	13                              # 0xd
	.long	0                               # 0x0
	.long	7                               # 0x7
	.long	9                               # 0x9
	.long	0                               # 0x0
	.long	14                              # 0xe
	.long	9                               # 0x9
	.long	6                               # 0x6
	.long	3                               # 0x3
	.long	3                               # 0x3
	.long	4                               # 0x4
	.long	15                              # 0xf
	.long	6                               # 0x6
	.long	5                               # 0x5
	.long	10                              # 0xa
	.long	1                               # 0x1
	.long	2                               # 0x2
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	12                              # 0xc
	.long	5                               # 0x5
	.long	7                               # 0x7
	.long	14                              # 0xe
	.long	11                              # 0xb
	.long	12                              # 0xc
	.long	4                               # 0x4
	.long	11                              # 0xb
	.long	2                               # 0x2
	.long	15                              # 0xf
	.long	8                               # 0x8
	.long	1                               # 0x1
	.long	13                              # 0xd
	.long	1                               # 0x1
	.long	6                               # 0x6
	.long	10                              # 0xa
	.long	4                               # 0x4
	.long	13                              # 0xd
	.long	9                               # 0x9
	.long	0                               # 0x0
	.long	8                               # 0x8
	.long	6                               # 0x6
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	3                               # 0x3
	.long	8                               # 0x8
	.long	0                               # 0x0
	.long	7                               # 0x7
	.long	11                              # 0xb
	.long	4                               # 0x4
	.long	1                               # 0x1
	.long	15                              # 0xf
	.long	2                               # 0x2
	.long	14                              # 0xe
	.long	12                              # 0xc
	.long	3                               # 0x3
	.long	5                               # 0x5
	.long	11                              # 0xb
	.long	10                              # 0xa
	.long	5                               # 0x5
	.long	14                              # 0xe
	.long	2                               # 0x2
	.long	7                               # 0x7
	.long	12                              # 0xc
	.long	15                              # 0xf
	.long	3                               # 0x3
	.long	1                               # 0x1
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	7                               # 0x7
	.long	6                               # 0x6
	.long	15                              # 0xf
	.long	11                              # 0xb
	.long	2                               # 0x2
	.long	3                               # 0x3
	.long	8                               # 0x8
	.long	4                               # 0x4
	.long	14                              # 0xe
	.long	9                               # 0x9
	.long	12                              # 0xc
	.long	7                               # 0x7
	.long	0                               # 0x0
	.long	2                               # 0x2
	.long	1                               # 0x1
	.long	13                              # 0xd
	.long	10                              # 0xa
	.long	12                              # 0xc
	.long	6                               # 0x6
	.long	0                               # 0x0
	.long	9                               # 0x9
	.long	5                               # 0x5
	.long	11                              # 0xb
	.long	10                              # 0xa
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	13                              # 0xd
	.long	14                              # 0xe
	.long	8                               # 0x8
	.long	7                               # 0x7
	.long	10                              # 0xa
	.long	11                              # 0xb
	.long	1                               # 0x1
	.long	10                              # 0xa
	.long	3                               # 0x3
	.long	4                               # 0x4
	.long	15                              # 0xf
	.long	13                              # 0xd
	.long	4                               # 0x4
	.long	1                               # 0x1
	.long	2                               # 0x2
	.long	5                               # 0x5
	.long	11                              # 0xb
	.long	8                               # 0x8
	.long	6                               # 0x6
	.long	12                              # 0xc
	.long	7                               # 0x7
	.long	6                               # 0x6
	.long	12                              # 0xc
	.long	9                               # 0x9
	.long	0                               # 0x0
	.long	3                               # 0x3
	.long	5                               # 0x5
	.long	2                               # 0x2
	.long	14                              # 0xe
	.long	15                              # 0xf
	.long	9                               # 0x9
	.long	14                              # 0xe
	.long	0                               # 0x0
	.long	4                               # 0x4
	.long	15                              # 0xf
	.long	13                              # 0xd
	.long	7                               # 0x7
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	2                               # 0x2
	.long	14                              # 0xe
	.long	15                              # 0xf
	.long	2                               # 0x2
	.long	11                              # 0xb
	.long	13                              # 0xd
	.long	8                               # 0x8
	.long	1                               # 0x1
	.long	3                               # 0x3
	.long	10                              # 0xa
	.long	10                              # 0xa
	.long	6                               # 0x6
	.long	6                               # 0x6
	.long	12                              # 0xc
	.long	12                              # 0xc
	.long	11                              # 0xb
	.long	5                               # 0x5
	.long	9                               # 0x9
	.long	9                               # 0x9
	.long	5                               # 0x5
	.long	0                               # 0x0
	.long	3                               # 0x3
	.long	7                               # 0x7
	.long	8                               # 0x8
	.long	4                               # 0x4
	.long	15                              # 0xf
	.long	1                               # 0x1
	.long	12                              # 0xc
	.long	14                              # 0xe
	.long	8                               # 0x8
	.long	8                               # 0x8
	.long	2                               # 0x2
	.long	13                              # 0xd
	.long	4                               # 0x4
	.long	6                               # 0x6
	.long	9                               # 0x9
	.long	2                               # 0x2
	.long	1                               # 0x1
	.long	11                              # 0xb
	.long	7                               # 0x7
	.long	15                              # 0xf
	.long	5                               # 0x5
	.long	12                              # 0xc
	.long	11                              # 0xb
	.long	9                               # 0x9
	.long	3                               # 0x3
	.long	7                               # 0x7
	.long	14                              # 0xe
	.long	3                               # 0x3
	.long	10                              # 0xa
	.long	10                              # 0xa
	.long	0                               # 0x0
	.long	5                               # 0x5
	.long	6                               # 0x6
	.long	0                               # 0x0
	.long	13                              # 0xd
	.size	_ZL11table_DES_S, 2048

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"Targetting number of testing key - %lu\n"
	.size	.L.str.1, 40

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Time spent %0.8f ms\n"
	.size	.L.str.2, 21

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Estimated time to crack DES is %0.8f ms\n"
	.size	.L.str.4, 41

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Key found: %lX\n"
	.size	.L.str.5, 16

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17EncryptDES_devicemmPmm"
	.size	.L__unnamed_1, 27

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"S_TABLE"
	.size	.L__unnamed_2, 8

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Cuda Execution Report: "
	.size	.Lstr, 24

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z32__device_stub__EncryptDES_devicemmPmm
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym S_TABLE
	.addrsig_sym _Z17EncryptDES_devicemmPmm
	.addrsig_sym _ZL11table_DES_S
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17EncryptDES_devicemmPmm ; -- Begin function _Z17EncryptDES_devicemmPmm
	.globl	_Z17EncryptDES_devicemmPmm
	.p2align	8
	.type	_Z17EncryptDES_devicemmPmm,@function
_Z17EncryptDES_devicemmPmm:             ; @_Z17EncryptDES_devicemmPmm
; %bb.0:
	s_load_b256 s[4:11], s[0:1], 0x0
	s_mov_b64 s[2:3], 0
	s_waitcnt lgkmcnt(0)
	s_cmp_eq_u64 s[10:11], 0
	s_cbranch_scc1 .LBB0_22
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b32 s20, s[0:1], 0x20
	s_load_b32 s21, s[0:1], 0x2c
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	s_lshr_b64 s[12:13], s[4:5], 12
	s_mov_b32 s1, 0
	s_lshr_b64 s[18:19], s[4:5], 6
	s_and_b32 s27, s13, 0x10000
	s_lshr_b32 s33, s5, 7
	s_and_b32 s25, s19, 0x1000000
	s_mov_b32 s24, s1
	s_and_b32 s101, s5, 0x400
	s_and_b32 s100, s4, 0x200000
	s_lshr_b32 s23, s5, 13
	s_and_b32 s0, s33, 0x1000000
	s_or_b64 s[24:25], s[100:101], s[24:25]
	s_and_b32 s30, s23, 0x10000
	s_mov_b32 s31, s1
	s_or_b64 s[24:25], s[24:25], s[0:1]
	s_lshr_b32 s28, s5, 19
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s15, s20, s15
	s_lshr_b32 s20, s21, 16
	s_add_i32 s15, s15, s14
	s_and_b32 s13, s21, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s20, v[1:2]
	v_alignbit_b32 v5, s5, s4, 30
	s_mov_b32 s26, s1
	s_or_b64 s[24:25], s[24:25], s[30:31]
	s_lshr_b64 s[76:77], s[4:5], 18
	s_and_b32 s34, s28, 0x100
	s_mov_b32 s35, s1
	s_delay_alu instid0(VALU_DEP_2)
	v_mad_u64_u32 v[3:4], null, v2, s13, v[0:1]
	s_or_b64 s[24:25], s[24:25], s[26:27]
	s_and_b32 s37, s77, 0x100
	s_mov_b32 s36, s1
	s_or_b64 s[24:25], s[24:25], s[34:35]
	v_readfirstlane_b32 s13, v5
	s_bfe_u32 s22, s5, 0x10019
	s_delay_alu instid0(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v3
	s_lshr_b64 s[62:63], s[4:5], 24
	s_mov_b32 s23, s1
	s_or_b64 s[24:25], s[24:25], s[36:37]
	v_mul_lo_u32 v4, v3, s11
	v_mad_u64_u32 v[0:1], null, v3, s10, 0
	v_mov_b32_e32 v3, 0
	v_mul_lo_u32 v2, v2, s10
	s_lshr_b32 s38, s5, 4
	s_and_b32 s29, s63, 1
	s_mov_b32 s28, s1
	s_or_b64 s[22:23], s[24:25], s[22:23]
	s_lshl_b64 s[16:17], s[4:5], 3
	s_mov_b32 s39, s1
	s_and_b32 s42, s38, 0x20000
	s_and_b32 s38, s13, 0x2000000
	s_or_b64 s[22:23], s[22:23], s[28:29]
	s_and_b32 s41, s17, 0x2000000
	s_mov_b32 s40, s1
	s_or_b64 s[22:23], s[22:23], s[38:39]
	s_lshr_b64 s[96:97], s[4:5], 3
	s_mov_b32 s43, s1
	s_or_b64 s[22:23], s[22:23], s[40:41]
	v_add3_u32 v1, v1, v4, v2
	v_alignbit_b32 v2, s5, s4, 21
	s_lshr_b32 s46, s5, 10
	s_and_b32 s45, s97, 0x20000
	s_mov_b32 s44, s1
	s_or_b64 s[22:23], s[22:23], s[42:43]
	s_and_b32 s46, s46, 0x200
	s_lshr_b64 s[64:65], s[4:5], 9
	s_mov_b32 s47, s1
	s_or_b64 s[22:23], s[22:23], s[44:45]
	s_and_b32 s49, s65, 0x200
	s_lshr_b32 s14, s5, 16
	s_mov_b32 s48, s1
	v_readfirstlane_b32 s102, v2
	v_alignbit_b32 v2, s5, s4, 27
	s_or_b64 s[22:23], s[22:23], s[46:47]
	s_and_b32 s50, s14, 2
	s_lshr_b64 s[80:81], s[4:5], 15
	s_mov_b32 s51, s1
	s_or_b64 s[22:23], s[22:23], s[48:49]
	s_and_b32 s53, s81, 2
	s_mov_b32 s52, s1
	s_or_b64 s[22:23], s[22:23], s[50:51]
	v_readfirstlane_b32 s20, v2
	s_and_b32 s54, s102, 0x4000000
	s_lshl_b64 s[14:15], s[4:5], 12
	s_mov_b32 s55, s1
	s_or_b64 s[22:23], s[22:23], s[52:53]
	s_and_b32 s57, s15, 0x4000000
	s_mov_b32 s56, s1
	s_or_b64 s[22:23], s[22:23], s[54:55]
	s_and_b32 s58, s20, 0x40000
	s_lshl_b64 s[20:21], s[4:5], 6
	s_mov_b32 s59, s1
	s_or_b64 s[22:23], s[22:23], s[56:57]
	s_and_b32 s61, s21, 0x40000
	s_lshr_b32 s21, s5, 1
	s_mov_b32 s60, s1
	s_or_b64 s[22:23], s[22:23], s[58:59]
	s_and_b32 s68, s21, 0x400
	s_mov_b32 s69, s1
	s_or_b64 s[22:23], s[22:23], s[60:61]
	s_and_b32 s70, s33, 4
	s_mov_b32 s71, s1
	s_or_b64 s[22:23], s[22:23], s[68:69]
	s_and_b32 s73, s19, 4
	s_mov_b32 s72, s1
	s_or_b64 s[22:23], s[22:23], s[70:71]
	s_and_b32 s74, s12, 0x8000000
	s_lshl_b64 s[66:67], s[4:5], 21
	s_mov_b32 s75, s1
	s_or_b64 s[22:23], s[22:23], s[72:73]
	s_and_b32 s83, s67, 0x8000000
	s_mov_b32 s82, s1
	s_or_b64 s[22:23], s[22:23], s[74:75]
	s_and_b32 s84, s76, 0x80000
	s_lshl_b64 s[76:77], s[4:5], 15
	s_mov_b32 s85, s1
	s_or_b64 s[22:23], s[22:23], s[82:83]
	s_and_b32 s87, s77, 0x80000
	s_mov_b32 s86, s1
	s_or_b64 s[22:23], s[22:23], s[84:85]
	s_and_b32 s88, s62, 0x800
	s_lshl_b64 s[78:79], s[4:5], 9
	s_mov_b32 s89, s1
	s_or_b64 s[22:23], s[22:23], s[86:87]
	s_and_b32 s91, s79, 0x800
	s_mov_b32 s90, s1
	s_or_b64 s[22:23], s[22:23], s[88:89]
	s_and_b32 s92, s13, 8
	s_mov_b32 s93, s1
	s_or_b64 s[22:23], s[22:23], s[90:91]
	s_and_b32 s95, s17, 8
	s_mov_b32 s94, s1
	s_or_b64 s[22:23], s[22:23], s[92:93]
	s_and_b32 s96, s96, 0x10000000
	s_lshl_b64 s[62:63], s[4:5], 30
	s_mov_b32 s97, s1
	s_or_b64 s[22:23], s[22:23], s[94:95]
	s_and_b32 s99, s63, 0x10000000
	s_mov_b32 s98, s1
	s_or_b64 s[22:23], s[22:23], s[96:97]
	s_and_b32 s64, s64, 0x100000
	s_mov_b32 s65, s1
	s_lshl_b64 s[100:101], s[4:5], 24
	s_or_b64 s[22:23], s[22:23], s[98:99]
	s_and_b32 s31, s101, 0x100000
	s_mov_b32 s30, s1
	s_or_b64 s[22:23], s[22:23], s[64:65]
	s_and_b32 s80, s80, 0x1000
	s_mov_b32 s81, s1
	s_lshl_b64 s[26:27], s[4:5], 18
	s_or_b64 s[22:23], s[22:23], s[30:31]
	s_and_b32 s35, s27, 0x1000
	s_mov_b32 s34, s1
	s_lshl_b32 s17, s4, 16
	s_or_b64 s[22:23], s[22:23], s[80:81]
	s_and_b32 s24, s102, 16
	s_mov_b32 s25, s1
	s_and_b32 s47, s17, 2.0
	s_lshl_b32 s17, s4, 10
	s_or_b64 s[22:23], s[22:23], s[34:35]
	s_and_b32 s29, s15, 16
	s_and_b32 s31, s17, 0x400000
	s_and_b32 s27, s16, 0x4000
	s_or_b64 s[16:17], s[22:23], s[24:25]
	s_and_b32 s36, s20, 0x20000000
	s_mov_b32 s37, s1
	s_lshl_b32 s0, s4, 7
	s_or_b64 s[16:17], s[16:17], s[28:29]
	s_and_b32 s39, s0, 0x20000000
	s_mov_b32 s38, s1
	s_lshl_b32 s13, s4, 1
	s_or_b64 s[16:17], s[16:17], s[36:37]
	v_alignbit_b32 v2, s5, s4, 3
	s_and_b32 s41, s13, 0x200000
	s_or_b64 s[16:17], s[16:17], s[38:39]
	s_and_b32 s18, s18, 0x2000
	s_mov_b32 s19, s1
	s_lshl_b64 s[42:43], s[4:5], 27
	s_or_b64 s[16:17], s[16:17], s[40:41]
	s_and_b32 s43, s43, 0x2000
	s_mov_b32 s42, s1
	v_and_b32_e32 v2, 64, v2
	s_or_b64 s[16:17], s[16:17], s[18:19]
	s_and_b32 s12, s12, 32
	s_mov_b32 s13, s1
	s_or_b64 s[16:17], s[16:17], s[42:43]
	s_and_b32 s5, s100, 0x80000000
	s_and_b32 s15, s76, 2.0
	s_and_b32 s21, s78, 0x400000
	s_or_b64 s[12:13], s[16:17], s[12:13]
	v_or_b32_e32 v2, s5, v2
	s_and_b32 s45, s67, 32
	s_mov_b32 s46, s1
	s_lshl_b32 s22, s4, 4
	s_or_b32 s15, s12, s15
	s_or_b32 s21, s21, s27
	s_and_b32 s23, s22, 0x4000
	s_mov_b32 s22, s1
	s_and_b32 s19, s63, 64
	s_mov_b32 s18, s1
	s_or_b64 s[16:17], s[12:13], s[44:45]
	s_or_b64 s[24:25], s[46:47], s[30:31]
	s_or_b32 s5, s21, s15
	s_or_b64 s[12:13], s[24:25], s[16:17]
	s_or_b64 s[16:17], s[22:23], s[18:19]
	s_lshl_b32 s15, s4, 25
	v_or_b32_e32 v2, s5, v2
	s_lshl_b32 s5, s4, 19
	s_lshl_b32 s4, s4, 13
	s_and_b32 s22, s14, 0x8000
	s_and_b32 s20, s20, 0x80
	s_or_b64 s[12:13], s[16:17], s[12:13]
	s_and_b32 s17, s15, 0x80000000
	s_and_b32 s19, s5, 0x800000
	s_and_b32 s5, s4, 0x8000
	s_mov_b32 s4, s1
	s_and_b32 s15, s0, 0x80
	s_mov_b32 s14, s1
	s_and_b32 s21, s26, 0x800000
	s_or_b32 s20, s22, s20
	s_mov_b32 s16, s1
	s_or_b64 s[0:1], s[4:5], s[14:15]
	s_or_b32 s4, s20, s21
	s_or_b64 s[0:1], s[0:1], s[18:19]
	v_or_b32_e32 v16, s4, v2
	v_or3_b32 v17, 0, 0, 0
	s_or_b64 s[0:1], s[0:1], s[16:17]
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b64 s[0:1], s[0:1], s[12:13]
	s_getpc_b64 s[16:17]
	s_add_u32 s16, s16, S_TABLE@rel32@lo+4
	s_addc_u32 s17, s17, S_TABLE@rel32@hi+12
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
                                        ;       Child Loop BB0_16 Depth 3
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 27, v[0:1]
	v_lshlrev_b64 v[6:7], 18, v[0:1]
	v_lshlrev_b64 v[8:9], 9, v[0:1]
	v_lshlrev_b32_e32 v2, 28, v0
	v_lshlrev_b64 v[10:11], 19, v[0:1]
	v_lshlrev_b32_e32 v22, 3, v0
	v_and_b32_e32 v4, 0x8000000, v4
	v_and_b32_e32 v6, 0x80000, v6
	v_and_b32_e32 v8, 0x800, v8
	v_lshlrev_b32_e32 v23, 10, v0
	v_lshlrev_b64 v[12:13], 10, v[0:1]
	v_lshlrev_b64 v[14:15], 1, v[0:1]
	v_and_b32_e32 v10, 0x4000000, v10
	v_or3_b32 v4, v4, v6, v8
	v_lshlrev_b32_e32 v24, 17, v0
	v_and_b32_e32 v22, 0x80, v22
	v_and_b32_e32 v23, 0x8000, v23
	v_and_b32_e32 v12, 0x40000, v12
	v_and_or_b32 v2, 0x80000000, v2, v4
	v_and_b32_e32 v14, 0x400, v14
	v_and_b32_e32 v24, 0x800000, v24
	v_or3_b32 v25, v17, v22, v23
	v_lshlrev_b32_e32 v6, 20, v0
	v_or3_b32 v2, v2, 0, 0
	v_lshlrev_b32_e32 v8, 2, v0
	v_lshlrev_b64 v[18:19], 11, v[0:1]
	v_lshlrev_b32_e32 v4, 9, v0
	v_and_b32_e32 v5, 64, v5
	v_or3_b32 v2, v2, 0, v10
	v_lshlrev_b64 v[20:21], 2, v[0:1]
	v_alignbit_b32 v10, v1, v0, 7
	v_and_b32_e32 v4, 0x400000, v4
	v_lshlrev_b32_e32 v26, 12, v0
	v_or3_b32 v2, v2, v12, v14
	v_or3_b32 v14, v25, v24, 0
	v_and_b32_e32 v10, 0x200, v10
	v_lshlrev_b64 v[22:23], 26, v[0:1]
	v_lshlrev_b32_e32 v12, 1, v0
	v_and_or_b32 v2, v6, 2.0, v2
	v_and_b32_e32 v6, 0x4000, v8
	v_or3_b32 v8, v14, 0, 0
	v_and_b32_e32 v14, 0x2000000, v18
	v_lshlrev_b64 v[24:25], 3, v[0:1]
	v_or3_b32 v2, v2, 0, 0
	v_and_b32_e32 v7, 0x1000, v7
	v_or3_b32 v5, v8, v5, v6
	v_and_b32_e32 v6, 0x20000, v20
	v_alignbit_b32 v8, v1, v0, 6
	v_or3_b32 v2, v2, 0, v14
	v_lshrrev_b32_e32 v14, 15, v0
	v_or3_b32 v18, v5, v4, 0
	v_lshlrev_b64 v[4:5], 25, v[0:1]
	v_and_b32_e32 v4, 32, v11
	v_or3_b32 v2, v2, v6, v10
	v_and_b32_e32 v10, 0x200000, v12
	v_or3_b32 v6, v18, 0, 0
	v_and_b32_e32 v11, 0x2000, v23
	v_lshlrev_b32_e32 v20, 4, v0
	v_and_or_b32 v2, 0x20000000, v26, v2
	v_and_b32_e32 v8, 0x10000, v8
	v_or_b32_e32 v4, v6, v4
	v_and_b32_e32 v6, 0x1000000, v24
	v_and_b32_e32 v14, 0x100, v14
	v_or3_b32 v2, v2, 0, 0
	v_alignbit_b32 v12, v1, v0, 5
	v_or3_b32 v4, v4, v11, v10
	v_and_b32_e32 v10, 0x10000000, v20
	v_mov_b32_e32 v20, s1
	v_or3_b32 v2, v2, v6, v8
	v_and_b32_e32 v8, 16, v19
	v_or3_b32 v4, v4, 0, 0
	v_alignbit_b32 v6, v1, v0, 14
	v_and_b32_e32 v5, 0x100000, v5
	v_or3_b32 v2, v2, v14, v10
	v_lshrrev_b32_e32 v11, 23, v0
	v_or_b32_e32 v4, v4, v8
	v_and_b32_e32 v8, 0x800000, v12
	v_and_b32_e32 v6, 0x8000, v6
	v_or3_b32 v2, v2, 0, 0
	v_lshrrev_b32_e32 v10, 28, v0
	v_or3_b32 v4, v4, v7, v5
	v_and_b32_e32 v7, 0x80, v11
	v_alignbit_b32 v11, v1, v0, 31
	v_or3_b32 v2, v2, v8, v6
	v_and_b32_e32 v6, 8, v10
	v_or3_b32 v8, v4, 0, 0
	v_lshlrev_b64 v[4:5], 17, v[0:1]
	v_and_b32_e32 v4, 8, v25
	v_and_b32_e32 v10, 0x800, v13
	v_or3_b32 v2, v2, v7, v6
	v_alignbit_b32 v6, v1, v0, 13
	v_and_b32_e32 v9, 0x40000, v9
	v_and_b32_e32 v7, 0x80000, v5
	v_or3_b32 v8, v8, v4, v10
	v_or3_b32 v2, v2, 0, 0
	v_and_b32_e32 v6, 0x400000, v6
	v_alignbit_b32 v10, v1, v0, 22
	v_lshrrev_b64 v[4:5], 5, v[0:1]
	v_or3_b32 v4, v8, v7, 0
	v_and_b32_e32 v7, 64, v11
	v_or3_b32 v2, v2, 0, v6
	v_and_b32_e32 v6, 0x4000, v10
	v_lshrrev_b32_e32 v8, 4, v1
	v_or3_b32 v4, v4, 0, 0
	v_and_b32_e32 v5, 4, v5
	v_alignbit_b32 v10, v1, v0, 30
	v_or3_b32 v2, v2, v6, v7
	v_and_b32_e32 v6, 4, v8
	v_and_b32_e32 v8, 0x400, v21
	v_or3_b32 v7, v4, 0, v5
	v_lshrrev_b64 v[4:5], 6, v[0:1]
	v_lshrrev_b32_e32 v11, 12, v1
	v_or3_b32 v2, v2, v6, 0
	v_alignbit_b32 v6, v1, v0, 21
	v_or3_b32 v4, v7, v8, v9
	v_and_b32_e32 v9, 0x2000, v10
	v_lshrrev_b32_e32 v10, 7, v1
	v_or3_b32 v2, v2, 0, 0
	v_and_b32_e32 v8, 0x200000, v6
	v_lshrrev_b64 v[6:7], 13, v[0:1]
	v_or3_b32 v4, v4, 0, 0
	v_and_b32_e32 v6, 32, v10
	v_and_b32_e32 v5, 0x200, v5
	v_or3_b32 v2, v2, v8, v9
	v_and_b32_e32 v8, 2, v11
	v_or3_b32 v4, v4, 0, 0
	v_and_b32_e32 v7, 2, v7
	v_lshrrev_b32_e32 v9, 6, v1
	v_lshrrev_b32_e32 v10, 15, v1
	v_or3_b32 v2, v2, v6, v8
	v_alignbit_b32 v6, v1, v0, 29
	v_or3_b32 v7, v4, v7, v5
	v_and_b32_e32 v8, 0x20000, v15
	v_lshrrev_b64 v[4:5], 21, v[0:1]
	v_or3_b32 v2, v2, 0, 0
	v_and_b32_e32 v6, 0x100000, v6
	s_mov_b32 s0, 0
	v_or3_b32 v4, v7, v8, 0
	v_and_b32_e32 v8, 0x1000, v9
	v_and_b32_e32 v9, 16, v10
	v_or3_b32 v2, v2, 0, v6
	v_lshrrev_b64 v[6:7], 14, v[0:1]
	v_or3_b32 v6, v4, 0, 0
	v_and_b32_e32 v10, 1, v5
	v_lshrrev_b64 v[4:5], 7, v[0:1]
	v_or3_b32 v2, v2, v8, v9
	v_bfe_u32 v4, v1, 20, 1
	v_and_b32_e32 v7, 0x100, v7
	v_or3_b32 v6, v6, 0, v10
	v_mov_b32_e32 v9, v16
	v_and_b32_e32 v5, 0x10000, v5
	v_or3_b32 v2, v2, v4, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_or3_b32 v5, v6, v7, v5
	v_or3_b32 v4, v2, 0, 0
.LBB0_3:                                ; %NodeBlock749
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_16 Depth 3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[6:7], 1, v[4:5]
	v_alignbit_b32 v8, v5, v4, 27
	v_mov_b32_e32 v2, v9
	s_cmp_lt_i32 s0, 8
	v_and_b32_e32 v11, 0xffffff, v7
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_and_b32_e32 v6, 0xeffffffe, v6
	v_and_b32_e32 v8, 0x10000001, v8
	v_or_b32_e32 v10, v8, v6
	s_cbranch_scc1 .LBB0_6
; %bb.4:                                ; %NodeBlock
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_cmp_gt_i32 s0, 14
	s_cbranch_scc0 .LBB0_7
; %bb.5:                                ; %LeafBlock747
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_cmp_lg_u32 s0, 15
	s_mov_b32 s5, 0
	s_cselect_b32 s4, -1, 0
	s_branch .LBB0_8
.LBB0_6:                                ;   in Loop: Header=BB0_3 Depth=2
	s_mov_b32 s5, -1
	s_mov_b32 s4, 0
	s_branch .LBB0_11
.LBB0_7:                                ;   in Loop: Header=BB0_3 Depth=2
	s_mov_b32 s5, -1
	s_mov_b32 s4, 0
.LBB0_8:                                ; %Flow751
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_and_not1_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccnz .LBB0_10
; %bb.9:                                ; %LeafBlock745
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_cmp_lg_u32 s0, 8
	s_cselect_b32 s4, -1, 0
.LBB0_10:                               ; %Flow752
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_mov_b32 s5, 0
.LBB0_11:                               ; %Flow
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_b32 vcc_lo, exec_lo, s5
	s_cbranch_vccz .LBB0_13
; %bb.12:                               ; %LeafBlock
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_cmp_gt_i32 s0, 1
	s_cselect_b32 s4, -1, 0
.LBB0_13:                               ; %Flow753
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 vcc_lo, exec_lo, s4
	s_cbranch_vccnz .LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_3 Depth=2
	v_lshlrev_b64 v[6:7], 1, v[10:11]
	v_alignbit_b32 v4, v5, v4, 26
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_and_b32_e32 v4, 0x10000001, v4
	v_and_b32_e32 v5, 0xeffffffe, v6
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_and_b32_e32 v11, 0xffffff, v7
	v_or_b32_e32 v10, v5, v4
.LBB0_15:                               ;   in Loop: Header=BB0_3 Depth=2
	v_dual_mov_b32 v13, 0 :: v_dual_and_b32 v12, 1, v2
	v_lshlrev_b32_e32 v19, 1, v2
	v_and_b32_e32 v21, 8, v2
	v_lshlrev_b32_e32 v18, 7, v2
	s_delay_alu instid0(VALU_DEP_4)
	v_alignbit_b32 v4, v12, v2, 31
	v_and_b32_e32 v7, 0x10000, v2
	v_and_b32_e32 v5, 12, v19
	v_lshlrev_b32_e32 v6, 1, v21
	v_and_b32_e32 v14, 32, v19
	v_lshlrev_b32_e32 v22, 5, v2
	v_and_b32_e32 v15, 0x3c0000, v18
	v_lshlrev_b64 v[8:9], 9, v[2:3]
	v_or3_b32 v6, v5, v4, v6
	v_lshlrev_b64 v[4:5], 11, v[2:3]
	v_and_or_b32 v9, 0x8000, v2, v7
	v_and_or_b32 v23, 0x3c000, v22, v15
	v_lshlrev_b32_e32 v26, 15, v12
	v_or_b32_e32 v4, v6, v14
	v_lshlrev_b64 v[14:15], 13, v[2:3]
	v_and_b32_e32 v14, 0xc000000, v8
	v_alignbit_b32 v28, v11, v10, 18
	v_bfe_u32 v12, v10, 24, 1
	v_lshl_or_b32 v29, v21, 3, v4
	v_lshl_or_b32 v4, v9, 7, v23
	v_and_b32_e32 v23, 3, v5
	v_and_b32_e32 v21, 0x100000, v2
	v_and_b32_e32 v25, 0xc0, v15
	v_and_b32_e32 v15, 0x10000, v10
	v_lshl_or_b32 v9, v9, 9, v4
	v_lshlrev_b64 v[4:5], 3, v[2:3]
	v_lshrrev_b32_e32 v5, 26, v10
	v_and_b32_e32 v27, 0x3000, v22
	v_alignbit_b32 v22, v11, v10, 3
	v_or_b32_e32 v9, v9, v14
	v_and_or_b32 v14, 0x80000, v2, v21
	v_and_b32_e32 v5, 2, v5
	v_and_b32_e32 v21, 4, v28
	v_alignbit_b32 v30, v11, v10, 10
	v_and_b32_e32 v24, 8, v22
	v_lshl_or_b32 v9, v14, 9, v9
	v_or3_b32 v5, v15, v5, v12
	v_and_b32_e32 v12, 0x1800000, v2
	v_and_b32_e32 v31, 16, v30
	v_lshrrev_b32_e32 v32, 5, v10
	v_lshlrev_b32_e32 v33, 3, v10
	v_or_b32_e32 v5, v5, v21
	v_lshl_or_b32 v9, v14, 11, v9
	v_lshlrev_b64 v[14:15], 11, v[12:13]
	v_lshlrev_b64 v[21:22], 13, v[12:13]
	v_and_b32_e32 v12, 0x18000000, v2
	v_or3_b32 v5, v5, v24, v31
	v_and_b32_e32 v34, 64, v33
	v_lshlrev_b64 v[6:7], 15, v[2:3]
	v_or3_b32 v31, 0, v23, v15
	v_or3_b32 v9, v9, 0, v14
	v_and_or_b32 v5, v32, 32, v5
	v_lshlrev_b64 v[14:15], 13, v[12:13]
	v_lshlrev_b64 v[23:24], 15, v[12:13]
	v_lshrrev_b32_e32 v12, 15, v10
	v_lshlrev_b32_e32 v32, 8, v10
	v_or_b32_e32 v5, v5, v34
	v_or3_b32 v22, v22, v31, v25
	v_or3_b32 v9, v21, v9, 0
	v_and_b32_e32 v7, 0x7000, v7
	v_and_b32_e32 v21, 0x100, v32
	v_and_or_b32 v5, 0x80, v12, v5
	v_or3_b32 v12, v15, v22, v24
	v_or3_b32 v9, v14, v9, v23
	v_lshrrev_b32_e32 v14, 8, v10
	v_lshrrev_b32_e32 v23, 1, v10
	v_or_b32_e32 v5, v5, v21
	v_or3_b32 v7, v12, v7, v26
	v_and_b32_e32 v12, 0x400, v33
	v_lshlrev_b32_e32 v24, 4, v10
	v_lshrrev_b64 v[21:22], 10, v[10:11]
	v_and_or_b32 v5, 0x200, v14, v5
	v_lshrrev_b64 v[14:15], 3, v[10:11]
	v_and_b32_e32 v25, 0xf80, v4
	v_and_b32_e32 v14, 0x800, v23
	v_and_b32_e32 v21, 0x1000, v24
	v_or_b32_e32 v5, v5, v12
	v_lshlrev_b32_e32 v12, 10, v10
	v_or_b32_e32 v31, v25, v27
	v_alignbit_b32 v23, v11, v10, 9
	v_and_b32_e32 v24, 0x2000, v30
	v_and_b32_e32 v25, 0x4000, v33
	v_or3_b32 v5, v5, v14, v21
	v_and_b32_e32 v14, 0x8000, v12
	v_and_b32_e32 v21, 0x20000, v23
	v_and_b32_e32 v26, 0x2000, v11
	v_lshlrev_b32_e32 v23, 17, v10
	v_or3_b32 v5, v5, v24, v25
	v_lshlrev_b32_e32 v27, 1, v10
	v_and_b32_e32 v12, 0x80000, v12
	v_or3_b32 v25, v26, 0, 0
	v_lshrrev_b32_e32 v24, 4, v10
	v_or3_b32 v5, v5, v14, v21
	v_and_b32_e32 v14, 0x100000, v27
	v_lshlrev_b32_e32 v21, 18, v10
	v_or3_b32 v25, v25, 0, 0
	v_and_b32_e32 v24, 0x200000, v24
	v_and_or_b32 v5, 0x40000, v23, v5
	v_alignbit_b32 v23, v11, v10, 30
	v_and_b32_e32 v21, 0x400000, v21
	v_or3_b32 v25, v25, 0, 0
	v_and_b32_e32 v26, 0x800000, v32
	v_or3_b32 v5, v5, v12, v14
	v_and_b32_e32 v12, 0x1000000, v23
	v_alignbit_b32 v23, v11, v10, 2
	v_or3_b32 v25, v25, 0, 0
	v_and_b32_e32 v14, 0x2000000, v28
	v_or3_b32 v5, v5, v24, v21
	v_alignbit_b32 v21, v11, v10, 21
	v_and_b32_e32 v30, 0x4000000, v30
	v_or3_b32 v25, v25, 0, 0
	v_and_b32_e32 v32, 0x8000000, v23
	v_or3_b32 v5, v5, v26, v12
	v_lshrrev_b64 v[23:24], 11, v[10:11]
	v_and_b32_e32 v12, 0x10000000, v21
	v_alignbit_b32 v21, v11, v10, 11
	v_or3_b32 v23, v25, 0, 0
	v_or3_b32 v5, v5, v14, v30
	v_lshrrev_b64 v[25:26], 20, v[10:11]
	v_or3_b32 v9, v9, 0, 0
	v_and_b32_e32 v14, 0x20000000, v21
	v_and_b32_e32 v21, 2.0, v28
	v_or3_b32 v23, v23, 0, 0
	v_or3_b32 v5, v5, v32, v12
	v_and_b32_e32 v12, 0x80000000, v27
	v_and_b32_e32 v30, 1, v26
	v_lshlrev_b64 v[25:26], 2, v[10:11]
	v_or3_b32 v23, v23, 0, 0
	v_or3_b32 v5, v5, v14, v21
	v_and_b32_e32 v21, 2, v24
	v_and_b32_e32 v24, 4, v15
	v_lshrrev_b64 v[14:15], 12, v[10:11]
	v_or3_b32 v23, v23, 0, v30
	v_or3_b32 v5, v5, v12, 0
	v_and_b32_e32 v12, 8, v26
	v_and_b32_e32 v14, 16, v22
	v_lshrrev_b64 v[27:28], 2, v[10:11]
	v_or3_b32 v23, v23, v21, v24
	v_or3_b32 v5, v5, 0, 0
	v_lshlrev_b64 v[21:22], 12, v[10:11]
	v_and_b32_e32 v25, 32, v26
	v_and_b32_e32 v21, 64, v15
	v_or3_b32 v12, v23, v12, v14
	v_or3_b32 v5, v5, 0, 0
	v_lshrrev_b64 v[23:24], 9, v[10:11]
	v_and_b32_e32 v14, 0x80, v28
	v_and_b32_e32 v23, 0x100, v22
	v_or3_b32 v12, v12, v25, v21
	v_or3_b32 v5, v5, 0, 0
	v_and_b32_e32 v21, 0x200, v15
	v_and_b32_e32 v25, 0x400, v24
	v_and_b32_e32 v26, 0x800, v15
	v_or3_b32 v12, v12, v14, v23
	v_or3_b32 v5, v5, 0, 0
	v_lshlrev_b64 v[14:15], 7, v[10:11]
	v_lshlrev_b64 v[23:24], 5, v[10:11]
	v_and_b32_e32 v14, 0x1000, v22
	v_or3_b32 v12, v12, v21, v25
	v_or3_b32 v5, v5, 0, 0
	v_or3_b32 v7, v7, 0, 0
	v_and_b32_e32 v15, 0x4000, v15
	v_and_b32_e32 v21, 0x8000, v24
	v_or3_b32 v12, v12, v26, v14
	v_or3_b32 v5, v5, 0, 0
	v_or3_b32 v9, v9, v29, v31
	s_mov_b32 s14, 0
	s_mov_b64 s[4:5], 0
	v_or3_b32 v12, v12, v15, v21
	v_or3_b32 v5, v5, 0, 0
	s_mov_b64 s[12:13], 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v15, v12, v7
	v_xor_b32_e32 v14, v5, v9
.LBB0_16:                               ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_3 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshrrev_b64 v[21:22], s4, v[14:15]
	v_and_b32_e32 v5, 63, v21
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v21, s15, s12, v5
	v_add_co_ci_u32_e64 v22, null, s13, 0, s15
	s_add_u32 s12, s12, 64
	s_addc_u32 s13, s13, 0
	s_add_u32 s4, s4, 6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[21:22], 2, v[21:22]
	s_addc_u32 s5, s5, 0
	v_add_co_u32 v21, vcc_lo, v21, s16
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v22, vcc_lo, s17, v22, vcc_lo
	global_load_b32 v5, v[21:22], off
	s_waitcnt vmcnt(0)
	v_lshl_or_b32 v13, v5, s14, v13
	s_add_i32 s14, s14, 4
	s_cmpk_eq_i32 s12, 0x200
	s_cbranch_scc0 .LBB0_16
; %bb.17:                               ;   in Loop: Header=BB0_3 Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b32_e32 v5, 11, v13
	v_lshlrev_b32_e32 v7, 16, v13
	v_lshlrev_b32_e32 v9, 3, v13
	v_lshlrev_b32_e32 v12, 24, v13
	v_lshlrev_b32_e32 v14, 21, v13
	v_and_b32_e32 v5, 0x800, v5
	v_and_b32_e32 v7, 0x20000, v7
	v_and_b32_e32 v9, 32, v9
	v_and_b32_e32 v12, 0x8000000, v12
	v_and_b32_e32 v14, 0x2000000, v14
	v_lshlrev_b32_e32 v15, 5, v13
	v_lshlrev_b32_e32 v21, 14, v13
	v_or3_b32 v5, v7, v5, v9
	s_add_i32 s0, s0, 1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_and_b32_e32 v7, 0x400, v15
	v_and_b32_e32 v9, 0x100000, v21
	s_delay_alu instid0(VALU_DEP_3)
	v_or3_b32 v5, v5, v12, v14
	v_lshrrev_b32_e32 v12, 7, v13
	v_bfe_u32 v14, v13, 7, 1
	v_lshlrev_b32_e32 v21, 12, v13
	v_and_b32_e32 v22, 0x2000, v15
	v_or3_b32 v5, v5, v7, v9
	v_lshlrev_b32_e32 v7, 17, v13
	v_lshrrev_b32_e32 v9, 6, v13
	v_and_b32_e32 v21, 0x200000, v21
	v_and_b32_e32 v12, 8, v12
	v_or3_b32 v5, v5, v14, v22
	v_lshlrev_b32_e32 v14, 4, v13
	v_lshlrev_b32_e32 v22, 9, v13
	v_and_b32_e32 v7, 0x30000000, v7
	v_and_b32_e32 v23, 0x80, v9
	v_or3_b32 v5, v5, v21, v12
	v_lshlrev_b32_e32 v12, 15, v13
	v_and_b32_e32 v14, 0x40000, v14
	v_and_b32_e32 v21, 0x1000000, v22
	v_and_b32_e32 v22, 0x400000, v15
	v_or3_b32 v5, v5, v7, v23
	v_lshrrev_b32_e32 v7, 13, v13
	v_and_b32_e32 v12, 0x80000000, v12
	v_and_b32_e32 v23, 0x1000, v9
	v_and_b32_e32 v9, 0x10000, v9
	v_or3_b32 v5, v5, v14, v21
	v_lshlrev_b32_e32 v14, 6, v13
	v_lshrrev_b32_e32 v21, 19, v13
	v_and_b32_e32 v7, 64, v7
	v_and_b32_e32 v15, 2.0, v15
	v_or3_b32 v5, v5, v12, v22
	v_lshrrev_b32_e32 v12, 15, v13
	v_and_b32_e32 v14, 0x4000000, v14
	v_and_b32_e32 v21, 4, v21
	s_cmp_eq_u32 s0, 16
	v_or3_b32 v5, v5, v23, v7
	v_lshrrev_b32_e32 v7, 10, v13
	v_and_b32_e32 v22, 0x100, v12
	v_and_b32_e32 v12, 0x8000, v12
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_or3_b32 v5, v5, v14, v21
	v_lshrrev_b32_e32 v14, 22, v13
	v_lshrrev_b32_e32 v21, 8, v13
	v_and_b32_e32 v7, 0x4000, v7
	v_or3_b32 v5, v5, v9, v22
	v_lshrrev_b32_e32 v9, 27, v13
	v_lshrrev_b32_e32 v13, 20, v13
	v_and_b32_e32 v14, 16, v14
	v_and_b32_e32 v22, 0x80000, v21
	v_or3_b32 v5, v5, v7, v15
	v_and_b32_e32 v7, 2, v9
	v_and_b32_e32 v9, 0x200, v13
	v_and_b32_e32 v13, 0x800000, v21
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_or3_b32 v5, v5, v14, v22
	v_or3_b32 v5, v5, v7, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_or3_b32 v5, v5, v12, v13
	v_xor_b32_e32 v9, v5, v20
	s_cbranch_scc1 .LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_3 Depth=2
	v_mov_b32_e32 v4, v10
	v_dual_mov_b32 v20, v2 :: v_dual_mov_b32 v5, v11
	s_branch .LBB0_3
.LBB0_19:                               ;   in Loop: Header=BB0_2 Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_4)
	v_dual_mov_b32 v10, v3 :: v_dual_lshlrev_b32 v33, 2, v9
	v_lshrrev_b32_e32 v7, 7, v9
	v_lshrrev_b32_e32 v15, 1, v9
	v_lshlrev_b32_e32 v22, 8, v9
	v_lshlrev_b64 v[13:14], 20, v[9:10]
	v_lshlrev_b64 v[20:21], 29, v[9:10]
	v_and_b32_e32 v20, 0x400000, v7
	v_lshrrev_b32_e32 v7, 19, v9
	v_and_b32_e32 v41, 0x100000, v15
	v_lshrrev_b32_e32 v43, 6, v2
	v_and_b32_e32 v35, 0x4000, v14
	v_lshrrev_b32_e32 v14, 10, v9
	v_and_b32_e32 v39, 16, v7
	v_lshrrev_b32_e32 v7, 24, v2
	v_and_b32_e32 v42, 0x10000000, v22
	v_lshlrev_b64 v[22:23], 26, v[9:10]
	v_and_b32_e32 v40, 0x1000, v14
	v_lshlrev_b64 v[14:15], 17, v[9:10]
	v_lshrrev_b32_e32 v14, 15, v2
	v_and_b32_e32 v7, 0x80, v7
	v_and_b32_e32 v22, 0x800000, v43
	v_lshlrev_b64 v[28:29], 30, v[2:3]
	v_and_b32_e32 v44, 0x80000000, v4
	v_and_b32_e32 v14, 0x8000, v14
	v_and_or_b32 v7, 0x200000, v2, v7
	v_lshrrev_b32_e32 v28, 18, v2
	v_lshrrev_b32_e32 v47, 9, v2
	v_lshlrev_b64 v[24:25], 12, v[2:3]
	v_lshlrev_b64 v[26:27], 21, v[2:3]
	v_or3_b32 v7, v7, v14, v22
	v_and_b32_e32 v14, 32, v28
	v_and_b32_e32 v22, 0x2000, v47
	v_lshlrev_b64 v[30:31], 27, v[2:3]
	v_and_b32_e32 v8, 0x20000000, v8
	v_or_b32_e32 v7, v7, v44
	v_and_b32_e32 v25, 0x80, v25
	v_and_b32_e32 v45, 0x8000, v27
	v_lshrrev_b32_e32 v44, 12, v2
	v_and_b32_e32 v30, 0x2000, v31
	v_or3_b32 v7, v7, v14, v22
	v_lshrrev_b32_e32 v22, 3, v2
	v_lshlrev_b32_e32 v31, 6, v2
	v_lshlrev_b64 v[27:28], 18, v[2:3]
	v_and_b32_e32 v46, 0x800000, v29
	v_or_b32_e32 v7, v7, v8
	v_and_b32_e32 v27, 0x80000000, v18
	v_lshlrev_b32_e32 v14, 4, v2
	v_and_b32_e32 v22, 0x800, v22
	v_and_b32_e32 v31, 0x80000, v31
	v_or3_b32 v25, 0, v25, v45
	v_and_or_b32 v44, v44, 8, v7
	v_lshlrev_b64 v[7:8], 24, v[2:3]
	v_and_b32_e32 v28, 32, v28
	v_lshlrev_b32_e32 v47, 13, v2
	v_and_b32_e32 v7, 0x200000, v14
	v_and_b32_e32 v6, 0x8000000, v6
	v_or3_b32 v14, v25, v46, v27
	v_or3_b32 v22, v44, v22, v31
	v_and_b32_e32 v25, 0x20000000, v47
	v_and_b32_e32 v8, 8, v8
	v_lshlrev_b32_e32 v27, 10, v2
	v_or3_b32 v14, v14, v28, v30
	v_or_b32_e32 v6, v22, v6
	v_lshlrev_b32_e32 v22, 19, v2
	v_and_b32_e32 v19, 0x800, v19
	v_and_b32_e32 v27, 0x80000, v27
	v_or3_b32 v7, v14, v7, v25
	v_or3_b32 v6, v6, 0, 0
	v_and_b32_e32 v14, 0x8000000, v22
	v_and_b32_e32 v22, 2, v43
	v_and_b32_e32 v4, 0x200, v4
	v_or3_b32 v7, v7, v8, v19
	v_or3_b32 v6, v6, 0, 0
	v_and_b32_e32 v8, 16, v15
	v_and_b32_e32 v15, 0x20000, v24
	v_and_b32_e32 v19, 0x2000000, v26
	v_or3_b32 v7, v7, v27, v14
	v_or3_b32 v4, v6, v22, v4
	v_lshrrev_b32_e32 v5, 25, v9
	v_lshrrev_b32_e32 v32, 16, v9
	v_and_b32_e32 v22, 2, v29
	v_or3_b32 v7, v7, 0, 0
	v_or3_b32 v4, v4, v15, v19
	v_and_b32_e32 v5, 64, v5
	v_and_b32_e32 v15, 0x200, v18
	v_lshlrev_b32_e32 v18, 16, v2
	v_lshlrev_b32_e32 v2, 25, v2
	v_or3_b32 v7, v7, 0, 0
	v_and_or_b32 v4, 0x4000, v32, v4
	v_lshlrev_b64 v[11:12], 11, v[9:10]
	v_and_b32_e32 v34, 2.0, v33
	v_and_b32_e32 v18, 0x20000, v18
	v_and_b32_e32 v2, 0x2000000, v2
	v_or3_b32 v7, v7, v22, v15
	v_or3_b32 v4, v4, v5, v20
	v_and_b32_e32 v12, 64, v12
	v_lshlrev_b32_e32 v37, 6, v9
	v_lshrrev_b32_e32 v5, 13, v9
	v_or3_b32 v2, v7, v18, v2
	v_or_b32_e32 v4, v4, v34
	v_and_b32_e32 v36, 0x400000, v21
	v_and_b32_e32 v38, 2.0, v37
	v_lshlrev_b32_e32 v19, 12, v9
	v_lshrrev_b32_e32 v18, 4, v9
	v_or3_b32 v2, v2, v12, v35
	v_or3_b32 v12, v4, v39, v40
	v_and_b32_e32 v7, 4, v5
	v_lshlrev_b64 v[4:5], 23, v[9:10]
	v_and_b32_e32 v6, 0x1000, v23
	v_lshlrev_b32_e32 v14, 3, v9
	v_and_b32_e32 v15, 0x10000000, v19
	v_lshlrev_b32_e32 v19, 5, v9
	v_lshlrev_b32_e32 v20, 14, v9
	v_and_b32_e32 v4, 0x400, v18
	v_or3_b32 v2, v2, v36, v38
	v_or3_b32 v10, v12, v41, v42
	v_and_b32_e32 v14, 0x100000, v14
	v_and_b32_e32 v12, 0x40000, v19
	v_and_b32_e32 v18, 0x4000000, v20
	v_or3_b32 v2, v2, v8, v6
	v_or3_b32 v4, v10, v7, v4
	v_and_b32_e32 v5, 4, v5
	v_and_b32_e32 v6, 0x400, v9
	v_lshlrev_b32_e32 v7, 9, v9
	v_lshlrev_b32_e32 v8, 18, v9
	v_or3_b32 v2, v2, v14, v15
	v_or3_b32 v4, v4, v12, v18
	v_and_b32_e32 v10, 1, v21
	v_and_b32_e32 v7, 0x40000, v7
	v_and_b32_e32 v8, 0x4000000, v8
	v_or3_b32 v2, v2, v5, v6
	v_or3_b32 v4, v4, 0, 0
	v_bfe_u32 v5, v9, 7, 1
	v_and_b32_e32 v6, 0x100, v33
	s_mov_b32 s0, exec_lo
	v_or3_b32 v2, v2, v7, v8
	v_or3_b32 v4, v4, 0, 0
	v_and_b32_e32 v7, 0x10000, v11
	v_and_b32_e32 v8, 0x1000000, v13
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_or3_b32 v2, v2, 0, 0
	v_or3_b32 v4, v4, v5, v6
	v_and_b32_e32 v5, 0x100, v37
	v_lshlrev_b32_e32 v6, 15, v9
	v_lshlrev_b32_e32 v9, 24, v9
	v_or3_b32 v2, v2, 0, 0
	v_or3_b32 v4, v4, v7, v8
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_and_b32_e32 v6, 0x10000, v6
	v_and_b32_e32 v7, 0x1000000, v9
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_or3_b32 v2, v2, v10, v5
	v_or3_b32 v4, v4, 0, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_or3_b32 v5, v2, v6, v7
	v_or3_b32 v4, v4, 0, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u64_e64 s[6:7], v[4:5]
	s_cbranch_execz .LBB0_21
; %bb.20:                               ;   in Loop: Header=BB0_2 Depth=1
	v_dual_mov_b32 v4, s6 :: v_dual_mov_b32 v5, s7
	global_store_b64 v3, v[4:5], s[8:9]
.LBB0_21:                               ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	v_add_co_u32 v0, vcc_lo, v0, 1
	s_add_u32 s2, s2, 1
	v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
	s_addc_u32 s3, s3, 0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u64 s[2:3], s[10:11]
	s_cbranch_scc1 .LBB0_2
.LBB0_22:                               ; %._crit_edge
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17EncryptDES_devicemmPmm
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 48
		.amdhsa_next_free_sgpr 103
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z17EncryptDES_devicemmPmm, .Lfunc_end0-_Z17EncryptDES_devicemmPmm
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 5544
; NumSgprs: 105
; NumVgprs: 48
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 13
; VGPRBlocks: 5
; NumSGPRsForWavesPerEU: 105
; NumVGPRsForWavesPerEU: 48
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	S_TABLE                 ; @S_TABLE
	.type	S_TABLE,@object
	.section	.bss,"aw",@nobits
	.globl	S_TABLE
	.p2align	4, 0x0
S_TABLE:
	.zero	8192
	.size	S_TABLE, 8192

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym S_TABLE
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           8
        .value_kind:     by_value
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           8
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17EncryptDES_devicemmPmm
    .private_segment_fixed_size: 0
    .sgpr_count:     105
    .sgpr_spill_count: 0
    .symbol:         _Z17EncryptDES_devicemmPmm.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     48
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
