/* WARNING: auto-generated (by autogen/useint); do not edit */

#include <immintrin.h>
typedef __m256i int64x4;
#define int64x4_load(z) _mm256_loadu_si256((__m256i *) (z))
#define int64x4_store(z,i) _mm256_storeu_si256((__m256i *) (z),(i))
#define int64x4_broadcast _mm256_set1_epi64x
#include "djbsort.h"
#include "int64down_sort.h"

void int64down_sort(int64_t *x,long long n)
{
  long long j;
  int64x4 vecxor = int64x4_broadcast(-1);
  for (j = 0;j+8 <= n;j += 8) {
    int64x4 x0 = int64x4_load(x+j);
    int64x4 x1 = int64x4_load(x+j+4);
    x0 ^= vecxor;
    x1 ^= vecxor;
    int64x4_store(x+j,x0);
    int64x4_store(x+j+4,x1);
  }
  for (;j < n;++j) x[j] ^= -1;
  djbsort_int64(x,n);
  for (j = 0;j+8 <= n;j += 8) {
    int64x4 x0 = int64x4_load(x+j);
    int64x4 x1 = int64x4_load(x+j+4);
    x0 ^= vecxor;
    x1 ^= vecxor;
    int64x4_store(x+j,x0);
    int64x4_store(x+j+4,x1);
  }
  for (;j < n;++j) x[j] ^= -1;
}
