// File: /workspace/github_cpp_makefile_star2_O3/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: hmac(unsigned long, unsigned long)
static uint64_t
hmac(uint64_t x, uint64_t y) {
// Constants are the integer part of the sines of integers (in radians) * 2^32.
   static const uint32_t k[64] = {
      0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
      0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
      0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
      0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
      0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa ,
      0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8 ,
      0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed ,
      0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a ,
      0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c ,
      0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70 ,
      0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05 ,
      0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665 ,
      0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039 ,
      0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1 ,
      0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1 ,
      0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 };
 
// r specifies the per-round shift amounts
   static const uint32_t r[] = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
                                5,  9, 14, 20, 5,  9, 14, 20, 5,  9, 14, 20, 5,  9, 14, 20,
                                4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
                                6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
 
   uint32_t w[16];
   uint32_t a, b, c, d, f, g, temp;
   int i;
 
   a = 0x67452301u;
   b = 0xefcdab89u;
   c = 0x98badcfeu;
   d = 0x10325476u;

   for (i=0;i<16;i+=4) {
      w[i] = (uint32_t)(x << 32);
      w[i+1] = (uint32_t)x;
      w[i+2] = (uint32_t)(y << 32);
      w[i+3] = (uint32_t)y;
   }

   for(i = 0; i<64; i++) {
      if (i < 16) {
         f = (b & c) | ((~b) & d);
         g = i;
      } else if (i < 32) {
         f = (d & b) | ((~d) & c);
         g = (5*i + 1) % 16;
      } else if (i < 48) {
         f = b ^ c ^ d;
         g = (3*i + 5) % 16; 
      } else {
         f = c ^ (b | (~d));
         g = (7*i) % 16;
      }

      temp = d;
      d = c;
      c = b;
      b = b + LEFTROTATE((a + f + k[i] + w[g]), r[i]);
      a = temp;

   }

   return (uint64_t)(a^b) << 32 | (c^d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq $-0x4, %rax
xorl %ecx, %ecx
movl %ecx, -0x60(%rbp,%rax,4)
movl %edi, -0x5c(%rbp,%rax,4)
movl %ecx, -0x58(%rbp,%rax,4)
movl %esi, -0x54(%rbp,%rax,4)
addq $0x4, %rax
cmpq $0xc, %rax
jb 0x580b
movl $0xefcdab89, %r15d      # imm = 0xEFCDAB89
movl $0x98badcfe, %r13d      # imm = 0x98BADCFE
movl $0x10325476, %r12d      # imm = 0x10325476
movl $0x67452301, %ecx       # imm = 0x67452301
movl $0x5, %edx
movl $0x1, %esi
xorl %edi, %edi
leaq 0x5db1(%rip), %r8       # 0xb600
leaq 0x5eaa(%rip), %r9       # 0xb700
xorl %ebx, %ebx
xorl %r14d, %r14d
movl %r15d, %r11d
movl %r13d, %eax
movl %r12d, %r10d
cmpq $0xf, %r14
ja 0x587b
movl %eax, %r15d
xorl %r10d, %r15d
andl %r11d, %r15d
xorl %r10d, %r15d
movq %r14, %r12
jmp 0x58b6
cmpq $0x1f, %r14
ja 0x5892
movl %r11d, %r15d
xorl %eax, %r15d
andl %r10d, %r15d
xorl %eax, %r15d
movl %esi, %r12d
jmp 0x58b2
movl %r10d, %r15d
cmpq $0x2f, %r14
ja 0x58a6
xorl %eax, %r15d
xorl %r11d, %r15d
movl %edx, %r12d
jmp 0x58b2
notl %r15d
orl %r11d, %r15d
xorl %eax, %r15d
movl %ebx, %r12d
andl $0xf, %r12d
addl %ecx, %r15d
addl (%rdi,%r8), %r15d
addl -0x70(%rbp,%r12,4), %r15d
movb (%rdi,%r9), %cl
roll %cl, %r15d
addl %r11d, %r15d
incq %r14
addq $0x7, %rbx
addq $0x3, %rdx
addq $0x5, %rsi
addq $0x4, %rdi
movl %r10d, %ecx
movl %eax, %r12d
movl %r11d, %r13d
cmpq $0x40, %r14
jne 0x585b
xorl %r15d, %r10d
shlq $0x20, %r10
xorl %r11d, %eax
orq %r10, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq